Skip to content

Commit 3bbacad

Browse files
committed
[NANO130] Remove mbed_sdk_init_forced()
1. With mbed OS 5, mbed_sdk_init() is ensured to call before C++ global object constructor. 2. Refine startup file with GCC_ARM toolchain related to this modification.
1 parent 127a09c commit 3bbacad

File tree

2 files changed

+6
-36
lines changed

2 files changed

+6
-36
lines changed

targets/TARGET_NUVOTON/TARGET_NANO100/TARGET_NUMAKER_PFM_NANO130/mbed_overrides.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,6 @@
1616

1717
#include "cmsis.h"
1818

19-
// NOTE: Ensurce mbed_sdk_init() will get called before C++ global object constructor.
20-
#if defined(__CC_ARM) || defined(__GNUC__)
21-
void mbed_sdk_init_forced(void) __attribute__((constructor(101)));
22-
#elif defined(__ICCARM__)
23-
// TODO: How to achieve it in IAR?
24-
#endif
25-
26-
2719
void mbed_sdk_init(void)
2820
{
2921
// NOTE: Support singleton semantics to be called from other init functions
@@ -70,8 +62,3 @@ void mbed_sdk_init(void)
7062
/* Lock protected registers */
7163
SYS_LockReg();
7264
}
73-
74-
void mbed_sdk_init_forced(void)
75-
{
76-
mbed_sdk_init();
77-
}

targets/TARGET_NUVOTON/TARGET_NANO100/device/startup_Nano100Series.c

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,11 @@ extern uint32_t __bss_start__;
6161
extern uint32_t __bss_end__;
6262

6363
extern void uvisor_init(void);
64-
//#if defined(TOOLCHAIN_GCC_ARM)
65-
//extern void _start(void);
66-
//#endif
67-
extern void software_init_hook(void) __attribute__((weak));
68-
extern void __libc_init_array(void);
69-
extern int main(void);
64+
#if defined(TOOLCHAIN_GCC_ARM)
65+
extern void _start(void);
66+
#else
67+
#error("For GCC toolchain, only support GNU ARM Embedded")
68+
#endif
7069
#endif
7170

7271
/* Default empty handler */
@@ -203,11 +202,6 @@ void Reset_Handler(void)
203202
/* Enable register write-protection function */
204203
SYS_LockReg();
205204

206-
/**
207-
* Because EBI (external SRAM) init is done in SystemInit(), SystemInit() must be called at the very start.
208-
*/
209-
//SystemInit();
210-
211205
#if defined(__CC_ARM)
212206
__main();
213207

@@ -235,19 +229,8 @@ void Reset_Handler(void)
235229
}
236230
}
237231

238-
//uvisor_init();
232+
_start();
239233

240-
if (software_init_hook) {
241-
/**
242-
* Give control to the RTOS via software_init_hook() which will also call __libc_init_array().
243-
* Assume software_init_hook() is defined in libraries/rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h.
244-
*/
245-
software_init_hook();
246-
}
247-
else {
248-
__libc_init_array();
249-
main();
250-
}
251234
#endif
252235

253236
/* Infinite loop */

0 commit comments

Comments
 (0)