Skip to content

Commit 1a638c7

Browse files
author
Cruz Monrreal
authored
Merge pull request #8106 from c1728p9/macros_to_config
Replace macros with config options
2 parents c5f2d16 + b9b4b8a commit 1a638c7

File tree

4 files changed

+53
-16
lines changed

4 files changed

+53
-16
lines changed

platform/mbed_lib.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,31 @@
7070
"help": "Enable tracing of each memory call by invoking a callback on each memory operation. See mbed_mem_trace.h in the HAL API for more information",
7171
"value": false
7272
},
73+
"sys-stats-enabled": {
74+
"macro_name": "MBED_SYS_STATS_ENABLED",
75+
"help": "Set to 1 to enable system stats. When enabled the function mbed_stats_sys_get returns non-zero data. See mbed_stats.h for more information",
76+
"value": null
77+
},
78+
"stack-stats-enabled": {
79+
"macro_name": "MBED_STACK_STATS_ENABLED",
80+
"help": "Set to 1 to enable stack stats. When enabled the functions mbed_stats_stack_get and mbed_stats_stack_get_each return non-zero data. See mbed_stats.h for more information",
81+
"value": null
82+
},
83+
"cpu-stats-enabled": {
84+
"macro_name": "MBED_CPU_STATS_ENABLED",
85+
"help": "Set to 1 to enable cpu stats. When enabled the function mbed_stats_cpu_get returns non-zero data. See mbed_stats.h for more information",
86+
"value": null
87+
},
88+
"heap-stats-enabled": {
89+
"macro_name": "MBED_HEAP_STATS_ENABLED",
90+
"help": "Set to 1 to enable heap stats. When enabled the function mbed_stats_heap_get returns non-zero data. See mbed_stats.h for more information",
91+
"value": null
92+
},
93+
"thread-stats-enabled": {
94+
"macro_name": "MBED_THREAD_STATS_ENABLED",
95+
"help": "Set to 1 to enable thread stats. When enabled the function mbed_stats_thread_get_each returns non-zero data. See mbed_stats.h for more information",
96+
"value": null
97+
},
7398
"error-decode-http-url-str": {
7499
"help": "HTTP URL string for ARM Mbed-OS Error Decode microsite",
75100
"value": "\"\\nFor more info, visit: https://armmbed.github.io/mbedos-error/?error=0x%08X\""

rtos/TARGET_CORTEX/mbed_rtos_rtx.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@
2525

2626
osThreadAttr_t _main_thread_attr;
2727

28-
/** The main thread's stack size can be configured by the application, if not explicitly specified it'll default to 4K */
2928
#ifndef MBED_CONF_APP_MAIN_STACK_SIZE
30-
#define MBED_CONF_APP_MAIN_STACK_SIZE 4096
29+
#define MBED_CONF_APP_MAIN_STACK_SIZE MBED_CONF_RTOS_MAIN_THREAD_STACK_SIZE
3130
#endif
3231
MBED_ALIGN(8) char _main_stack[MBED_CONF_APP_MAIN_STACK_SIZE];
3332
mbed_rtos_storage_thread_t _main_obj;

rtos/TARGET_CORTEX/mbed_rtx_conf.h

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,23 @@
2727
/** Any access to RTX5 specific data structures used in common code should be wrapped in ifdef MBED_OS_BACKEND_RTX5 */
2828
#define MBED_OS_BACKEND_RTX5
2929

30-
/** The thread's stack size can be configured by the application, if not explicitly specified it'll default to 4K */
31-
#ifndef MBED_CONF_APP_THREAD_STACK_SIZE
32-
#define MBED_CONF_APP_THREAD_STACK_SIZE 4096
33-
#endif
34-
30+
#if defined(MBED_CONF_APP_THREAD_STACK_SIZE)
3531
#define OS_STACK_SIZE MBED_CONF_APP_THREAD_STACK_SIZE
36-
37-
/** The timer thread's stack size can be configured by the application, if not explicitly specified, it'll default to 768 */
38-
#ifndef MBED_CONF_APP_TIMER_THREAD_STACK_SIZE
39-
#define MBED_CONF_APP_TIMER_THREAD_STACK_SIZE 768
32+
#else
33+
#define OS_STACK_SIZE MBED_CONF_RTOS_THREAD_STACK_SIZE
4034
#endif
4135

36+
#ifdef MBED_CONF_APP_TIMER_THREAD_STACK_SIZE
4237
#define OS_TIMER_THREAD_STACK_SIZE MBED_CONF_APP_TIMER_THREAD_STACK_SIZE
43-
44-
/** The idle thread's stack size can be configured by the application, if not explicitly specified, it'll default to 512 */
45-
#ifndef MBED_CONF_APP_IDLE_THREAD_STACK_SIZE
46-
#define MBED_CONF_APP_IDLE_THREAD_STACK_SIZE 512
38+
#else
39+
#define OS_TIMER_THREAD_STACK_SIZE MBED_CONF_RTOS_TIMER_THREAD_STACK_SIZE
4740
#endif
4841

42+
#ifdef MBED_CONF_APP_IDLE_THREAD_STACK_SIZE
4943
#define OS_IDLE_THREAD_STACK_SIZE MBED_CONF_APP_IDLE_THREAD_STACK_SIZE
44+
#else
45+
#define OS_IDLE_THREAD_STACK_SIZE MBED_CONF_RTOS_IDLE_THREAD_STACK_SIZE
46+
#endif
5047

5148
#define OS_DYNAMIC_MEM_SIZE 0
5249

rtos/mbed_lib.json

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
11
{
22
"name": "rtos",
33
"config": {
4-
"present": 1
4+
"present": 1,
5+
"main-thread-stack-size": {
6+
"help": "The size of the main thread's stack",
7+
"value": 4096
8+
},
9+
"timer-thread-stack-size": {
10+
"help": "The size of the timer thread's stack",
11+
"value": 768
12+
},
13+
"idle-thread-stack-size": {
14+
"help": "The size of the idle thread's stack",
15+
"value": 512
16+
},
17+
"thread-stack-size": {
18+
"help": "The default stack size of new threads",
19+
"value": 4096
20+
}
521
},
622
"macros": ["_RTE_"]
723
}

0 commit comments

Comments
 (0)