Commit graph

19237 commits

Author SHA1 Message Date
Mazen NEIFER
4bff13e20a Xtensa port: Fixed Xtensa timer in case of tickles idle.
This driver was written for v1.5 before the introduction of the function
_sys_clock_final_tick_announce. At that time _sys_idle_elapsed_ticks was reset
to 0 automatically. Now that it is reset by the new function, the driver needed
to be fixed.

Change-Id: I039b4dbacb691aaf992b37e44404abd19a54a833
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 11:39:02 -08:00
Mazen NEIFER
ff0828faf3 Xtensa port: Fixed compilation errors caused by last rebase on master.
Change-Id: If2896bcce26652ded2059a11620370e34f98d1e4
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 11:39:02 -08:00
Mazen NEIFER
74ff1092d4 Xtensa port: Prevent preemption of locked threads.
When an IRQ is serviced, the ISR dispatcher will check for any new thread in
the ready queue and switch to it. However, if the current thread is marked as
non preemptable due to _kernel.current->base.preempt > _NON_PREEMPT_THRESHOLD
then we should not switch to another one.

Change-Id: Icdc08105cc6433da479bb95265710462a0f37c0b
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 11:39:02 -08:00
Andrew Boie
53f66d0bf7 xtensa: remove nonexistent offset
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 11:39:02 -08:00
Andrew Boie
de099439b1 xtensa: fix build warning if no coprocessors present
Change-Id: Ib754795eff073500a38e4b383268b4f90c1763a7
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 11:39:02 -08:00
Mazen NEIFER
0cfeb626c0 Xtensa port: Fixed scheduling bug caused to missing Endianess related macros.
XCC does neither define __BYTE_ORDER__ nor __ORDER_LITTLE/BIG_ENDIAN__ macros.
This resulted in field preempt of thread.base not correctly built from other
union fields prio and sched_locked, which caused wrong scheduling.

Change-Id: I8566ef4a5cf555906c012c4adc488f9afb26c053
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 11:39:02 -08:00
Mazen NEIFER
3b95e3d729 Xtensa port: Added support for sample_controller core and set is as default.
This core is not depreciated and compilationfor it is even faster than D_233L.

Change-Id: I6b8149ca9e879770c3ed0973ffb9304e2e3c8d8d
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 11:39:02 -08:00
Andrew Boie
9249f876a9 xtensa: cleanup fatal error handling
1) Fatal errors now all go through _SysFatalErrorHandler. When the
simulator is used, only the death of 'essential' threads will result
in the simulator exiting; some test cases that test exceptions may
actually expect a thread to terminate abnormally.

2) The human readability of the exception errors is improved.

Change-Id: I77f57ea0eae15b0c55237681b959cd21e3fe8c1c
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 11:39:02 -08:00
Andrew Boie
ceebd823e7 legacy: work around XCC issue in MDEF threads
The XCC compiler freaks out if a section name passed via
__attribute__((section)) has parenthesis in it. This happens in the
case of _MDEF_THREAD_DEFINE.

It turns out the whole mechanism of placing kernel objects in completely
unique sections is totally unnecessary. This patch is a workaround until
we can clean this up.

Change-Id: I12c88a1b8f5b27bec27d608614356c1b479c0a8c
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 11:39:02 -08:00
Andrew Boie
dec83a7ac2 xcc: add ccache support
This toolchain Makefile defines CC/CXX directly so we need to add
a USE_CCACHE case here.

Change-Id: Iee8dc6ab030db8dc45b16e21c5b17864e51341b4
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 11:39:02 -08:00
Mazen NEIFER
44a98fb5fd Xtensa port: Fixed defintion of MAX_HEAP_SIZE, thus, compilation of new_lib.
Xtensa linker script defines _heap_sentry which helps computing the heap size.

Change-Id: Ic35db3c98aaaebe575370fb5479de1a58e6e441e
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 11:39:02 -08:00
Andrew Boie
a95d524328 xt-run: don't leave dead emulator processes lying around
A ctrl-c in the script wouldn't terminate the child process.
Only do the pid trick if we're communicating with sanitycheck over
pipes.

Change-Id: I79da7362958b5fac00defd74d4b709076085575b
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 11:39:02 -08:00
Andrew Boie
eb50958266 xt-sim: add support for 'make debug'
Change-Id: I60b64c6b8c83e1e1c49d8cb2c5f857faee88a7a0
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 11:39:01 -08:00
Mazen NEIFER
b06115aa7c Xtensa port: Fixed memory corruption in interrupt handler exit function.
The a3 register was supposed to hold the _thread pointer but it seems that it
does not in all cases. Safe to restore it from _kernel structure.

Change-Id: Ie2ff6c3faf0fe70de4c5877ab59433d0c165145b
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 11:39:01 -08:00
Andrew Boie
46c7275831 REVERTME: disable xip test on xtensa
https://jira.zephyrproject.org/browse/ZEP-1676

