diff --git a/os/common/ports/ARMCMx/compilers/GCC/chcoreasm_v6m.s b/os/common/ports/ARMCMx/compilers/GCC/chcoreasm_v6m.s index 935c7630f..e5fe3aa0f 100644 --- a/os/common/ports/ARMCMx/compilers/GCC/chcoreasm_v6m.s +++ b/os/common/ports/ARMCMx/compilers/GCC/chcoreasm_v6m.s @@ -105,8 +105,14 @@ _port_thread_start: cpsie i mov r0, r5 blx r4 +#if defined(_CHIBIOS_RT_CONF_) movs r0, #0 /* MSG_OK */ bl chThdExit +#endif +#if defined(_CHIBIOS_NIL_CONF_) + mov r3, #0 + bl chSysHalt +#endif /*--------------------------------------------------------------------------* * Post-IRQ switch code. diff --git a/os/common/ports/ARMCMx/compilers/IAR/chcoreasm_v6m.s b/os/common/ports/ARMCMx/compilers/IAR/chcoreasm_v6m.s index ad2820dfa..4726eee74 100644 --- a/os/common/ports/ARMCMx/compilers/IAR/chcoreasm_v6m.s +++ b/os/common/ports/ARMCMx/compilers/IAR/chcoreasm_v6m.s @@ -39,12 +39,22 @@ #if !defined(__DOXYGEN__) +/* + * RTOS-specific context offset. + */ +#if defined(_CHIBIOS_RT_CONF_) +#define CONTEXT_OFFSET 12 +#elif defined(_CHIBIOS_NIL_CONF_) +#define CONTEXT_OFFSET 0 +#else +#error "invalid chconf.h" +#endif + MODULE ?chcoreasm_v6m AAPCS INTERWORK, VFP_COMPATIBLE PRESERVE8 -CONTEXT_OFFSET SET 12 SCB_ICSR SET 0xE000ED04 SECTION .text:CODE:NOROOT(2) @@ -99,7 +109,14 @@ _port_thread_start: cpsie i mov r0, r5 blx r4 +#if defined(_CHIBIOS_RT_CONF_) + movs r0, #0 /* MSG_OK */ bl chThdExit +#endif +#if defined(_CHIBIOS_NIL_CONF_) + mov r3, #0 + bl chSysHalt +#endif /* * Post-IRQ switch code. diff --git a/os/common/ports/ARMCMx/compilers/IAR/chcoreasm_v7m.s b/os/common/ports/ARMCMx/compilers/IAR/chcoreasm_v7m.s index 2f58a73aa..598373c43 100644 --- a/os/common/ports/ARMCMx/compilers/IAR/chcoreasm_v7m.s +++ b/os/common/ports/ARMCMx/compilers/IAR/chcoreasm_v7m.s @@ -39,12 +39,22 @@ #if !defined(__DOXYGEN__) +/* + * RTOS-specific context offset. + */ +#if defined(_CHIBIOS_RT_CONF_) +#define CONTEXT_OFFSET 12 +#elif defined(_CHIBIOS_NIL_CONF_) +#define CONTEXT_OFFSET 0 +#else +#error "invalid chconf.h" +#endif + MODULE ?chcoreasm_v7m AAPCS INTERWORK, VFP_COMPATIBLE PRESERVE8 -CONTEXT_OFFSET SET 12 SCB_ICSR SET 0xE000ED04 ICSR_PENDSVSET SET 0x10000000 @@ -109,7 +119,14 @@ _port_thread_start: #endif mov r0, r5 blx r4 +#if defined(_CHIBIOS_RT_CONF_) + movs r0, #0 /* MSG_OK */ bl chThdExit +#endif +#if defined(_CHIBIOS_NIL_CONF_) + mov r3, #0 + bl chSysHalt +#endif /* * Post-IRQ switch code. diff --git a/os/common/ports/ARMCMx/compilers/RVCT/chcoreasm_v6m.s b/os/common/ports/ARMCMx/compilers/RVCT/chcoreasm_v6m.s index e61662f38..b3ce9f906 100644 --- a/os/common/ports/ARMCMx/compilers/RVCT/chcoreasm_v6m.s +++ b/os/common/ports/ARMCMx/compilers/RVCT/chcoreasm_v6m.s @@ -39,7 +39,17 @@ #if !defined(__DOXYGEN__) -CONTEXT_OFFSET EQU 12 +/* + * RTOS-specific context offset. + */ +#if defined(_CHIBIOS_RT_CONF_) +#define CONTEXT_OFFSET 12 +#elif defined(_CHIBIOS_NIL_CONF_) +#define CONTEXT_OFFSET 0 +#else +#error "invalid chconf.h" +#endif + SCB_ICSR EQU 0xE000ED04 PRESERVE8 @@ -95,7 +105,14 @@ _port_thread_start PROC cpsie i mov r0, r5 blx r4 +#if defined(_CHIBIOS_RT_CONF_) + movs r0, #0 /* MSG_OK */ bl chThdExit +#endif +#if defined(_CHIBIOS_NIL_CONF_) + mov r3, #0 + bl chSysHalt +#endif ENDP /* diff --git a/os/common/ports/ARMCMx/compilers/RVCT/chcoreasm_v7m.s b/os/common/ports/ARMCMx/compilers/RVCT/chcoreasm_v7m.s index 69bfaa59c..1cbdc6bca 100644 --- a/os/common/ports/ARMCMx/compilers/RVCT/chcoreasm_v7m.s +++ b/os/common/ports/ARMCMx/compilers/RVCT/chcoreasm_v7m.s @@ -39,7 +39,17 @@ #if !defined(__DOXYGEN__) -CONTEXT_OFFSET EQU 12 +/* + * RTOS-specific context offset. + */ +#if defined(_CHIBIOS_RT_CONF_) +#define CONTEXT_OFFSET 12 +#elif defined(_CHIBIOS_NIL_CONF_) +#define CONTEXT_OFFSET 0 +#else +#error "invalid chconf.h" +#endif + SCB_ICSR EQU 0xE000ED04 ICSR_PENDSVSET EQU 0x10000000 @@ -105,7 +115,14 @@ _port_thread_start PROC #endif mov r0, r5 blx r4 +#if defined(_CHIBIOS_RT_CONF_) + movs r0, #0 /* MSG_OK */ bl chThdExit +#endif +#if defined(_CHIBIOS_NIL_CONF_) + mov r3, #0 + bl chSysHalt +#endif ENDP /* diff --git a/os/rt/include/ch.h b/os/rt/include/ch.h index 73faa8481..29b6c410a 100644 --- a/os/rt/include/ch.h +++ b/os/rt/include/ch.h @@ -98,6 +98,7 @@ #include "chmemcore.h" #include "chheap.h" #include "chmempools.h" +#include "chdynamic.h" #include "chqueues.h" #include "chstreams.h"