Commit graph

978 commits

Author SHA1 Message Date
Andrew Boie 3a1cf9af2c arc: remove deprecated dynamic interrupt implementation
Change-Id: I7a81123f72458f43d3e8e1ca04a921ae6c5f1f6e
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-06 22:26:11 +00:00
Andrew Boie e98ac235e6 x86: declare internal API for interrupt controllers
Originally, x86 just supported APIC. Then later support
for the Mint Valley Interrupt Controller was added. This
controller is mostly similar to the APIC with some differences,
but was integrated in a somewhat hacked-up fashion.

Now we define irq_controller.h, which is a layer of abstraction
between the core arch code and the interrupt controller
implementation.

Contents of the API:

- Controllers with a fixed irq-to-vector mapping define
_IRQ_CONTROLLER_VECTOR_MAPPING(irq) to obtain a compile-time
map between the two.

- _irq_controller_program() notifies the interrupt controller
what vector will be used for a particular IRQ along with triggering
flags

- _irq_controller_isr_vector_get() reports the vector number of
the IRQ currently being serviced

- In assembly language domain, _irq_controller_eoi implements
EOI handling.

- Since triggering options can vary, some common defines for
triggering IRQ_TRIGGER_EDGE, IRQ_TRIGGER_LEVEL, IRQ_POLARITY_HIGH,
IRQ_POLARITY_LOW introduced.

Specific changes made:

- New Kconfig X86_FIXED_IRQ_MAPPING for those interrupt controllers
that have a fixed relationship between IRQ lines and IDT vectors.

- MVIC driver rewritten per the HAS instead of the tortuous methods
used to get it to behave like LOAPIC. We are no longer writing values
to reserved registers. Additional assertions added.

- Some cleanup in the loapic_timer driver to make the MVIC differences
clearer.

- Unused APIs removed, or folded into calling code when used just once.

- MVIC doesn't bother to write a -1 to the intList priority field since
it gets ignored anyway

Issue: ZEP-48
Change-Id: I071a477ea68c36e00c3d0653ce74b3583454154d
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-06 18:35:47 +00:00
Andrew Boie c545e19a00 x86: remove dynamic interrupts and exceptions
Change-Id: I7e9756e9a0735a7d8257ee2142d5759e883e12cc
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-06 18:35:24 +00:00
Andrew Boie 7d432bbd0a microkernel: remove deprecated task IRQs
Change-Id: I02264a587b77ae597133b9c52b342b8e5520a131
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-06 16:15:59 +00:00
Andrew Boie 4c22a95425 arc: unify copied linker script
These files were almost exactly the same and had already started
bit-rotting (note the missing net_l2 section in linker_harvard.ld)

Issue: ZEP-528
Change-Id: I5039a2c1b86c5764a361b268c33ae8b17da1a9e0
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-08-27 11:28:42 +00:00
Andrew Boie 533c2ee30d arc: fix management of IRQ priority levels
A previous re-work of IRQ priorities was led astray by an incorrect
comment. Priority level 1 is not a non-maskable interrupt priority.
In addition, zero latency IRQs are not implemented on ARC.

Timer driver now doesn't specify IRQ_ZERO_LATENCY (as that wouldn't be
correct) and its IRQ priority is now tunable in Kconfig. The default is 0.

IPM driver on both ARC and x86 side were being configured with hard-coded
priority of 2, which wasn't valid for ARC and caused an assertion failure.
The priority level is now tunable with Kconfig and defaults to 1 for ARC.

Issue: ZEP-693
Change-Id: If76dbfee214be7630d787be0bce4549a1ecbcb5b
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-08-17 20:51:05 +00:00
Andrew Boie 4760753ab0 Revert "microkernel: remove deprecated task IRQs"
This reverts commit d73a9bb9c6.
The patch was intended for 1.6.0 release.

Change-Id: Id42058b746a3d2a54e4b1a2983eb58bd10b1ed40
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-08-05 20:37:25 +00:00
Andrew Boie d73a9bb9c6 microkernel: remove deprecated task IRQs
Change-Id: I06393c8ee0e864105cd0183c92e453638679fe81
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-08-05 16:55:42 +00:00
Andrew Boie 17c0b372a2 x86: improve exception APIs
Previously, exception stubs had to be declared in assembly
language files. Now we have two new APIs to regsiter exception
handlers at C toplevel:

 _EXCEPTION_CONNECT_CODE(handler, vector)
 _EXCEPTION_CONNECT_NOCODE(handler, vector)

For x86 exceptions that do and do not push error codes onto
the stack respectively.

In addition, it's now no longer necessary to #define around
exception registration. We now use .gnu.linkonce magic such that
the first _EXCEPTION_CONNECT_*() that the linker finds is used
for the specified vector. Applications are free to install their
own exception handlers which will take precedence over default
handlers such as installed by arch/x86/core/fatal.c

Some Makefiles have been adjusted so that the default exception
handlers in arch/x86/core/fatal.c are linked last. The code has
been tested that the right order of precedence is taken for
exceptions overridden in the floating point, gdb debug, or
application code. The asm SYS_NANO_CPU_EXC_CONNECT API has been
removed; it was ill- conceived as it only worked for exceptions
that didn't push error codes. All the asm NANO_CPU_EXC_CONNECT_*
APIs are gone as well in favor of the new _EXCEPTION_CONNNECT_*()
APIs.

CONFIG_EXCEPTION_DEBUG no longer needs to be disabled for test
cases that define their own exception handlers.

Issue: ZEP-203
Change-Id: I782e0143fba832d18cdf4daaa7e47820595fe041
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-28 18:13:24 +00:00
Andrew Boie 527cd1c5b4 x86: put ISR stubs in their own text section
Rather than embedding the ISR stub directly inside the function that
invokes IRQ_CONNECT(), stick all the generated stubs in the
.text.irqstubs section.

In this way, we make things easier to debug since the stub code isn't
mixed in with the "calling" function's assembly, and we no longer
need an instruction to jump over it.

Since these are now in their own section and not embedded inside an
unrelated init function, we unconditionally generate descriptive
symbol names for each stub based on the name of the handler and the
IRQ line.

Example for HPET timer on IRQ #2:

00100440 T _timer_int_handler            <-- driver ISR
00100590 T _timer_int_handler_irq2_stub  <-- generated stub

Change-Id: I49425aef7775edbca8ad7f61d2d4f9c41cb0d39d
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-28 14:26:00 +00:00
Andrew Boie 96cadd1a9a arc: move special-purpose irq priorities to flags
We have already done this on x86 and ARM. The policy is as follows:

* IRQ priority levels starting at 0 all have the same semantics and
do not have special properties. The priority level is either ignored
on arches which do not support programmable priority levels, or lower
priority levels take precedence over higher ones.
* Special-case priorty levels are specified via flags, in which case
the supplied priority level is ignored.

Issue: ZEP-60
Change-Id: Ic603f49299ee1426fb9350ca29d0b8ef96a1d53a
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-26 15:06:28 +00:00
Inaky Perez-Gonzalez 3e63a74514 net/yaip: revert merge
Follow up to TSC decission for further discussion in the networking
WIG.

Change-Id: I148b484dfe308661573e47ed3e60cceed673bddf
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-07-22 04:43:09 +00:00
Andrew Boie 75617a6380 nios2: map all sys_write* to 32-bit to work around CPU bug
Nios II appears to have an issue with the 'stbio' instruction.

When executing this code:

   0x00400848 <+136>:	stbio	r3,0(r2)

With these registers:

  r2 0x44000c	4456460
  r3 0x3	3

The memory location (which is a memory-mapped register in the
NS16550 IP block) ends up with the value 0x103 instead of 0x3 as
expected. Before the instruction ran, the register had 0 in it.

32-bit version doesn't seem to have this problem, use that
everywhere for now. This issue has been reported to Altera.

Change-Id: I4ff0ff4cc7f9b18006d3f7a777eb292924843644
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-15 19:31:11 +00:00
Andrew Boie 8c524a291e x86: merge IAMCU and SYS V core arch code
Having two parallel implementations is a maintenance issue, especially
when some strategically placed #ifdefs will suffice.

We prefer the ASM versions for SYS V, as we need complete control of
the emitted assembly for interrupt handling and context switching.
The SYS V code is far more mature. IAMCU C code has known issues with
-fomit-frame-pointer.

The only difference between the two calling conventions is that the
first three function arguments are provided in eax, edx, ecx instead
of on the stack.

Issue: ZEP-49
Change-Id: I9245e4b0ffbeb6d890a4f08bc8a3a49faa6d8e7b
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-13 17:56:39 +00:00
Tomasz Bursztyka d8f0b9ffed net: yaip: Add an L2 layer
Net core then does not know anything about l2 related logic.
For instance ARP is used in ethernet l2 API and nowhere else.
This will be helpful when adding different technologies altogether.

Currently, only SLIP driver is enabled to use relevant l2 layer.

Change-Id: I03c93326321028d04222733ca4083e3c6b785202
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-07-13 14:06:20 +00:00
Andrew Boie 0b6c4febf1 nios2: get CPU features from ALT_CPU_* namespace
NIOS2_* namespace is deprecated.

Change-Id: I5a9b07ee33b20aa18509e9d789837f48199ab25d
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-12 18:09:53 +00:00
Tomasz Bursztyka 5f165e743f net: Add generic network interface header
This will be used by the new network stack to relate a device to actual
network context, and used in the different layers (mac, ip ...).

Change-Id: I30c08fa975314544c36b71636fd9653d562891b3
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-07-12 07:20:51 +00:00
Andrew Boie 5b9378ab7e nanokernel: move dataCopy() and bssZero() to common code
Used by ARC, ARM, Nios II. x86 has alternate code done in assembly.

Linker scripts had some alarming comments about data/BSS overlap,
but the beginning of BSS is aligned so this can't happen even if
the end of data isn't.

The common code doesn't use fake pointer values for the number of
words in these sections, don't compute or export them.

Change-Id: I4291c2a6d0222d0a3e95c140deae7539ebab3cc3
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-08 18:23:11 +00:00
Andrew Boie ef29812d51 nios2: support more global pointer scenarios
We now allow use of -mgpopt=global and -mgpopt=data. The 'global'
option is now the default instead of compiler-default local, expanding
global pointer usage to all small data in the system.

For systems where all RAM is less than 64K, the 'data' option may be
appropriate.

Some fixes had to be made to the system in order to get around some
issues:

* prep_c.c no longer uses fake linker variables to figure out the size
of data or BSS, as these gave the linker fits as it tried to compute
relative addresses to them.

* _k_task_ptr_idle is create by sysgen and placed in a special section.
Any small data in a special section needs to be declared extern
with __attribute__((section)) else the compiler will assume it's in
.sdata.

* same situation with extern references to k_pipe_t (fixed pipe_priv
test)

For legacy applications being ported to Nios II which do things that
freak out global pointer calculation, it can be disabled entirely.

Change-Id: I5eb86ee8aefb8e2fac49c5cdd104ee19cea23f6f
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-06 18:14:31 +00:00
Andrew Boie fca3591bce nios2: enable use of global pointer indirect addressing
needs to be 0x8000 after .sdata and .sbss sections since
register offsets are 16-bit signed values.