Change-Id: I5570031479de5b1d1859876c9155bd1fd70664a1
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 11:39:01 -08:00
Mazen NEIFER
8e3b86fe0a Xtensa port: Connect Xtensa timer to tick IRQ in legacy test_context.
The test will also need to increase the stack to run correctly for Xtensa cores.

Change-Id: If94f12a941dc8eccf879558bdebdc7ccb2d047f1
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER
a6746c83ba Xtensa port: Removed unsupported c++ flags cuasing xt-c++ to throw an error.
Manu command lin eoption are not supported by xt-c++. There are filtered out
when calling Makefile.toolchain.xcc.

Change-Id: I1e60843d2b23f90250fbb493487c6fc838b7485a
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER
884005673c Xtensa port: Set Swap function result to -EAGAIN.
Change-Id: I70a651012d5da873c98f6b13ada5e80e67e18e0c
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER
0cbf12489e Xtensa port: xt*-run requires options to be passed before file to be ran.
If passed after the file they are just ignored silently!

Change-Id: Ic9b04c3023e4d312382850fa5e1b5ae4ef555856
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER
51efd6d4dc Xtensa port: Moved coprocessor stack area on bottom of stack, just after TCS.
This change should allow threads that do not access coprocessor to safely
overflow on the coprocessor save area without any issue.

Change-Id: Ic2acd20b60b6bef0b7feeb8cfb54d548eba892f0
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER
ef098bf410 Xtensa port: Restore interrupted context the same way as premption resume.
This was a kind of optimization that save few cycles in the cost of code
duplication. However the path where we resume from interrupt withouch changing
the running thread is buggy and leads to many tests to fail. For now I'd prefer
to remove this optimization and have a working port. Later, once everything is
OK, I'll have time to optimize things.

Change-Id: I7af58f383848d157b9f3b3fbeceede3e83f9ce61
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER
b978c70338 Xtensa port: Removed duplicate code and fixed update of current thread pointer.
Having duplicate code leads always to this kind of situation where a bug is
fixed in one place and not in the other. This bug of updating current thread
pointer was already fixed before in the Swap function, but not in the interrupt
handler.

Change-Id: I466aea2d35382446c5c82fe775ada31f0bd19492
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER
8f1dd3a6e5 sanitycheck: Fixed displayed log when current directory is a symbolic link.
When current directory is a symbolic link or in a symbolic link then os.getcwd
return the real path leading to os.path.relpath returning not so nice relative
path.

Change-Id: I3e24d3e6f1fe7185992f64803d3728e9588d67e1
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Andrew Boie
495d922406 xt-run: fix sanitycheck communication
Sanitycheck actually creates the pipes, using a naming convention imposed
by QEMU. We also need to leave a PID file.
'xt-run' Make target removed, we don't need it.

Change-Id: Ie9fd9dbb1327eb4b10424e7ee5d2f4dc09b121a4
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER
b012aa1901 Xtensa port: Use directly assmebler and linker instead of via the compiler.
This allows handling options like --fatal-warnings that are passed by
sanitycheck.

Change-Id: Ia78dcef480d9d81cab6051453204c05d52917af2
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER
6af2778136 Xtensa port: Fixed linker script for hifi_mini core.
Change-Id: I21f4ff0c136c1e72e6d36d179898bbde1b08b71f
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Andrew Boie
e536b270f0 sanitycheck: don't disable tryrun
This completely breaks all the cc-option checks. It's not clear
why this was done for everyone running sanitycheck.

Change-Id: I3f944423869ccb15fab29c28130820a93cd94917
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 08:04:27 -08:00
Andrew Boie
55acd15cc8 xt-sim: enable use of xtensa simulator with 'make run'
Change-Id: I450f24de73dc710ab3875b010ecf48e44370cfc0
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 08:04:27 -08:00
Andrew Boie
9d8d026294 xt-run: delete any stale fifos to avoid mkfifo error
Change-Id: I53d56587a0b90da273e118bd5b9e051aa2451d8f
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 08:04:27 -08:00
Andrew Boie
eab8a9f9ca xtensa_sim_console: remove deprecation warning
Change-Id: I10181f6c4d90e38927c1831c93fc459d33de6fd1
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 08:04:27 -08:00
Andrew Boie
f11910a7fb xtensa: Makefile: cleanup
Some options which are already defined by the build system
for the C compiler or assembler have been removed: -c,
-xassembler-with-cpp, -nostdinc.
References to deleted variable flagALongCall and flagLongCall
removed.
Formatting for 80 columns, there is now one flag per line.

Change-Id: Ieecdb75e26f64c6f58dec3cc636552e7b31a678d
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 08:04:27 -08:00
Andrew Boie
19dc4c67cc Makefile: test for -fno-asynchronous-unwind-tables
Some GCC variants don't support this. Moved later in the Makefile
after the toolchain Makefile has been included so the test works
properly.

