Skip to content

Commit c5b4c54

Browse files
committed
Merge pull request #1720 from 0xc0170/fix_rtos_macro
RTOS - fix Cortex-M version - add macros required for new kernel
2 parents 84fc61c + 9aee702 commit c5b4c54

File tree

5 files changed

+20
-10
lines changed

5 files changed

+20
-10
lines changed

libraries/rtos/rtx/TARGET_CORTEX_M/cmsis_os.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@
5656

5757
#define CMSIS_OS_RTX
5858

59+
// __MBED_CMSIS_RTOS_CM captures our changes to the RTX kernel
60+
#define __MBED_CMSIS_RTOS_CM
61+
// we use __CMSIS_RTOS version, which changes some API in the kernel
62+
#define __CMSIS_RTOS
63+
5964
// The stack space occupied is mainly dependent on the underling C standard library
6065
#if defined(TOOLCHAIN_GCC) || defined(TOOLCHAIN_ARM_STD) || defined(TOOLCHAIN_IAR)
6166
# define WORDS_STACK_SIZE 512

libraries/rtos/rtx/TARGET_CORTEX_M/rt_CMSIS.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@
4848
#error "Missing __CORTEX_Mx definition"
4949
#endif
5050

51+
// This affects cmsis_os only, as it's not used anywhere else. This was left by kernel team
52+
// to suppress the warning in rt_tid2ptcb about incompatible pointer assignment.
53+
#define os_thread_cb OS_TCB
54+
5155
#include "rt_TypeDef.h"
5256
#include "RTX_Config.h"
5357
#include "rt_System.h"
@@ -62,8 +66,6 @@
6266
#include "rt_Memory.h"
6367
#include "rt_HAL_CM.h"
6468

65-
#define os_thread_cb OS_TCB
66-
6769
#include "cmsis_os.h"
6870

6971
#if (osFeature_Signals != 16)

libraries/rtos/rtx/TARGET_CORTEX_M/rt_Task.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434

3535
/* Definitions */
3636

37+
#include "cmsis_os.h"
38+
3739
/* Values for 'state' */
3840
#define INACTIVE 0U
3941
#define READY 1U

libraries/rtos/rtx/TARGET_CORTEX_M/rt_Timer.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "RTX_Config.h"
3737
#include "rt_Timer.h"
3838
#include "rt_MemBox.h"
39+
#include "cmsis_os.h"
3940

4041
#ifndef __CMSIS_RTOS
4142

workspace_tools/toolchains/__init__.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,14 @@ class mbedToolchain:
166166
VERBOSE = True
167167

168168
CORTEX_SYMBOLS = {
169-
"Cortex-M0" : ["__CORTEX_M0", "ARM_MATH_CM0", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"],
170-
"Cortex-M0+": ["__CORTEX_M0PLUS", "ARM_MATH_CM0PLUS", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"],
171-
"Cortex-M1" : ["__CORTEX_M3", "ARM_MATH_CM1", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"],
172-
"Cortex-M3" : ["__CORTEX_M3", "ARM_MATH_CM3", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"],
173-
"Cortex-M4" : ["__CORTEX_M4", "ARM_MATH_CM4", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"],
174-
"Cortex-M4F" : ["__CORTEX_M4", "ARM_MATH_CM4", "__FPU_PRESENT=1", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"],
175-
"Cortex-M7" : ["__CORTEX_M7", "ARM_MATH_CM7", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"],
176-
"Cortex-M7F" : ["__CORTEX_M7", "ARM_MATH_CM7", "__FPU_PRESENT=1", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"],
169+
"Cortex-M0" : ["__CORTEX_M0", "ARM_MATH_CM0"],
170+
"Cortex-M0+": ["__CORTEX_M0PLUS", "ARM_MATH_CM0PLUS"],
171+
"Cortex-M1" : ["__CORTEX_M3", "ARM_MATH_CM1"],
172+
"Cortex-M3" : ["__CORTEX_M3", "ARM_MATH_CM3"],
173+
"Cortex-M4" : ["__CORTEX_M4", "ARM_MATH_CM4"],
174+
"Cortex-M4F" : ["__CORTEX_M4", "ARM_MATH_CM4", "__FPU_PRESENT=1"],
175+
"Cortex-M7" : ["__CORTEX_M7", "ARM_MATH_CM7"],
176+
"Cortex-M7F" : ["__CORTEX_M7", "ARM_MATH_CM7", "__FPU_PRESENT=1"],
177177
"Cortex-A9" : ["__CORTEX_A9", "ARM_MATH_CA9", "__FPU_PRESENT", "__CMSIS_RTOS", "__EVAL", "__MBED_CMSIS_RTOS_CA9"],
178178
}
179179

0 commit comments

Comments
 (0)