Change-Id: Ia7486d32af81e54a6ebac6be7ec308dfdeafe79e
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-06 16:33:32 +00:00
Andrew Boie 231e617593 nios2: enable instruction/data caches
The caches get initialized on boot and flushed after XIP copy
takes place.

Change-Id: I642a14232835a0cf41e007860f5cdb8a2ade1f50
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-01 00:34:47 +00:00
Andrew Boie 71e22620a8 nios2: define vaddr_t and paddr_t
Change-Id: I09b91159b4c30876026fe7ae32109afb9164332d
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-30 12:10:43 -07:00
Peter Mitsis 017dff9d7d arm float: Add FPU structures and fields to the SCS
Change-Id: I053267549ee73f17a73c8eeb6df3b716ab136e03
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-06-29 20:33:32 +00:00
Peter Mitsis d5709b6c92 arm float: Update exception stack frame structure
Updates the exception stack frame structure to include floating point
registers.

Change-Id: I0fef784cf4d91dda245180abd75bfd9221825fba
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-06-29 19:47:59 +00:00
Andrew Boie 7511a4f606 nios2: exceptions: remove remaining muldiv references
We are not going to handle unimplemented math instruction
exceptions at runtime. Remove remaining comments and exports
related to this. We don't need to leave a gap in the exception
stack frame for it either.

Change-Id: I4f1f3980a0e43bbf6f2f7488a9182f7acb06be05
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-29 05:23:55 +00:00
Andrew Boie 0b98056350 _nios2_read_sp: fix register read
We were reading et and not sp.

Change-Id: I064e8bebf2107f1900d31c213e7752e1aaead2ca
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-28 22:46:02 +00:00
Andrew Boie a1c71b2043 nios2: include required macros for byte addressing
These are no-ops since this is not an arch that isn't byte-
addressable.

Change-Id: I09b0fd8b8d85f67bcca2dcb6ebc35843c19afa45
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-23 05:37:32 +00:00
Andrew Boie 4ae4d2f4d1 nios2: include .sbss in BSS section
Change-Id: I1165d65ae8505ec79166acc8ebde86611ac50e08
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-22 16:42:21 +00:00
Andrew Boie 738dec483e nios2: add static interrupt handling code
Supports Internal Interrupt Controller only for now; EIC
supoort tracked in ZEP-258.

Change-Id: I2d9c5180e61c06b377fce4bda8a59042b68d58f2
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-22 16:42:21 +00:00
Andrew Boie e2ff2fdd91 nios2: add base exception handling code
Change-Id: I56b0ec1a3576a77ca7bd6f2c0217de8053406927
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-22 16:42:20 +00:00
Andrew Boie 7bd697b0d5 nios2: add _nios2_reg_write/read functions
The technical manuals and example HAL code frequently refer to
register bank numbers from some base address. Add these helper
functions to read and write registers correctly using this
notation.

Change-Id: Ia082f5cc89081fcea2cb6ad8204c1b9b2650d3fd
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-22 16:42:19 +00:00
Andrew Boie 9a7443591a nios2: linker.ld: keep exception code for non-XIP
The KEEP() is only necessary for the exception entry point
as it sits at a magic memory address and isn't referenced by
other code.

Change-Id: I8443e8aa23059b65eaf9c5a1cf3f9b14b04737d5
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-22 01:31:13 +00:00
Andrew Boie 5c586ee6b2 nios2: linker.ld: ensure reset code isn't discarded
This isn't directly referenced by other code in the binary,
it just sits at a magic memory address. Make sure gc-sections
doesn't throw it away.

Change-Id: I1c00a163dbf2eb4866ebadc7f1d70bcc6845b8d1
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-22 01:31:12 +00:00
Andrew Boie a3c2812e37 nios2: linker.ld: remove some assertions
These aren't valid in all circumstances; the reset vector in most cases
needs to be in ROM.

Change-Id: I83df8762eecc53c99af92f3b0972dfbafac457fb
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-22 01:31:12 +00:00
Inaky Perez-Gonzalez 2e7f3bb858 doc: fix doxygen warnings 'documented symbol XYZ was not declared or defined.'
The problem is doxygen's parser is getting confused by constructs as:

  static inline __attribute__((always_inline))
 	void sys_out8(uint8_t data, io_port_t port)
  {
 	_arc_v2_aux_reg_write(port, data);
  }