Change-Id: Ia9ec2582c486197ea3df3d878173643c14786408
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 08:04:27 -08:00
Andrew Boie
2b2763aa95 xcc: add location of C++ compiler
Change-Id: I5b6ee6e9d424f401cca0e9d360555ff6cf94f504
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER
aacfd63331 Xtensa port: Removed duplicate file and renamed to sys_io.h as other platforms.
Change-Id: I293bfa9ff8c5e641c727612c56968cec901dbfec
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER
5718676aad Xtensa port: Increased idle thread stack size to avoid stack overflow.
Xtensa port uses more stack than others. This was discussed with the team and
we agreed that this can be accepted for the first beta.
We will investigate this later to see how to avoid allocating coproc registers
for the system threads in order to reduce the stack overhead. However this
will not be before the port is considered stable.

Change-Id: Icd5b2b0ab68d0906b5408f35f081b100acabc010
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER
967cb2ef8a Fixed compilation error caused by bad initialization of unamed union field.
The old syntax is not accepted by some compilers including XCC.

Change-Id: Id90849a2159652ec225dd2c50d2dc2ddc22a3e08
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER
03857ccb23 Xtensa port: Enable console when building for Xtensa simulator as board.
Change-Id: I48f25b7c7bb36bd7248e7d9e6718bf365eac56d9
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER
bb038cc1be Xtensa port: Fixed function setting Sawp return value.
The retval field shall hold the return value itself not a pointer on its
location.

Change-Id: I3f9e225f2bdd501f88441946b5187ebbd17a71e3
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER
95428c75e9 gitignore: Ignore Eclipse (Xtensa Xplorer) project files.
When debugging Xtensa port, on needs for sure to create an Xtensa Xplorer
project in order to be able to debug his project. These files will appear
in the git repository as non versioned files. It is safe to ignore them as
we won't anybody commit these files (user specific).

Change-Id: I156ec5c7393f1db98286da0b841a4e8496a9ff89
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER
7f046378eb sanitycheck: support other simulators (xt-run and/or xtsc) than QEMU.
In scripts/Makefile.qemu, the target qemu is already an alias for taget run.
In scripts/Makefile.xt{,sc}-run there is no target qemu but a target run.

Change-Id: Ib9dce3561ef9367b17d30070354e709df4d7e528
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER
cb745e6047 Xtensa port: Fixed RAMABLE_REGION in linker scripts.
This was introduced during a copy/paste when updating patch
https://gerrit.zephyrproject.org/r/#/c/10323/6..7

Change-Id: Id6857dd28a16974361932285b44559f702c4d910
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER
b72936f305 Xtensa port: Fixed Swap function not updating _kernel.current.
Change-Id: I561967404751436717950e28a776317aea5e05c3
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER
93e53da56a Xtensa port: Removed warnings related to function _NanoFatalErrorHandler.
This function needs to be decalred in a file included by _thread_entry.
It also needs to have exit function declared as not returning.

Change-Id: I2a01e7408cf70266351ae5089f45b5d9d009fabe
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER
7c75da1e1a Xtensa port: Added missing initalization of thread base sturct in _new_thread.
Change-Id: Icf9e1e6d5f831c2cf6e1262c6f8e1a46356edfe7
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER
2f4bec77d3 Xtensa port: Removed compiler warnings about printf formats/arguments mismatch.
Change-Id: Ie430072243911dc74263dbd7afe8703d0b3c4731
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER
0efb2313ca Xtensa port: Let xcc specific make file override unsupported -Og with -O0.
Change-Id: If1a1833b5ce09c7112245b8b73c0ccd28be66c88
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER
fddb1aa016 Xtensa port: _thread_entry shall use call4 to start the thread.
The function _new_thread sets the CALLINC for _thread_entry when calling the
new thread entry point. This should be CALLINC(1) (call4) instead of previous
one CALLINC(2) (call8).

This change allows resolving a crash when starting the first thread.

Change-Id: Ie97c95c87d1219342fed09f670fcae8a6230cefe
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER
6fb67ed1ac Xtensa port: Replaced call to legacy sys_thread_self_get by one to k_current_get
Change-Id: I341f6bde6f6956c9ce521c4346894ee893b8e9ae
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER
8f92bc255c Xtensa port: Added support for Xtensa internal timer as system timer.
Change-Id: I1a0be1a377999f18ae47687edf4fc4950dcc5ba5
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER
4a51dbe934 Changed Kbuild to pass also KBUILD_CPPFLAGS to CC on addition to KBUILD_CFLAGS.
Generally CPPFLAGS are applicable to all tools that use the C preprocessor.

Change-Id: I6dea9e39a20896550241f158190e03f7baadf471
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00