Skip to content

Commit 43e595a

Browse files
Patatermeriac
authored andcommitted
Wrap software_init_hook
Wrap software_init_hook so that it can be used or extended from outside the RTOS. This is desirable so that code can be added to the software_init_hook without making the RTOS depend on new features or libraries.
1 parent 6116687 commit 43e595a

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

hal/common/retarget.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,18 @@ extern "C" WEAK void __cxa_pure_virtual(void) {
412412

413413
#endif
414414

415+
#if defined(TOOLCHAIN_GCC)
416+
extern "C" WEAK void software_init_hook_rtos(void)
417+
{
418+
// Do nothing by default.
419+
}
420+
421+
extern "C" void software_init_hook(void)
422+
{
423+
software_init_hook_rtos();
424+
}
425+
#endif
426+
415427
// ****************************************************************************
416428
// mbed_main is a function that is called before main()
417429
// mbed_sdk_init() is also a function that is called before main(), but unlike

rtos/rtx/TARGET_ARM7/RTX_CM_lib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ void pre_main(void) {
339339
main(0, NULL);
340340
}
341341

342-
__attribute__((naked)) void software_init_hook (void) {
342+
__attribute__((naked)) void software_init_hook_rtos (void) {
343343
__asm (
344344
".syntax unified\n"
345345
".thumb\n"

rtos/rtx/TARGET_CORTEX_A/RTX_CM_lib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ __asm void __rt_entry (void) {
447447

448448
#elif defined (__GNUC__)
449449

450-
__attribute__((naked)) void software_init_hook (void) {
450+
__attribute__((naked)) void software_init_hook_rtos (void) {
451451
__asm (
452452
".syntax unified\n"
453453
".arm\n"

rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ void pre_main(void) {
655655
main(0, NULL);
656656
}
657657

658-
__attribute__((naked)) void software_init_hook (void) {
658+
__attribute__((naked)) void software_init_hook_rtos (void) {
659659
__asm (
660660
"bl osKernelInitialize\n"
661661
#ifdef __MBED_CMSIS_RTOS_CM

0 commit comments

Comments
 (0)