Too many words at the beginning of the function definition. So change
to use the macro ALWAYS_INLINE (which is already defined to mean
'inline __attribute__((always_inline))`.

Kills:

sys_io.h:37: warning: documented symbol `static inline void sys_out8' was not declared or defined.
sys_io.h:47: warning: documented symbol `static inline uint8_t sys_in8' was not declared or defined.
sys_io.h:58: warning: documented symbol `static inline void sys_out16' was not declared or defined.
sys_io.h:68: warning: documented symbol `static inline uint16_t sys_in16' was not declared or defined.
sys_io.h:79: warning: documented symbol `static inline void sys_out32' was not declared or defined.
sys_io.h:89: warning: documented symbol `static inline uint32_t sys_in32' was not declared or defined.
sys_io.h:120: warning: documented symbol `static inline int sys_io_test_bit' was not declared or defined.
sys_io.h:133: warning: documented symbol `static inline int sys_io_test_and_set_bit' was not declared or defined.
sys_io.h:146: warning: documented symbol `static inline int sys_io_test_and_clear_bit' was not declared or defined.
sys_io.h:161: warning: documented symbol `static inline void sys_write8' was not declared or defined.
sys_io.h:171: warning: documented symbol `static inline uint8_t sys_read8' was not declared or defined.
sys_io.h:182: warning: documented symbol `static inline void sys_write16' was not declared or defined.
sys_io.h:192: warning: documented symbol `static inline uint16_t sys_read16' was not declared or defined.
sys_io.h:248: warning: documented symbol `static inline int sys_test_bit' was not declared or defined.
sys_io.h:261: warning: documented symbol `static inline int sys_test_and_set_bit' was not declared or defined.
sys_io.h:274: warning: documented symbol `static inline int sys_test_and_clear_bit' was not declared or defined.

Change-Id: Id10e9b6cd44a370ccc732c17b23fb66bd1845205
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-06-16 13:11:06 -07:00
Andrew Boie 3b9302158c nios2: set up common linker script for XIP and non-XIP
We will require 6 variables to be defined by SOC-specific
linker script; these values in turn can be pulled from
defines in layout.h.

To help position code correctly we define two new ELF sections
for this arch, 'reset' and 'exceptions'.

Change-Id: Idffbd53895945b7d0ec0aac281e5bf7c85b4b2c2
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-10 15:22:41 +00:00
Andrew Boie 01724d319d nios2.h: cleanup API
This header was pulled in verbatim from Altera HAL and had
some style and naming issues. The inline functions or macros
which read registers can now be used in expressions.

Change-Id: I7a463717051efd2f9dd36e8a84d357852fbf9215
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-10 15:22:41 +00:00
Jithu Joseph 05158f76d7 pm/apic: Keep irq to vector table in RAM when needed by PM
In scenarios where device PM is enabled and dynamic irqs are
used, move the irq to vector table to RAM and keep it updated,
so that we can use this to restore IOAPIC/LOAPIC vector entries.

Jira: ZEP-224
Change-Id: I0d4350d4e30f8ca337a2a1d4f012748c3cb450f4
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2016-05-24 00:31:38 +00:00
Chuck Jordan 568101259d arc: linker.ld modified to handle DRAM configuration as well
For EM Starter Kit, one of the SOC choices has DRAM and no FLASH.
If FLASH_SIZE is 0, the linker command file will create
SRAM, ICCM and DCCM memories (and no FLASH). SRAM is really DRAM.

Also, the linker.ld file is extended to handle microkernel
objects.

linker_harvard.ld has "all rights reserved". added to banner.

Change-Id: Ia433578b94ce91722f3670819f44befafeecf878
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-05-24 00:02:17 +00:00
Anas Nashif b7a72220ea trivial: fix comment style
Change-Id: Iaa1b27f2ac5a01598a044303ba45881ce45b2f4f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-21 11:58:33 +00:00
Chuck Jordan 7b42324e77 arc: CONFIG_XIP can work with ICCM
I've tested that CONFIG_XIP does work with Harvard.
User's can build CONFIG_XIP=y, and then have their bootable image
be placed in SPI-FLASH. A bootloader will load up ICCM contents.
Zephyr will then copy remaining data from ICCM to DCCM.
This takes a bit of ICCM memory to do it, but it will work.

Change-Id: Ic1cd201d19aab9083d63334527d9d68f4edc6075
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-05-19 01:25:53 +00:00
Chuck Jordan c3ad7615ff arc: Add linker command file for Harvard architecture
Some ARC CPUs can be built with separate instruction bus
and data bus (i.e. Harvard Architecture). Such systems
have only ICCM and DCCM memories. When CONFIG_HARVARD
is defined, the initial stack pointer is set to the
TOP of the DCCM memory. Currently there is no SOC that
existing in Zephyr tree that sets CONFIG_HARVARD, but
this will be coming soon.

Change-Id: I2016d1f472fbdad683a964aa0b65c5263ecfb6cf
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-05-15 01:48:41 +00:00
Fabrice Olivero 26b0b4c920 Add interrupt stub label for profiler (interrupt event)
The stub label is created with ISR and IRQ number since the same
ISR can be used by several IRQs

Change-Id: I0ea909fddbce7a70c754befd095b7a3b36fffab4
Signed-off-by: Fabrice Olivero <fabrice.olivero@intel.com>
2016-05-12 02:19:56 +00:00
Chuck Jordan f5912a46ce arc: Add defines for many more useful auxiliary registers
The ARC CPUs have several other features controlled by aux registers.
Specifically, I will be needing ones for i-cache, d-cache and various
BUILD registers that indicate which features are present.

Change-Id: If15a330f4ea5aa519655f88526fbb5f600d7cc0b
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-05-09 20:56:50 +00:00
Andrew Boie 7ff96dc4a4 nios2: implement _arch_irq_lock / unlock
Change-Id: I16fd64577f45db9531dd0d472279c255c5b8ff13
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-05-09 18:09:29 +00:00
Andrew Boie c5a62dcc9c nios2: implement asm_inline_gcc functions for sys_io.h
Nios II has no special instructions for testing bits, ffs, etc.
However, when poking memory-mapped peripherals, special *io variants
of ld and st instructions must be used to avoid issues with the
caches.

find_msb_set / find_lsb_set are implemented using universal GCC
compiler built-ins. It's not clear why this approach was not taken
on other arches.

The sys_in/sys_out/sys_io functions are completely removed as there
is no concept of these on Nios II.

sys_read/sys_write functions implemented using special GCC builtins
for the Nios II so that we don't have to use inline assembly.

Rest of the operations implemented in C, there is no requirement that
they be atomic.

Change-Id: Ic251fc7d7f342543dace4ccb3e429937b303215e
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-05-09 18:09:29 +00:00
Andrew Boie cfe645cef3 nios2: add config-independent CPU defines
This file is taken verbatim from the Altera Nios II HAL
source and includes various useful processor defines
and macros.

Change-Id: Idbf0b49bebe33bb5a53f5155d927bafadda9a2fe
Origin: nios2.h Altera Nios II HAL
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-05-09 18:09:28 +00:00
Andrew Boie 8564875a98 nios2: provide and include soc-specific headers
BSP builds for Nios II generate a linker.h and system.h which reflects
the configuration for that CPU. This can vary depending on how the CPU
is wired up in QSYS, so it needs to be at the SOC level--we essentially
treat any given CPU configuration as a SOC in Zephyr build terms.

Include these files from <arch/cpu.h>.

Change-Id: I12f76600107fec1a14a2f9cb82b0f55915ec03a6
Origin: Altera Quartus tools, machine generated
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-05-09 18:09:28 +00:00
Andrew Boie 352f853803 nios2: add missing linker script
Got lost in the .gitignore when these files had .cmd
extension.

Change-Id: I8a8d51014b621026b739525f3f9a3e8a20cb5ad0
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-05-09 18:09:27 +00:00
Andrew Boie 7f7337a0fe nios2: fatal: add _SysFatalErrorHandler and _Fault stub
ZEP-252 will handle implementation of the code here.

Change-Id: I3e9a6c7cdf2d5a3b0240317b772628fead528095
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-05-09 18:09:27 +00:00
Andrew Boie 2d5645e57a nios2: add minimal crt0.S
At the moment this just jumps into prep_c, with comments left
on other things that need to be done. Having this here ensures that
the early boot code isn't discarded by gc-sections.

vector_table.c removed, it isn't the right approach for this CPU.
Proper method for initializing reset and exception vectors still
being investigated.

Change-Id: Id7965c671f1a55c42ecfb65119497405a646bec4
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-05-09 18:09:26 +00:00
Andrew Boie ff872dc349 build: rename non-generated linker scripts to .ld extension
Avoids confusion with .gitignore rules, which were inadequate to
cover all the places where these files are found. At least in
VIM, these files are now syntax highlighted correctly.

Change-Id: I23810b0ed34129320cc2760e19ed1a610afe039e
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-05-09 18:09:26 +00:00
cjordan 9afe58de3e include/arch/arc: fix memory permissions
Change-Id: Ibb77088a7c9095f4725b6a65bc30a1db4220f254
Signed-off-by: cjordan <cjordan@synopsys.com>
2016-05-04 14:54:46 +00:00
Andrew Boie 9433895954 nios2: basic build, non-functional
Basic build framework for Nios2. Everything is stubbed out,
we just want to have a build going so that we can start to
parallelize implementation tasks.

This patch is not intended to be functional, but should be
able to produce a binary for all the nanokernel-based
sanity checks.

Change-Id: I12dd8ca4a2273f7662bee46175822c9bbd99202a
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-05-03 23:18:45 +00:00
Johan Hedberg e2a1c43cb3 include/arch/arc: Fix minor space vs tab issue in indentation
Indentation should be with tabs only (these lines were with tab +
spaces).

Change-Id: I8f199b1d6972b02513e4c293636606f481641266
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-05-01 08:25:57 +03:00
Anas Nashif 909dd7ee05 arduino_101: support booting with original bootloader
To boot zephyr on the Arduino 101 running the original bootloader
which supports DFU, set the following in your application configuration
file:

CONFIG_SS_RESET_VECTOR=0x40034000
CONFIG_PHYS_LOAD_ADDR=0x40010000
CONFIG_VERSION_HEADER=y

Jira: ZEP-219
Change-Id: Ia015a7b6fce888b49ed22c558de992132d4713ea
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-30 13:56:54 -04:00
Anas Nashif 1a1f7fd916 arc: make SRAM/DCCM values configurable
Remove hardcoding and make the values configurable. Also make the
Kconfig variables consistent with other architectures.

Change-Id: I69334002303d4d8abaf7363d9134fd5f46ce4eeb
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-25 19:17:03 +00:00
Tomasz Bursztyka fea1c49ba2 gpio: Improve the public API to handle multi callbacks
Many sub-systems might require to set a callback on different pins.
Thus enabling it via changing the API.

It is also possible to retrieve private-data in the callback handler
using CONTAINER_OF() macro (include/misc/util.h).

Former API is still available, and is emulated through the new one.
Using both should not be a problem as it's using new API calls.
However, it's now better to start using the new API.

Change-Id: Id16594202905976cc524775d1cd3592b54a84514
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-22 22:15:12 -04:00
Benjamin Walsh 270d602efd debug/x86: add runtime info needed by target debuggers
Introduce an x86 interrupt stack frame that contains more information
than the non-debug one, namely the caller-saved GPRs, as well as an API
to retrieve it. Able to handle nested interrupts stack frames.

Change-Id: If182aaa2f34e4714b16ca65ff79da63b72d962f7
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-04-16 05:29:22 +00:00
Maciek Borzecki 883baedc64 arm: linker: fix indentation
Change-Id: I72a4947119f1f2b6fcd59fadbe38a54b6bc1ea61
Signed-off-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2016-04-01 13:12:58 +00:00
Dmitriy Korovkin 79351142e4 arm: Fix wrong function comment
Change-Id: Ifd977289c92d3c88ee2ca93dd964307372d49ca0
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-03-31 21:28:23 +00:00
Andrew Boie c73a42bccc x86: irq: fix _get_dynamic_stub() calculation
It wasn't correct to add the size of the long jump instruction
as it *replaces* a short jump instead of just being after it.
So redefine this to be the difference in size between these
two instructions.

Change-Id: I65be2afab19d9cd8b096551acde0156f0503df87
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-03-30 22:24:16 +00:00
Alexandre d'Alton f91e55b798 arc: implement stack checking
ARC CPU has stack checking feature that allows to trigger an exception
whenever the stack is incorrectly accessed.
This patch implements the stack_top and stack_base register updates on
context switches, and activates the Stack Checking bit of STATUS32
register when the CPU is in the context of a fiber or task.
As GCC accesses the non-yet allocated stack with frame pointer enabled,
this patch also add the omit-frame-pointer gcc flag in order to work
properly.

Change-Id: Ia9e224085a03bd29d682fb8f51f8e712f2ccb556
Signed-off-by: Alexandre d'Alton <alexandre.dalton@intel.com>
2016-03-29 01:25:49 +00:00
Dan Kalowsky 983ec93bd4 arch: arm: move nmi to common location
The nmi_on_reset.S functions are used by all ARM platforms.  It
makes no sense to repeat the same code for all platforms.  Moving
the code from each SOC implementation to arch/arm/core.

The same treatment for the NMI_INIT() macro.  Moving it from a per
SOC implementation to the include/arch/arm/cortex_m/nmi.h.

Change-Id: I574d8880a44046cc7b9e1b635e80d6e83657b8c1
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-03-12 03:20:36 +00:00
Jeff Blais 6896a7c2b4 arm: add generic memory-mapped I/O routines for Cortex-M
Add sys_read32(), sys_write32 and sys_set_bit() routines.

Change-Id: I4c624f30cda743d575afdef7f7790d6cc260e01d
Signed-off-by: Jeff Blais <jeff.blais@windriver.com>
2016-03-09 06:39:15 +00:00
Andrew Boie f0a01163be sys_io: don't allow negative bit offsets
Use of these is the mark of a deranged imagination.

Change-Id: Ib4b5f78cf61c016e333288090b397e9a3e0b8a40
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-03-04 16:26:21 +00:00
Andrew Boie 9df398b0d5 sys_io: introduce bitfield ops
These are guaranteed to work for bitfields that are
larger then 32 bits wide.

Change-Id: I39a641f08a255478fae583947bced762950d12ff
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-03-04 15:12:06 +00:00
Andrew Boie e444825ee3 irq: formalize external zephyr interrupt API
The app-facing interface for configuring interrupts was never
formally defined, instead it was defined separately for each arch
in their respective arch-specific header files. Occasionally these
would go out of sync.

Now there is a single irq.h header which defines this interface.
To avoid runtime overhead, these map to _arch_* implementations of
each that must be defined in headers pulled in by arch/cpu.h.

Change-Id: I69afbeff31fd07f981b5b291f3c427296b00a4ef
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-26 15:53:22 +00:00
Andrew Boie f21ff23310 x86: add debug function to dump IDT
Looking at the IDT in a debugger is confusing, add a pretty-printing
function.

Change-Id: Iacc5e204e5d11e3e875c75ddf6d2e2e80b230299
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-10 16:02:17 +00:00
Andrew Boie 4455ee6d87 ARM: rebase available priority levels to 0
We have a new policy: users should not be able to configure
an interrupt with "forbidden" priority levels, and any priority
levels with special semantics will be activated by flags.

Change-Id: I757c19cfedcb1d0938eaf4da348ddafb71b3e001
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-08 21:47:35 -05:00
Andrew Boie 9fc3afc339 x86: rebase priority levels
Having priority levels 0 and 1 reserved on x86 due to implementation
details on how the CPU uses the vector table is confusing to users,
and makes it unnecessarily difficult to share drivers between arches.

Now on x86, priority levels 0 and 1 are available. Semantically, all
priority levels have had 2 subtracted from them.

It is no longer necessary to specify a priority level when the
vector itself is specified. If an IDT entry has a specific vector
associated with it, any priority argument is simply ignored.

In gen_idt, some simplifications have been made:
- The printed representation of a generated entry now fits on one line
- Some checks being done in validate_priority() were redundant, as
  generate_interrupt_vector_bitmap() also ensures that there are
  sufficient free vectors within a priority level.

Change-Id: I26669d8ee0a53f48fbc2283490a8c42d8b1daf8e
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-08 21:45:07 -05:00
Andrew Boie 897ffaeb2c irq: rename irq_connect() to IRQ_CONNECT()
It's not a function and requires all its arguments to be build-time
constants. Make this more obvious to the end user to ease confusion.

Change-Id: I64107cf4d9db9f0e853026ce78e477060570fe6f
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:25:25 -05:00
Andrew Boie 2ee9aca31a irq: size _irq_to_interrupt_vector_table
Most systems have far less than 256 IRQ lines available, so
save some bytes in ROM by making this a config option.

On systems with MVIC, omit the table entirely as the mapping
is fixed.

The build cmd_gen_idt is slightly easier to read and will fail
immediately if any of the commands in the sequence error out.

Change-Id: I411f114557591e5cd96b618e6f79f97e8bedadf0
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:25:25 -05:00
Andrew Boie bd18487727 x86: if no dynamic irqs, omit _interrupt_vectors_allocated
This bitfield is only needed to find unused vectors in the IDT
for installing dynamic interrupts.

Change-Id: I34ecd330774a0e50f240b4396527682eded29627
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:25:25 -05:00
Benjamin Walsh bd94d98255 arm: add connecting exceptions at runtime
Add sys_exc_connect() (and its x86-compatible alias nanoCpuExcConnect())
that allows connecting an exception handler at runtime.

The current implementation is a bit of a bastard, to avoid disturbing
the current implementation of the exception handlers. Instead of hooking
_exc_wrapper() in all vectors and adapting the exception handlers, the
current exception handlers are still hooked directly in the vectors.
When an exception is hooked at runtime, _exc_wrapper() gets installed in
the vector and the real handler gets inserted in _sw_exc_table; this
means that the scheme only works with non-XIP kernels.

This should be enhanced so that _exc_wrapper() is hooked in all vectors,
and that current exception handlers (for faults mostly) are reworked to
be inserted in the _sw_exc_table and wrapped in _exc_wrapper().

Change-Id: Icaa14f4835b57873d2905b7fbcbb94eeb3b247d1
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:25:24 -05:00
Benjamin Walsh 9dc2374d1c arm/nvic: add _NUM_EXC symbol for number of exceptions
Change-Id: Ibd1660c07a32041c72d2cbb0c2049e04647bb64e
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:25:24 -05:00
Benjamin Walsh c4a093a24e arm: rework _ScbSystemReset() into sys_arch_reboot()
Rename the function and allow it to handle the 'type'
argument, which is ignored in this case.

Change-Id: I3d3493bea4511b2d026747505e7e52c5acc85012
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:25:24 -05:00
Benjamin Walsh 2ace19ede8 arm: allow accessing GPRs in ESF by their real name
The ESF was built using the 'alias' names of the GPRs (a1, lr, pc, etc)
rather than their 'real' name (rN).

Change-Id: I49cae5e94869a79a3165dc7f2347d8cec39dbf67
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:25:24 -05:00
Benjamin Walsh 85138855f0 arm: add macro for defining GPRs with aliases
On ARM, GPRs are often known by two names. E.g. the stack pointer is
both 'sp' and 'r13', the first parameter to a function 'a1' and 'r0',
etc. This macro allows defining them in a data structure, e.g. in the
ESF,  without having to create a union, use the correct type, etc: it is
less error-prone and makes for shorter code.

	sys_define_gpr_with_alias(name1, name2)

Change-Id: Ie4a6caa1ac23f26be4f7f0e05e9265f2655062cc
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:25:24 -05:00
Benjamin Walsh 21628d41d0 arm: add support for linking images entirely in SRAM
The image will be linked at a different address and with different
ROM/RAM sizes to allow running a bootloder image that loads a payload
image. The addresses/sizes depend on if it is a XIP image or not
(CONFIG_XIP), and in the case of a XIP image, if it is a bootloader
image (CONFIG_IS_BOOTLOADER) or not.

In the case of a bootloader, it is given the full ROM and
CONFIG_BOOTLOADER_SRAM_SIZE kB of SRAM.  When not a XIP image, it is given
the full SRAM minus CONFIG_BOOTLOADER_SRAM_SIZE kB, and is linked at the
start of SRAM.

Change-Id: Ibbb693c7bff022f313dac40f21c04a61f4bed115
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:25:24 -05:00
Peter Mitsis 8e35cc8eb4 build: Add C++ support
Adds C++ support to the build system.

Change-Id: Ice1e57a13598e7a48b0bf3298fc318f4ce012ee6
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:25:23 -05:00
Peter Mitsis a0e4568760 c++: Add extern "C" { } block to header files
Adds extern "C" { } blocks to header files so that they can be
safely used by C++ source files.

Change-Id: Ia4db0c36a5dac5d3de351184a297d2af0df64532
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:25:22 -05:00
Andrew Boie 2a1ae3f436 ARM: ARC: put sw_isr_table in ROM by default
We can save a great deal of RAM this way, it only needs to be
in RAM if dynamic interrupts are in use.

At some point this config option broke, probably when static
interrupts were introduced into the system.

To induce build (instead of runtime) errors when irq_connect_dynamic()
is used without putting the table in RAM, the dynamic interrupt
functions are now conditionally compiled.

Change-Id: I4860508746fd375d189390163876c59b6c544c9a
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:25:21 -05:00
Benjamin Walsh b047a8c9e0 arm: add function for relocating Cortex-M3 vector table
This is needed for setting up an image that runs entirely from SRAM,
including its vector table.  Ensure integrity of relocated vector table
by using serialization instructions when moving the vector table to
ensure it has been fully written before something makes use of it.

Change-Id: I00c600d557c87c75847f67fbc42f1c2c16157608
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:25:21 -05:00
Andrew Boie 009a19f164 x86: remove option to force IDT in RAM
This option misunderstands how XIP works. The IDT is ALWAYS in ROM,
the question is whether crt0 will copy it into RAM or not. You can't
save ROM space in this way.

Change-Id: I58025e3d71ead35730d0a5026213299b4fcb5eb9
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:25:21 -05:00
Andrew Boie d9cfbd5a61 interrupts: new static IRQ API
The interrupt API has been redesigned:

- irq_connect() for dynamic interrupts renamed to irq_connect_dynamic().
  It will be used in situations where the new static irq_connect()
  won't work, i.e. the value of arguments can't be computed at build time
- a new API for static interrupts replaces irq_connect(). it is used
  exactly the same way as its dynamic counterpart. The old static irq
  macros will be removed
- Separate stub assembly files are no longer needed as the stubs are now
  generated inline with irq_connect()

ReST documentation updated for the changed API. Some detail about the
IDT in ROM added, and an oblique reference to the internal-only
_irq_handler_set() API removed; we don't talk about internal APIs in
the official documentation.

Change-Id: I280519993da0e0fe671eb537a876f67de33d3cd4
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:25:17 -05:00
Dirk Brandewie 13075f59bd x86: Replace CONFIG_IAMCU with CONFIG_X86_IAMCU
We are checking against the wrong option, which does not exist.

Change-Id: Ied24daa0930bc4629750ea90f3ac6dbc45e87fff
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:25:17 -05:00
Andrew Boie 89ec552be9 x86: iamcu: fix exception NANO_ESF parameter
On SysV ABI, the NANO_ESF parameter is passed in via the stack.
For IAMCU, this is instead expected to be in EAX.

_ExcEnter is currently using EAX to stash the return address of
the calling stub while it does a stack switch. Change it to use ECX
for this purpose, and if we are running with IAMCU place the
parameter in EAX instead of pushing it.

The output of the fault handler has been cleaned up a bit and it
now also includes the code segment.

Change-Id: I466e3990a26a1a82dd486f3d8af5395eab60b049
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:25:16 -05:00
Andrew Boie 7cb5276158 x86: remove NANO_SOFT_IRQ from zephyr
This was never implemented on ARC/ARM and has been superseded
by irq_offload().

Some checks that were only done with CONFIG_LOAPIC_DEBUG fall
under the category of 'shouldn't ever happen' and have been
converted into assertions, instead of propagating return values
which are largely never checked.

Change-Id: I4eedca05bb7b384c4f3aa41a4f037f221f4a9cfe
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:25:16 -05:00
Andrew Boie 4733187f1b x86: put the IDT in ROM if possible
If we are not doing any dynamic interrupts or exceptions, we
can put the IDT in ROM and save a considerable amount of RAM,
up to 2K if the IDT is the default size of 256 entries.

The _interrupt_vectors_allocated table can also be put in ROM
if we're not using any dynamic interrupts.

We introduce a new Kconfig option to force the IDT to be in RAM
for situations where no dynamic IRQs are used, but ROM footprint
needs to be conserved.

Change-Id: I38c9f1a8837b4db9f3dea1caa008374a26cbbf1d
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:25:15 -05:00
Peter Mitsis 4146b346b4 x86: streamline irq_lock()/irq_unlock()
The routines _int_latency_start() and _int_latency_stop() have been
replaced by macros that evaluate to nothing when the kernel config
option INT_LATENCY_BENCHMARK is not enabled thereby giving a performance
boost to the x86 versions of irq_lock() and and irq_unlock().

Change-Id: Iabfa7bf001f5b8396e7bcf5eebd6b1aa342bac46
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:25:13 -05:00
Anas Nashif 10bb38c186 Use SoC instead of platform.
Change terminology and use SoC instead of platform. An SoC provides
features and default configurations available with an SoC. A board
implements the SoC and adds more features and IP block specific to the
board to extend the SoC functionality such as sensors and debugging
features.

Change-Id: I15e8d78a6d4ecd5cfb3bc25ced9ba77e5ea1122f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:11 -05:00
Dirk Brandewie d8a1c8ef17 x86: iamcu: Add support for the IAMCU calling convention.
Add support for compilers conforming to the IAMCU calling convention
as documented by
https://github.com/hjl-tools/x86-psABI/wiki/iamcu-psABI-0.7.pdf


Change-Id: I6fd9d5bede0538b2049772e3850a5940c5dd911e
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:25:06 -05:00
Dirk Brandewie 88ce5bc8f5 kernel: remove CONFIG_INT_LATENCY_BENCHMARK fences from code path
Add null definitions for the interrupt latency measurement API so we
can remove compile fences in C code.

Change-Id: If86eedf79afcb49002108814dd4fb864956eb667
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:25:04 -05:00
Andrew Boie a50f923504 x86: fatal: report vector number of spurious interrupts
Change-Id: I79de1a77d2b5f87aa3bd1a7aebd0253dbb069252
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:25:04 -05:00
Anas Nashif 275ca60b08 Fixed file description and applied doxygen style
Removed old style file description and documnetation and apply
doxygen synatx.

Change-Id: I3ac9f06d4f574bf3c79c6f6044cec3a7e2f6e4c8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:58 -05:00
Juan Manuel Cruz bc1a79c4c3 irq: removes priority parameter from IRQ_CONFIG macro
Removes the 'priority' parameter from the IRQ_CONFIG macro.
This parameter was not used anymore in any architecture.
The priority is handled in the IRQ_CONNECT macro.
The documentation is updated as well.

Change-Id: I24a293c5e41bd729d5e759113e0c4a8a6a61e0dd
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:24:57 -05:00
Juan Manuel Cruz b51b3da133 quark se arc: irq static initialization support.
Adds static irq support for the Quark SE platform for the ARC core.

New linker sections and sw isr table initialization is needed to support
static IRQ.

Change-Id: I82af98a189f5a156e7f1018f3ecdbfa73ad3e6ef
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:24:56 -05:00
Juan Manuel Cruz a894799c94 arc: static IRQ handling
Adds support for static IRQ handler initialization.

Currently, IRQ_CONNECT and IRQ_CONFIG macros are emulating static
behavior through dynamic initialization.
This commit updates the macros to get real static initialization.
IRQ handlers must be assigned at build time.

Change-Id: Ia07fb25a5e4dae489f84ffcedb28007ee18a3b82
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:24:56 -05:00
Juan Manuel Cruz 4613fc8c74 arc: adapt to standard IRQ_CONNECT_STATIC signature.
IRQ_CONNECT_STATIC takes 6 arguments on other
architectures, but the ARC one had only 5.

Change-Id: I257e8db12582ee2d6f93bba63af9aa597197a53d
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:24:56 -05:00
Andrew Boie abc85a3d3e x86: set IRQ vectors properly for MVIC
With MVIC these can't be arbitrarily assigned and the vector must be
<irq num> + 0x20.

The correct number of vectors is now set for footprint-min on D2000.

Change-Id: Ibf59921dbc438c7465b7050dd74d0badc9a91fc3
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:55 -05:00
Andrew Boie 2ec374a8df irq_offload: ARC implementation
Uses the "trap_s" exception to simulate entry into IRQ context;
offloaded functions run on the FIRQ stack.

Change-Id: I310ce42b45aca5dabd1d27e486645d23fa0b118f
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:55 -05:00
Benjamin Walsh 02a6baee12 linker: move check for bad initlevels to the end of the sections
This way, it does not fall in the middle of a group, like the RAM group
and as a side-effect potentially move the dot (current address pointer).

Change-Id: Iefbff8bbeadfc740dee61154d7db99b7b7aad6d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:55 -05:00
Benjamin Walsh d7fc200a2c arc: abstract bulk of linker script
The linker scripts for the quark_se_ss and generic_arc platforms are the
exact same, so extract the contents in an includable file.

Change-Id: I2cb90a6f819b12db77880228e41ff14c9755d59a
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:55 -05:00
Dmitriy Korovkin fb6de2d486 init: Add protection against incorrect levels or priorities
Initialization level can be one of five predefined.
Init priority is numeric from 1 to 99. If init level or priority
is defined wrong, linker prints out the message and stops.

Change-Id: I165a32ffb668cda983fd48eb2aa7b94998e31a18
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:24:54 -05:00
Anas Nashif 77ba3c3b8b kconfig: define architecture as a kconfig variable
Do not depend on environment variables and use a kconfig variable
for defining the architecture.

In addition, remove the X86_32 variable, it just duplicates X86 for
not good reason, at least until start supporting MCUs with 64bit.

Change-Id: Ia001db81ed007e6a43f34506fed9be1345b88a4b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:52 -05:00
Andrew Boie 6406dc6a66 arc: fix static IRQ config macros
These should now work for drivers written for other arches.
Still a hack to do all the IRQ setup at runtime.

Change-Id: I9717f74abef3b9934f9a1c0acbd76d960ed7a3cb
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:48 -05:00
Anas Nashif 140392198d x86: add missing parameter documentation
The new flags parameter needs some documentation.

Change-Id: I24dc9df62323957bb4b294adf27487df3f76ea01
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:48 -05:00
Anas Nashif 44b71cc1df x86: remove duplicate const
Was exposed when building with clang. No need for a second const.

Change-Id: Ie97f6a4756aff62ce969e3eb786593f2fc175a56
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:47 -05:00
Dmitriy Korovkin f1420515a7 irq: Add flags to IRQ_CONNECT_STATIC() macro and irq_connect() function
Flags allow passing IRQ triggering option for x86 architecture.
Each platform defines flags for a particular device and then
device driver uses them when registers the interrupt handler.

The change in API means that device drivers and sample
applications need to use the new API.

IRQ triggering configuration is now handled by device drivers
by using flags passed to interrupt registering API:
IRQ_CONNECT_STATIC() or irq_connect()

Change-Id: Ibc4312ea2b4032a2efc5b913c6389f780a2a11d1
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:24:44 -05:00
Tomasz Bursztyka 7cbe13ce3f sys_io: x86: Fix I/O ports bit operations
I/O ports are not memory and thus such asm instruction cannot follow
such constraint. Plus, usual BT* instruction can be used on normal
registers.

Change-Id: Ie3aad668173962a0a90e7cb11231c7843836d412
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:44 -05:00
Tomasz Bursztyka 47369555b8 sys_io: x86: Make sys_in/sys_out fitting properly in other functions
Let the compiler decide about the registers to use, depending on which
functions those are called from (as they might be already in use or
not).

Change-Id: I00afa0f82c740c8ea70133d85ab67e9cb117187d
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:44 -05:00
Peter Mitsis 9fce2a2209 Remove obsolete ctors section
Remove prototype support for C++ constructors, since it is not well
designed. Device drivers (or other application code) that requires an
automatic initialization capability should use the device initialization
macros instead.

Note: Support for C++ constructors may be re-introduced at a later date.
However, a number of issues need to be settled, such as when the
constructors are invoked and what context they run in. (Running them
during nanokernel initialization, as was previously done, is probably
not the right approach.)

Change-Id: If6d27ac16b485cb39d5ec34084e9d0f1991074f4
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:43 -05:00
Andre Guedes 5b847c0aa2 x86: Fix IRQ_CONNECT_STATIC documentation
Since commit 3d7b21b69e the 'priority' parameter is used by the macro
IRQ_CONNECT_STATIC. This patch fixes the macro documentation which
says it is ignored.

Change-Id: I56eec49466a33441fa1822af78956ebb7f5c24ce
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-02-05 20:24:43 -05:00
Peter Mitsis 6338c4518c x86: Update NANO_ESF and NANO_ISF structures
As the system always operates in ring 0, neither the SS nor ESP registers
are pushed onto the stack when an exception or an interrupt occurs.
However, as the ESP field is still relevant to debugging fatal errors, a
place has been carved for it in the NANO_ESF.

Change-Id: Ibb2578c69fa6365fd6e9dbf7b51f461063dadc68
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:43 -05:00
Peter Mitsis e7018455d8 x86: Remove cr2 field from NANO_ESF structure
As page fault exceptions can not occur in the system as it is currently
designed, there is no need to track the CR2 register as part of the
exception stack frame.

Change-Id: I75d7a74c5d2c6efcc0e9141d2662861bc2052629
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:43 -05:00
Benjamin Walsh f9127ecf52 reboot: add support for galileo
Implementation of the sys_arch_reboot() call for galileo, using the
RST_CNT register (I/O port 0xcf9).

Change-Id: I00fbf4aaaf746f640674da6880e1d6c5aa230e06
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:43 -05:00
Benjamin Walsh 55afb68e83 x86: remove NANOKERNEL guard around nano_cpu_idle()
It can be used by some subsystems even in a microkernel.

Change-Id: I07241aab94ecf67c94dce2d05f2cd774b2a6b044
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:43 -05:00
Benjamin Walsh c12c234f38 linker scripts: add _image_text_start/end symbols
Change-Id: Ic6026337c668482f0226d040138fb798a10d4ecc
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:42 -05:00
Benjamin Walsh 09303f7f68 linker scripts: add symbols for ROM/RAM boundaries
These symbols have more meaningful names when trying to figure out where
the ROM/RAM starts/ends, rather than relying on e.g. __data_rom_start for
the end of the ROM (__data_rom_start is the beginning of the data in
ROM, thus is not part of the image).

Change-Id: I4aa0354ee414fd0d46d0f40952e091ba090e7bce
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:42 -05:00
Anas Nashif 6de1c20809 core: remove NO_ISRS feature
This option is not building and currently not supported, removing
it because there does not seem to be a use case for it.

Change-Id: Idb8ffedf83f43cffc68a01573c6f2d1a90fc40fb
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:42 -05:00
Andrew Boie b43758d22a x86: remove dynamically generated IRQ and exception code
We are interested in supporting some XIP x86 platforms which are
unable to fetch CPU instructions from system RAM. This requires
refactoring our dynamic IRQ/exc code which currently synthesizes
assembly language instructions to create IRQ stubs on-the-fly.

Instead, a new approach is taken. Given that the configuration at
build time specifies the number of required stubs, use this
to generate a build time a set of tiny stub functions which simply
push a 'stub id' and then call common dynamic interrupt code.
The handler function and handler argument is saved in a table keyed by
this stub id.

CONFIG_EOI_HANDLER_SUPPORTED removed, the code hasn't been conditionally
compiled for some time and in all cases we call _loapic_eoi() when
finished with an interrupt.

Some other out-of-date verbiage in comments related to supporting
non-APIC removed.

Previously, when dynamic exceptions were created a pointer would
be passed in by the caller reserving ram for the stub code. Since
this is no longer feasible, two new Kconfig options have been added.
CONFIG_NUM_DYNAMIC_EXC_STUBS and CONFIG_NUM_DYNAMIC_EXC_NO_ERR_STUBS
control how many stubs are created for exceptions that push
an error code, and no error code, respectively.

SW Interrupts are no longer triggered by "int <vector>" hard-coded
assembly instructions. Instead this is done by sending a self-directed
inter-processor interrupt from the LOAPIC, using a new API
loapic_int_vect_trigger(). In this way we get rid of dynamically
generated code in irq_test_common.h.

All interrupts call _loapic_eoi() when finished, since this is now
the right thing to do for all IRQs, including SW interrupts.

_irq_handler_set() for x86 no longer requires the old function pointer
to be supplied.

Change-Id: I78993d3d00dd153c9051c518b417cce8d3acee9e
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:41 -05:00
Juan Manuel Cruz 71c289dfbc asm: add asm inline for system set/clear/test bit
This commit adds asm implementation for the methods:
 sys_io_set_bit
 sys_io_clear_bit
 sys_io_test_bit
 sys_io_test_and_set_bit
 sys_io_test_and_clear_bit

Change-Id: I144568e113316fa43d943cdc5457cb17e66839c3
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:41 -05:00
Peter Mitsis 5ff5c62bdc arc: Add paddr_t/vaddr_t
ARC targets now have access to the address types 'paddr_t' and 'vaddr_t'.

Change-Id: I2cccddbdd76771529e4501aaee6cb2a2b640013e
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:41 -05:00
Benjamin Walsh 4690457b17 arm: Add paddr_t/vaddr_t
ARM targets now have access to the address types 'paddr_t' and 'vaddr_t'.

Change-Id: Ic7225647f3776d4afa853cf2c4a19699b656866a
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:41 -05:00
Benjamin Walsh b55e2fc50a x86: Add addr_types.h to arch.h
This makes the types 'paddr_t' and 'vaddr_t' available via nanokernel.h.

Change-Id: I75b81356566e2063979f2ec46f326d606638efa2
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:41 -05:00
Benjamin Walsh b7875a0bc8 x86: Rename PHYS_ADDR/VIRT_ADDR to paddr_t/vaddr_t
Change-Id: I8e037278f2f1d409360c52276cb4dae87b9ad440
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:41 -05:00
Dan Kalowsky bc11b84b61 checkpatch: warning - return_void
Change-Id: Ib32be6cf09b627d5ab25d1ff5642268bd63d5db8
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:36 -05:00
Dan Kalowsky 2a57d02400 checkpatch: warning - spacing
Change-Id: Ia63d6c9d8d3c1bd9c540a039263cb8507af82b1e
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:35 -05:00
Andrew Boie 090385b666 x86: remove boi handler support, eoi argument
This was only needed for the older 8259A style PICs which are no
longer supported.

Since we now just support APIC, we always just call loapic_eoi which
no longer requires an argument and informs the IOAPIC that the interrupt
is complete if necessary.

Change-Id: I15c9b7b4f03b872656220af32220b62e043bfa6b
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:35 -05:00
Anas Nashif eb3f9a411c doxygen: document missing IRQ_CONFIG parameter
Change-Id: I69de27e66e84065b2e447fe600fa25ab1c01fb97
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:35 -05:00
Anas Nashif b269a66e57 doxygen: use @a on parameters
Change-Id: I2ae106d24f17694e9b584a61a6996c6d4d8de059
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:35 -05:00
Daniel Leung 851c6f8f60 microkernel: introduce private event objects
This patch enables defining microkernel events within source code.
This is similar to other private kernel object patches.

The test has been modified a little bit due to the fact that
the event ID is now a memory address, instead of numeric ID.

Change-Id: Ie3c8d4f4e459d9c631e50bb242cf7a05ca8ea82c
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:35 -05:00
Peter Mitsis 47888a31db Update static IDT generation to use IRQ priority
Updates the 'gen_idt' tool to generate a mapping of IRQ numbers to
interrupt vector IDs, thereby allowing the IRQ priority to be utilized
when statically connecting an interrupt.

Change-Id: I2e54ceb65145682820dfbd8ca1ee6ec68d71ce1a
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:34 -05:00
Anas Nashif 657ea97fab doxygen: fixed parameter documentation
Change-Id: I43ebc8a6dc0cbcf253469ac8d06da9dca6b37ccc
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:34 -05:00
Dan Kalowsky d81d8bcbfa checkpatch: error - spacing
Change-Id: Ie051000e3d3f0f5bdc330d0265010c37acb873bd
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:33 -05:00
Dan Kalowsky e8563c2f97 checkpatch: error - trailing_whitespace
Change-Id: I819d13f0d7a23e3a61dcda6a3ced18810b192158
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:33 -05:00
Dan Kalowsky da67b29569 checkpatch: warning - block_comment_style
Change-Id: I6da43e41f9c6efee577b70513ec368ae3cce0144
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:33 -05:00
Allan Stephens eff3508f16 x86: Remove cosmetic traces of Diab toolchain
Updates several files to remove mention of Diab toolchain
support, which is no longer supported. These changes do not
affect system operation.

Change-Id: If9de85e595f6685295e565bc94ca17f51d87513f
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:24:32 -05:00
Dirk Brandewie 147d6585ae x86: arm: Modify IRQ_CONFIG macro to have same signature as ARC
In order to have drivers that are usable cross architecture the
signature for IRQ_CONFIG needs to be the same to avoid #ifdef hell in
the driver code based on architecture.

Update the macro and it usage for existing drivers

Change-Id: I22e142b21d4e984add231d1dbd97020e4823985f
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:31 -05:00
Dan Kalowsky e4bb957a00 checkpatch: error - pointer_location
Change-Id: I9ce224cb75ba21caecffd6747833257f748b5ecf
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:31 -05:00
Dan Kalowsky 39063598db checkpatch: error - spacing
Change-Id: Ie6e1c43581dd4b0734625b3a4e59a4ca79619e99
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:31 -05:00
Allan Stephens a860cb7bff init: Support fine-grained device initialization priorities
Introduces the SYS_DEFINE_DEVICE() macro, which supports 5 distinct
levels of device initialization and 100 priorities within each level.

Note: The existing init macros (e.g. nano_early_init()) have been
adapted to utilize the enhanced initialization model, but will
eventually be retired.

Change-Id: If677029d8b711a3fae9b2f32b5470cd97d19aeda
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:24:30 -05:00
Tomasz Bursztyka 86db1b37bd arc: IRQ_CONFIG should not enable the irq
Drivers do it by themselves, usually either in a dedicated irq
configuration function or direcly in their initialization routine.

Change-Id: Id1cca1a1e3e3f36264d99d1d2f2d651d84e0687e
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:29 -05:00
Tomasz Bursztyka 7193a3e007 sys_io: arc: Add sys_in*/sys_out* functions
This functions - reusing _arc_v2_aux_reg_* ones - will ease porting
drivers to ARC architecture hiding arch specific calls under generic
functions. On ARC, auxiliary registers is conceptually comparable to
x86 ports, thus the possibility to bring sys_in/sys_out to access those.

Change-Id: Ic5c0fc41f32ec4ad861dbb58cd8defaf4497bc03
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:29 -05:00
Javier B Perez Hernandez f7fffae8aa Change BSD-3 licenses to Apache 2
Change all the Intel and Wind River code license from BSD-3 to Apache 2.

Change-Id: Id8be2c1c161a06ea8a0b9f38e17660e11dbb384b
Signed-off-by: Javier B Perez Hernandez <javier.b.perez.hernandez@linux.intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:29 -05:00
Peter Mitsis 5705d06874 x86: Properly initialize _interrupt_vectors_allocated[] bitmap
Updates the 'gen_idt' tool to generate a bitmap of (statically) allocated
interrupt vectors that is linked into the final image in a manner similar to
the static IDT. The kernel then uses this bitmap when dynamically connecting
an interrupt vector, thereby preventing the dynamic irq connections
from clobbering the static irq connections.

Change-Id: I0a8f488408dad4912736865179f32f63ff1ca98f
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:28 -05:00
Peter Mitsis 56fa1a98d0 x86: Update generation of static IDT
Adds two new fields to the ISR_LIST structure (irq and priority) to allow
the decoupling of the vector ID and priority from the IRQ number at some
future time.

As a result of the addition of these two new fields, the gen_idt tool is
modified to both process these new fields as well as validate them.

Change-Id: I343dac68d99c78168a25b19784140f85d5db7578
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:28 -05:00
Peter Mitsis 25359412ba x86: Do not use IRQ priority for DPL
Fixes a bug in the x86 IRQ_CONNECT_STATIC() macro that resulted in setting
the DPL for the interrupt to the IRQ priority level.

Note 1: Using a proper value for the DPL (instead of the priority) prevents
the corruption of the other IDT fields.

Note 2: The priority of the IRQ is completely ignored.

Change-Id: Ic9f59bd91db4b356263f533cc26a0168b1d236e1
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:28 -05:00
Andrew Boie d82e9dd9e1 x86: HACK force alignment for _k_task_list section
We are seeing on some platforms that the VMA alignment
does not match the LMA alignment for this section, resulting
in problems when copying into RAM by __csSet(); any copied
sections afterwards end up misaligned in RAM.

While the true fix for this is under investigation, force
4-byte alignment for VMA and LMA.

Change-Id: I627d9e7a3446cbc09dc310a156d8b3268e61c91d
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:23 -05:00
Juan Manuel Cruz 69d1939037 arc: add IRQ configuration macro
Change-Id: Ib33142889afc9bef8600147b541770322f094611
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:24:23 -05:00
Anas Nashif 629e69b493 doxygen: fixed typos and parameter references
Change-Id: Ica65e2cd0e49c08b1b8b086614267caef632c891
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:23 -05:00
Anas Nashif 45644140b0 doxygen: Fixed formatting and parameter references
Also fixed a few typos

Change-Id: I777d582ac6f8b188d0734570a59888e166468837
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:23 -05:00
Anas Nashif 6661fbc407 doxygen: fixed typos and parameter references
Change-Id: I8ff21156959a8960f6cea9441f25f1d17df2aa4f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:23 -05:00
Anas Nashif 218e148ade trivial: fixed typo addressible -> addressable
Change-Id: I1fde074c3747862fd34319ad7ae0bb8a9a8bb7e5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:23 -05:00
Anas Nashif 46b11bebc0 doxygen: fixed typos and unsupported doxygen commands
Change-Id: I57711eb5711736362421597a42faf787dcc5e3f6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:23 -05:00
Anas Nashif f4c259e750 doxygen: fixed documenation build warning in x86/arch.h
- Wrong @param
- Unsupported xml/html
- misspellings

Change-Id: I223f644d4e32293b291d9cb196a8dd19b8827dbb
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:19 -05:00
Daniel Leung 8253b90cfc microkernel: add task pointer list
Due to similar padding issue as pipe, the list of task object
may not be used directly. As mentioned before, some compiler/linker
may pad the large struct. For example, compiling under gcc and
march=i686 pads the struct to 32-byte alignment (march=atom to
64-byte alignment). This causes issue with sizeof() and pointer
arithmetic because they have no idea about the padding.
When the stars align in a certain way, these task structs may be
corrupted. So add a task pointer list and use it for task
manipulation. The task list remains as it is beneficial to group
them together to take advantage of cache locality.

Change-Id: I0e86bfe05742040f4540d7854c1ac14e76162776
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:58 -05:00
Juan Manuel Cruz 6525b656cd arc registers: fixes the macros to read arc registers
This commit fixes small errors on the asm implementation of arc
register reading and the built-in functions call.

Change-Id: Iea2df715eaefb25095770971ac03d441311abf16
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:15:36 -05:00
Dirk Brandewie 0a7e4d1b9b Fix arc interrupt configuration
The _ARC_V2_IRQ_VECT_BASE register must be set to the vector table in
flash.

Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
Change-Id: Ied5451c98222f545cd669967023aef26c3d8e48e
2016-02-05 20:15:35 -05:00
Tomasz Bursztyka b4e795b78c arc: Fix the sys_io.h operations to work on both registers and addresses
- Finally switched from ldw/stw to ldh/sth, as Benjamin noticed in an
  earlier comment (I was using ARC ISA, and not ARC V2 ISA). So indeed
  ldw/stw are obsolete and equivalent to ldh/std.

- clear, set and test were not working in case of using a memory address
  which would not point to a register: bclr, bset and btst requires
  registers as operands, and cannot deal with pure memory address (i.e.
  something like [rx] is not valid), thus the requirement to load first
  the value pointed by the address into a register, operate on that
  register and storing the result of it into the pointed address.

Change-Id: Ib9c24c0a2c6d2b02e2d08d24f31cbc1981536a7d
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:15:35 -05:00
Anas Nashif 952cd52e16 doxygen: nanokernel doxygenation
Doxegenize and cleanup headers for nanokernel
 - fibers
 - context
 - timers
 - stacks

Also minor cleanup of x86/arch.h

Change-Id: Ib65568d4ec034b69e8a6214ba4b52a7f719300bb
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:15:34 -05:00
Tomasz Bursztyka 7ea05b4a09 sys_io: Implement the API for ARC architecture
sys_in/sys_out are not implemented as there is no "ports" in ARC.

Change-Id: Ie72d6274ae1a2b2ca22955a9764e281e7669b973
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:15:31 -05:00
Tomasz Bursztyka 507decb731 sys_io: Add memory bit manipulation functions
This will be helpful also in drivers mostly, where non-atomic bit
setting could be unnecessary.

Change-Id: I10c069387d1045f14337b3ac8acfc7b6c1f106c3
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:15:28 -05:00
Tomasz Bursztyka c6d0bea109 API: Add a generic API for port and mem mapped registers functions
sys_io.h header file declares the generic API for such operations. It
properly separates port and memory mapped registers, with declaring
respective types: io_port_t and mm_reg_t.

Memory mapped registers are the most common type of registers drivers
will play with. Thus providing generic sys_readX/sys_writeX functions in
sys_io.h. Those are defined as inline as they are really simple.

Ports are mostly (always?) found in x86 architecture.
Currently no ARM or ARC header file propose any implementation of
those. If really necessary (a cross-architecture driver using
sys_in/sys_out functions), those architecture will provide the proper
implementation or at least a macro gluing those towards
sys_read/sys_write.

Change-Id: If77590d4bcefcdfa6aa181a88ced342f8565d5b8
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:15:28 -05:00
Anas Nashif 2b8af552f2 remove duplicate 'inline' declaration specifier
Change-Id: Ib5bc7a402874e2ec215d4571e25e75e161453f05
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:15:28 -05:00
Benjamin Walsh 97f2622f55 arm: rename instances of CortexM
Directory names: CortexM -> cortex_m
Code comments: CortexM -> Cortex-M

Change-Id: If946ed25fac863e0be9dbb6f6c275199402b0b0a
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:15:27 -05:00
Benjamin Walsh 0dcad8331b clarify use of term 'context'
The term 'context' is vague and overloaded. Its usage for 'an execution
context' is now referred as such, in both comments and some APIs' names.
When the execution context can only be a fiber or a task (i.e. not an
ISR), it is referred to as a 'thread', again in comments and everywhere
in the code.

APIs that had their names changed:

  - nano_context_id_t is now nano_thread_id_t
  - context_self_get() is now sys_thread_self_get()
  - context_type_get() is now sys_execution_context_type_get()
  - context_custom_data_set/get() are now
    sys_thread_custom_data_set/get()

The 'context' prefix namespace does not have to be reserved by the
kernel anymore.

The Context Control Structure (CCS) data structure is now the Thread
Control Structure (TCS):

  - struct ccs is now struct tcs
  - tCCS is now tTCS

Change-Id: I7526a76c5b01e7c86333078e2d2e77c9feef5364
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:15:27 -05:00
Anas Nashif 4ca0b0b96b add missing includes from toolchain
Change-Id: Ic60955df6644d2a15897c6b6c082890b2ccd2371
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:15:26 -05:00
Anas Nashif b2f5c48755 remove shared/ and create files directly
The files idtEnt.h and segselect.h in shared are linked from
the source tree for no good reason adding and extra top level
directory that might be confusing.

The shared/ here means shared between host and target, this is
not longer necessary in our build system.

Change-Id: Id9665e10de7a1d290888d9069be3db9f4330d284
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:15:25 -05:00
Benjamin Walsh 7710d0e083 ffs: change find_[lsb|msb]_set parameter type to uint32_t
Highlight the fact that find_[lsb|msb]_set operate on a 32-bit word.

Change-Id: I24cee7709ea6497508dbc7f96a7b4d74fa4bc257
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:15:25 -05:00
Benjamin Walsh 1bab46dca1 ffs: rename find_[first|last]_set to find_[lsb|msb]_set
The new names reflect better what the functions do: they find the first
bit set starting from the least or most significant bit, i.e. they find
the least or most significant bit set, in a 32-bit word.

Change-Id: I6f0ee4b543f6f37c2f08f7067e14e039c92a6f6a
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:15:25 -05:00
Benjamin Walsh 910970ed0f ffs: remove non-inline find_[first|last]_set()
The inline versions are renamed to remove the _inline suffix, and the
non-inline versions are removed from the code base.

Change-Id: Iee2e6adcfb5da1fe0a978a05aa854e10ae82a8b8
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:15:25 -05:00
Peter Mitsis 92d1810def Fix typo: occured -> occurred
Change-Id: I40150719135108f18834a35db1c5be7ca4c5c9b2
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:15:21 -05:00
Benjamin Walsh 2c5086cc65 irq: remove non-inline irq_lock/unlock
The inline versions are renamed to remove the _inline suffix, and the
non-inline versions are removed from the code base.

Change-Id: I7314b96c42835f15df4c537ec11ab7961d4ee60f
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:15:21 -05:00
Benjamin Walsh c1f9fd888d irq: make utility functions private
irq_handler_set, irq_priority_set and irq_disconnect have been made
private by prepending an underscore to their names:

	irq_handler_set -> irq_handler_set
	irq_priority_set -> irq_priority_set
	irq_disconnect -> irq_disconnect

The prototypes have been removed from header files when possible, and
extern statements used in C code where they were called.

_irq_priority_set() for ARM is still in the header file because
IRQ_CONFIG() relies on it.

Change-Id: I2ad585f8156ff80250f6d9eeca4a249a4477fd9d
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:15:21 -05:00
Andrew Boie 91156d9c7a arc: standardize ffs function names to match other arches
Change-Id: I4f384960f4c6698ef98ecf3941c30f849832135e
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:15:20 -05:00
Daniel Leung 0abe07a0cd microkernel: introduce support for private memory maps
This enable defining memory maps in source code in addition to
defining in MDEF files. This introduces the macro
DEFINE_MEM_MAP(mem_map_name, ...). The memory maps created this
way are the same, in functionality, as those defined in MDEF
files. They can be manipulated by the standard microkernel
memory map APIs.

Define the memory map using:

  DEFINE_MEM_MAP(mem_map1, blocks, block_size);

and "mem_map1" can be used, for example:

  task_mem_map_alloc(mem_map1, ...);

or,

  task_mem_map_free(mem_map1, ...);

etc.

To use the memory map defined in another source file, simply add:

extern const kmemory_map_t mem_map1;

to the desired C or header file.

Change-Id: I9c551b90f9d0a95f961fd8ec1c5278c2ea44312d
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Daniel Leung 201aa8c708 microkernel: put memory map pointers into its own binary section
The _k_mem_map_list was a static array generated by sysgen,
where it containing all pre-defined memory maps from MDEF file.
To support private memory map objects (aka, defining them within
source files), the list has to accommodate memory maps that
are not only processed through sysgen, but also those defined
within source files.

This is done by creating a new section in binary, and all memory
map pointers go into this section. By doing this, the list
can still be manipulated as an array.

Change-Id: I1f3414b72f685fef4b99850749178661f14d9345
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Daniel Leung b5517ab61c microkernel: introduce support for private pipes
This enable defining pipes in source code in addition to
defining in MDEF files. This introduces the macro
DEFINE_PIPE(pipe_name, ...). The pipes created this
way are the same, in functionality, as those defined in MDEF
files. They can be manipulated by the standard microkernel
pipe APIs.

Define the pipe using:

  DEFINE_PIPE(pipe1, size);

and "pipe1" can be used, for example:

  task_pipe_put(pipe1, ...);

or,

  task_pipe_get(pipe1, ...);

etc.

To use the pipe defined in another source file, simply add:

extern const kpipe_t pipe1;

to the desired C or header file.

Change-Id: Iae8e04706359bc18aae51acc75df3e3d26388882
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Daniel Leung 815d64522f microkernel: put pipe pointer list into its own binary section
The _k_pipe_list was a static array generated by sysgen,
where it containing all pre-defined pipes from MDEF file.
To support private pipe objects (aka, defining pipes within
source files), the pipe list has to accommodate pipes that
are not only processed through sysgen, but also those defined
within source files.

This is done by creating a new section in binary, and all pipe
pointers go into this section. By doing this, the pipe list
can still be manipulated as an array. The reason behind
putting the pointers to pipe, instead of the pipe objects
themselves, is that some compiler/linker may pad the large pipe
struct. For example, compiling under gcc and march=i686 pads
the struct to 32-byte alignment (march=atom to 64-byte alignment).
This causes issue with sizeof() and pointer arithmetic because
they have no idea about the padding. So use pointers here to
prevent padding.

Change-Id: I6d3b75614c4d8760c037a5c26746410d4e4b17cb
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Daniel Leung 2bc5880d85 microkernel: introduce support for private tasks
This enable defining tasks in source code in addition to
defining in MDEF files. This introduces the macro
DEFINE_TASK(task_name). The tasks created this
way are the same, in functionality, as those defined in MDEF
files. They can be manipulated by the standard microkernel
task APIs.

Define the task using:

  DEFINE_TASK(task1, priority, entry_func, stack_size, groups);

and "task1" can be used, for example:

  task_start(task1);

or,

  task_abort(task1);

etc.

To use the task defined in another source file, simply add:

extern const ktask_t task1;

to the desired C or header file.

Change-Id: Ib2f3572950ca74b359b7fde1ccd6cfd04783eefb
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Daniel Leung 75e5427e15 microkernel: put _k_task_list into its own binary section
The _k_task_list was a static array generated by sysgen,
where it containing all pre-defined tasks from MDEF file.
To support private task objects (aka, defining tasks within
source files), the task list has to accommodate tasks that
are not only processed through sysgen, but also those defined
within source files.

This is done by creating a new section in binary, and all task
objects go into this section. By doing this, the task list
can still be manipulated as an array, which is required for
task group operation.

Change-Id: I799d6967567079498bc414e0cb809e8af856b53e
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Dmitriy Korovkin 4e3bce5e96 Add page-aligned padding to initlevel section for Galileo test load
Galileo testing uses Linux kexec() feature to load Zephyr OS.
kexec() requires all program headers page size aligned.
Add page size padding to initlevel section in order to make
BSS page aligned.

Change-Id: I7c0e309be70aef45b347b16c6d5c01bdf5659351
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:14:43 -05:00
Peter Mitsis 7cbad4e7dd Remove references to BSP from include/ directory
Removes references to obsolete BSP terminology.  Where appropriate, replaces it
with platform terminology.

Change-Id: If38c859338c7cf0de58430336e1046b28f9e9944
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:43 -05:00
Peter Mitsis 89e922243b arm: Use new SRAM and flash Kconfig options
The configuration of SRAM and flash options are no longer hardcoded in the
platform's linker script file, but are instead defined in the platform
configuration file.

Change-Id: I557a8228080d607f6add5f86b9b2509ed3fd31ce
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:42 -05:00
Anas Nashif 274cc72aee replace negative CMOV_UNSUPPORTED with CMOV
Change-Id: Id2aba9402495d99176eb499b1c74f86349e1164b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:41 -05:00
Anas Nashif 629dfc26c9 doxygen: Cleanup arch.h comments
Change-Id: I0c5743ab2db3cb1bc584ced4fa9d91c84da971b8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:38 -05:00
Peter Mitsis a7644b86a5 Rename CONFIG_BSP_xxx to CONFIG_PLATFORM_xxx
Updates Kconfig option names as part of transforming BSPs to platforms.

Change-Id: If397bcac8b058e5700e82c3cabbfe64588316d1d
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:37 -05:00
Anas Nashif f367f071b6 doxygen: add @brief and capitalize
Remove function name from comment and add @brief instead.
Also capitilize first letter.

Change-Id: Ib708b49bf02e5bc89b0066637a55874e659637e0
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:33 -05:00
Anas Nashif 1362e3c162 doxygen: RETURNS: -> @return
Previous comment style used RETRURNS:, use @return to comply
with javadoc style.

Change-Id: Ib1dffd92da1d97d60063ec5309b08049828f6661
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:32 -05:00
Anas Nashif ea0d0b220c doxygen: change comment style to match javadoc
The change replaces multiple asterisks to ** at
the beginning of comments and adds a space before
the asterisks at the beginning of lines.

Change-Id: I7656bde3bf4d9a31e38941e43b580520432dabc1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:32 -05:00
Oleg Zhurakivskyy 4d251f456b Add .debug_macro for DWARF4
Change-Id: I06a3f192b146fa015f933449cbe421fef8428e5f
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2016-02-05 20:14:27 -05:00
Anas Nashif ac47c45ca0 Rename Zephyr OS into Zephyr Kernel
We are a kernel, not an OS.

Change-Id: Ib987e3e511e1bdbed6293ab5e15e598bff00b09b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:26 -05:00
Dmitriy Korovkin 660878e4e2 irq_connect for x86 uses static stub array
In order to provide the same irq_connect() on all platforms
on x86, irq_connect() now uses a static array of interrupt
stubs. Device driver does not need to provide interrupt stub
to irq_connect() function.

Add NUM_DYNAMIC_STUBS configuration parameter, the number
of interrupt stubs used for dynamic interrupt registration.

Modify tests for unified interrupt register API

Tests that deal with interrupts are modified to work
with the new interrupt registration API.

Add CONFIG_NUM_DYNAMIC_STUBS option to dynamic interrupt projects

Projects that use dynamic interrupt handler registration on x86
have to include CONFIG_NUM_DYNAMIC_STUBS parameter in the
configuration.

Change-Id: Ic90c726485521a57cf695fd3edc8cac85d0b827d
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:14:25 -05:00
Dmitriy Korovkin f661feee55 IRQ_CONNECT_STATIC implementation for ARM platform
IRQ_CONNECT_STATIC() macro provides static interrupt registration.
It creates an entry for _sw_isr_table, table of interrupt handlers.

IRQ_CONFIG() macro provides interrupt controller configuration.
On ARM platform it configures the priority of each interrupt.

_sw_isr_table is implemented the way that each of it's elements
is located in individual section. Sections are marked a "linkonce",
thus when a device driver declares an interrupt handler, it overwrites
the default _sw_isr_table entry.

Change-Id: I182bf7158dd67f45b597783dca038a4f78166a03
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:14:25 -05:00
Dmitriy Korovkin 6dd108a263 IRQ_CONNECT_STATIC implementation for x86 platform
In order to simplify x86 interrupt stub creation, each interrupt
controller implements an interrupt stub definition macro.

Add IRQ_CONNECT_STATIC() for static interrupt registration, and
construct the interrupt stubs name from device and interrupt
handler names.

Add IRQ_CONFIG() macro for the interrupt controller configuration.
On x86 platform it programs APIC to associate an IRQ number with
the interupt vector.

Add HPET_TIMER0_INT_PRI parameter to Quark platform header to
make it build correctly.

Change-Id: I24ad25e1aa807ffa63733a27ad882877fcad72af
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:14:25 -05:00
Peter Mitsis 192a316ef4 Remove references to Cortex-M0
The Cortex-M0 processor is not supported.

Change-Id: I3ada6615a8b41eb318f80edb13947f70459c761b
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:25 -05:00
Peter Mitsis 25fd37d9d5 Rename option CPU_CORTEXM to CPU_CORTEX_M
Makes name more consistent with other CPU_CORTEX_M* options.

Change-Id: I65968cb300207ba0de6231d9a67f2720be77b6ba
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:25 -05:00
Peter Mitsis 9bf659afa5 Introduce CPU_CORTEX_M3_M4 option
CPU_CORTEX_M3_M4 replaces CPU_CORTEXM3 as the umbrella option for Cortex M3/M4
processors.

NOTE: Selecting CPU_CORTEXM4 still currently forces the selection of
CPU_CORTEXM3.  Breaking that forced select will be done in a later commit.

Change-Id: I0f36b3a2adc5c6c66db4e9b6353b921199544deb
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:25 -05:00
Benjamin Walsh 3284865323 arm: fix __assert.h inclusion in asm files
The #include <__assert.h> in nvic.h must be guarded by __ASMLANGUAGE
since nvic.h is usable by asm code, and __assert.h is C-only.

Change-Id: I16d72e4579705dbd0bfb55a787525c5938fd1f22
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:14:21 -05:00
Juan Manuel Cruz 308f1586d6 Kbuild: Assembly code extension.
This commit set back .S as the assembly code extension for Kbuild.

Change-Id: Ib0119876bd0bed6617bbfbad2ca6a44e172ab042
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:14:20 -05:00
Anas Nashif 54ac4484d7 Rename VXMICRO_ARCH and VXMICRO
Change-Id: I6f3858de98333ec466aa876c5f2887faa8e276e2
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:16 -05:00
Anas Nashif f2520f87a2 Rename VXMICRO_ARCH_arc -> CONFIG_ARC
Change-Id: I4aca181523f50f43ee01e1be0c20a9ad844ef618
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:16 -05:00
Anas Nashif 274622ea69 Rename VXMICRO_ARCH_arm -> CONFIG_ARM
Change-Id: I32b2e39781825504e7936b3df0c864988650c35c
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:16 -05:00
Anas Nashif 191fc279ce Rename VXMICRO_ARCH_x86 -> CONFIG_X86_32
Change-Id: Ie1bcfebce1db838ea994cb3626396ea032225830
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:16 -05:00
Allan Stephens 5189844df5 Eliminate VxMicro branding in kernel code
Eliminates references to the obsolete OS name. In most cases the
name is simply removed, as it isn't necessary.

Change-Id: I32f9e7390e436aec008a9454b72657e129d65152
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:15 -05:00
Allan Stephens d0ed154421 Eliminate nanokernel's private.h file
This file doesn't belong in the architecture-specific portion of
the tree, and its contents don't warrant their own file, so the
content is moved to the main nanokernel public API include file.

Change-Id: I0455fc9eb4f5ca31a8e6b487f56b09d0562fdb77
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:15 -05:00
Allan Stephens bff7fc17fe Begin consolidation of arch-independent private nanokernel APIs
Introduces nano_internal.h, which will declare all architecture-
independent non-public nanokernel APIs. This file is automatically
incorporated by the various architecture-specific include files
for non-public nanokernel APIs, and will not normally be included
directly by any other files.

Change-Id: I9f3de812a5747cc720fa0ff739007315e8d07dd9
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:15 -05:00
Allan Stephens 24dd3044ca Relocate declarations for public nanokernel object types
These declarations are now co-located with the declarations
for the routines that utilize them.

Change-Id: I70940923d9e424345aeac60cb5ddd7f7a2a54734
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:15 -05:00
Allan Stephens 53165a631b Eliminate architecture-specific init.h files
These files now have no useful content.

Change-Id: If5d2df361eb8769ca38c4ae63f68a5681b3ad85b
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:15 -05:00
Allan Stephens 0c3fd0afc2 Relocate declarations of _nano_fiber_swap()
These now appear in the files which declare other non-public
nanokernel APIs.

Change-Id: Iea01d6de44851a08b308004b2c3104c08b020970
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:15 -05:00
Allan Stephens f547a5b7b8 Eliminate cputype.h and its arch-specific derivatives
Since cputype.h no longer has any meaningful content it can be
eliminated, along with the arch-specific files it incorporated.
(This means that the arch-specific nanokernel public APIs are
now referenced only via cpu.h and its derivatives.)

Change-Id: I7f35b6c3c6c092d61c372ff85d73e49414474938
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:15 -05:00
Allan Stephens 03a2abe737 Relocate macros for supporting non-byte addressible architectures
Moves these macros to the main public API include file for each
supported architecture, since the <arch>type.h include file is
to be eliminated.

Change-Id: Ia87b9c0bed1501bcce7f363bd4155f7ef642376a
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:14 -05:00
Allan Stephens d6db256249 Add missing #includes required to reference non-kernel APIs
Several files were not explicitly including APIs that they reference,
which could eventually lead to trouble.

Change-Id: Ib33cadfa658280df3fcb4c670463d41b63097b31
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:14 -05:00
Dirk Brandewie c9ac95a43a device: Add device model infrastructure
Add infrastructure support having multiple instances of a driver
configured into the system each with its own compile time
configuration information.

Change-Id: I1e447af18311139b43f74fe0439483ccd132b63f
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:14:14 -05:00
Peter Mitsis ad74658009 Add __stack tag for aligning task/fiber stacks
The "__stack" tag is to be used to align an array (to STACK_ALIGN) for stack
use by either a fiber or task.

Change-Id: I5828f3ee1b09b0b5ba894ea30689d179de347494
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:13 -05:00
Peter Mitsis db8a41c90d Replace use of __attribute__((packed)) with __packed
The __attribute__ keyword is toolchain specific.

Change-Id: Ia3c0ff54d778785679c864704f8db6a3ba898948
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:13 -05:00
Peter Mitsis ad39ee1c96 Replace __attribute__((aligned(x))) with __aligned(x)
The __attribute__ keyword is toolchain specific.

Change-Id: I2183d154ccdb9b5bed3bc245cc37cbf4c5cc62cc
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:13 -05:00
Peter Mitsis 19a0ee4d24 Rename missed instances of nanoFiberStart()
Completes the renaming of nanoFiberStart() -> fiber_fiber_start().

There is little value in listing the callers of _NewContext() in its function
header.  Not only was the (deleted) list both incomplete and wrong, keeping
it around and properly updated requires error prone maintenance.

Change-Id: Ic45f51b285c027a2e8be331c0d28c16bdc97647d
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:13 -05:00
Peter Mitsis f8619b4181 Refactor _Cget() to invoke _NanoFatalErrorHandler()
It is a fatal error if the microkernel is configured with either too few
command packets or too few timer packets.

NOTE: During this refactoring of _Cget(), not only is it renamed to
_nano_fiber_lifo_get_panic(), but it is moved into "nano_lifo.c".

Change-Id: I1d866cda1b444da04877f7eda03762b6e83c9a6f
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:13 -05:00
Peter Mitsis 7d2fc8ec22 Add _NANO_ERR_ALLOCATION_FAIL fatal error code
This reason code will be used indicate that the kernel failed to allocate a
critical resource (such as a command packet or a timer packet).

Change-Id: I6d4c3d96fc70b2b8cab4027b1b8e4febf4d6c474
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:13 -05:00
Allan Stephens d1ebe66b84 Eliminate definition of tick event for ARC
Since ARC does not support the microkernel, there is no need to
define any microkernel event symbols for it. (And TICK_EVENT is
an architecture-independent concept anyway ...)

Change-Id: I918a55743f8685ef23b9bb5a8afc67b905ab9766
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:13 -05:00
Allan Stephens 2f3a261431 Eliminate definition of debugging agent event
This symbol is no longer referenced.

Change-Id: Ic24d7b77f2034cac885e24a0f06373da4f169ff5
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:13 -05:00
Allan Stephens d216a00adc Clean up private APIs that mark context as (non)essential
1) Renames APIs to align them with conventions used by other
   general-context nanokernel APIs.

2) Relocates implementation of these APIs to the architecture-
   independent portion of the nanokernel.

Change-Id: I1aa60029aaa96697cd8fcb594bbae23ba6656661
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:13 -05:00
Allan Stephens 3c0b6f0379 Eliminate definitions of k_memset() and k_memcpy()
These APIs are no longer referenced anywhere.

Change-Id: I56e3410b9fb6bc4eb72bc9299b33f75227916434
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:12 -05:00
Allan Stephens 63720a9af3 Eliminate secure string error handling
This is not required since the secure string library routines
have been removed.

Change-Id: I284a21e4167d9bb6f78354d809c563a4c52f619c
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:12 -05:00
Dan Kalowsky c02dd34277 Renaming include/nanokernel to include/arch
Renaming the directory include/nanokernel to be include/arch, which
better reflects the real nature of the directory and the contents
inside.

Change-Id: I2bc33ebc6715e2f0403227a558279fdf52398ade
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:14:12 -05:00