Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ option(CMRX_INTEGRATION_TESTS "Enable build of integration tests. Implies CMRX_H
option(CMRX_HIL_TESTING_SKIP_OPENOCD "Skip OpenOCD initialization during integration tests." OFF)
option(CMRX_USE_FAST_HASH "Use fast hashing function at expense of hash quality" OFF)
option(CMRX_VERBOSE_API_NAMES "Prefix all CMRX standard library function names with `cmrx_` to avoid conflicts" OFF)
option(CMRX_ARCH_ARMV8M_SECURE_MODE "Run in secure mode on ARMv8M CPUs" OFF)
set(OS_STACK_SIZE 1024 CACHE STRING "Stack allocated per thread in bytes")
set(OS_THREADS 8 CACHE STRING "Amount of entries in the thread table")
set(OS_PROCESSES 8 CACHE STRING "Amount of entries in the process table")
Expand Down
8 changes: 8 additions & 0 deletions conf/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,12 @@
* There is no functional change.
*/
#cmakedefine CMRX_VERBOSE_API_NAMES

/** Select secure/non-secure execution mode on ARMv8M.
* If enabled, CMRX will execute in secure mode both CMRX kernel and all threads.
* As of now, CMRX can't mix secure + non-secure execution and user has to select
* mode depending on presence / absence of secure firmware that switches CPU into
* non-secure mode.
*/
#cmakedefine CMRX_ARCH_ARMV8M_SECURE_MODE
/** @} */
6 changes: 5 additions & 1 deletion src/os/arch/arm/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ void os_thread_initialize_arch(struct OS_thread_t * thread, unsigned stack_size,
// without FPU
# if defined(__ARM_ARCH_8M_BASE__) || defined(__ARM_ARCH_8M_MAIN__)
# define EXC_RETURN_RES1 0xFFFF80UL
# if defined(CMRX_ARCH_ARMV8M_SECURE_MODE)
thread->arch.exc_return = EXC_RETURN_PREFIX | EXC_RETURN_RES1 | EXC_RETURN_S | EXC_RETURN_DCRS | EXC_RETURN_FTYPE | EXC_RETURN_MODE | EXC_RETURN_SPSEL | EXC_RETURN_ES;
# else
thread->arch.exc_return = EXC_RETURN_PREFIX | EXC_RETURN_RES1 | EXC_RETURN_DCRS | EXC_RETURN_FTYPE | EXC_RETURN_MODE | EXC_RETURN_SPSEL;
# else
# endif
# else
thread->arch.exc_return = EXC_RETURN_THREAD_PSP;
# endif
#endif
Expand Down
Loading