Skip to content

Commit 255661e

Browse files
author
Deepika
committed
Adding debugger awarness with Keil MDK
Main thread in Mbed OS is statically allocated and was not available in call stack of Keil MDK. The RTX5 kernel requires statically allocated thread information objects that are placed into a specific section to enable RTOS thread awareness in Keil MDK. This fix is to keep main thread in specific section of memory.
1 parent aff2bee commit 255661e

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

rtos/TARGET_CORTEX/mbed_rtos_rtx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ osThreadAttr_t _main_thread_attr;
5151
#define MBED_CONF_APP_MAIN_STACK_SIZE MBED_CONF_RTOS_MAIN_THREAD_STACK_SIZE
5252
#endif
5353
MBED_ALIGN(8) char _main_stack[MBED_CONF_APP_MAIN_STACK_SIZE];
54-
mbed_rtos_storage_thread_t _main_obj;
54+
mbed_rtos_storage_thread_t _main_obj __attribute__((section(".bss.os.thread.cb")));
5555

5656
osMutexId_t singleton_mutex_id;
5757
mbed_rtos_storage_mutex_t singleton_mutex_obj;

tools/profiles/debug.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"asm": [],
2525
"c": ["-D__ASSERT_MSG", "-std=gnu99"],
2626
"cxx": ["-fno-rtti", "-std=gnu++98"],
27-
"ld": ["--verbose", "--remove", "--show_full_path", "--legacyalign"]
27+
"ld": ["--verbose", "--remove", "--show_full_path", "--legacyalign", "--keep=os_cb_sections"]
2828
},
2929
"ARM": {
3030
"common": ["-c", "--gnu", "-Otime", "--split_sections",
@@ -34,7 +34,7 @@
3434
"asm": [],
3535
"c": ["--md", "--no_depend_system_headers", "--c99", "-D__ASSERT_MSG"],
3636
"cxx": ["--cpp", "--no_rtti", "--no_vla"],
37-
"ld": ["--show_full_path"]
37+
"ld": ["--show_full_path", "--keep=os_cb_sections"]
3838
},
3939
"uARM": {
4040
"common": ["-c", "--gnu", "-Otime", "--split_sections",

tools/profiles/develop.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"asm": [],
2424
"c": ["-D__ASSERT_MSG", "-std=gnu99"],
2525
"cxx": ["-fno-rtti", "-std=gnu++98"],
26-
"ld": ["--show_full_path", "--legacyalign"]
26+
"ld": ["--show_full_path", "--legacyalign", "--keep=os_cb_sections"]
2727
},
2828
"ARM": {
2929
"common": ["-c", "--gnu", "-Otime", "--split_sections",
@@ -32,7 +32,7 @@
3232
"asm": [],
3333
"c": ["--md", "--no_depend_system_headers", "--c99", "-D__ASSERT_MSG"],
3434
"cxx": ["--cpp", "--no_rtti", "--no_vla"],
35-
"ld": ["--show_full_path"]
35+
"ld": ["--show_full_path", "--keep=os_cb_sections"]
3636
},
3737
"uARM": {
3838
"common": ["-c", "--gnu", "-Otime", "--split_sections",

tools/profiles/release.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"asm": [],
2424
"c": ["-D__ASSERT_MSG", "-std=gnu99"],
2525
"cxx": ["-fno-rtti", "-std=gnu++98"],
26-
"ld": ["--show_full_path", "--legacyalign"]
26+
"ld": ["--show_full_path", "--legacyalign", "--keep=os_cb_sections"]
2727
},
2828
"ARM": {
2929
"common": ["-c", "--gnu", "-Ospace", "--split_sections",
@@ -32,7 +32,7 @@
3232
"asm": [],
3333
"c": ["--md", "--no_depend_system_headers", "--c99", "-D__ASSERT_MSG"],
3434
"cxx": ["--cpp", "--no_rtti", "--no_vla"],
35-
"ld": ["--show_full_path"]
35+
"ld": ["--show_full_path", "--keep=os_cb_sections"]
3636
},
3737
"uARM": {
3838
"common": ["-c", "--gnu", "-Ospace", "--split_sections",

0 commit comments

Comments
 (0)