File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed
core/mbed-rtos/rtx/TARGET_CORTEX_M Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -568,29 +568,40 @@ extern void __iar_dynamic_initialization(void);
568
568
extern void mbed_sdk_init (void );
569
569
extern void exit (int arg );
570
570
571
+ static uint8_t low_level_init_needed ;
572
+
573
+ void pre_main (void ) {
574
+ if (low_level_init_needed ) {
575
+ __iar_dynamic_initialization ();
576
+ }
577
+ main ();
578
+ }
579
+
571
580
#pragma required=__vector_table
572
581
void __iar_program_start ( void )
573
582
{
574
583
#ifdef __MBED_CMSIS_RTOS_CM
575
584
__iar_init_core ();
576
585
__iar_init_vfp ();
577
586
578
- int a ;
587
+ uint8_t low_level_init_needed_local ;
579
588
580
- if (__low_level_init () != 0 ) {
589
+ low_level_init_needed_local = __low_level_init ();
590
+ if (low_level_init_needed_local ) {
581
591
__iar_data_init3 ();
582
592
mbed_sdk_init ();
583
- __iar_dynamic_initialization ();
584
593
}
594
+ /* Store in a global variable after RAM has been initialized */
595
+ low_level_init_needed = low_level_init_needed_local ;
585
596
#endif
586
597
osKernelInitialize ();
587
598
#ifdef __MBED_CMSIS_RTOS_CM
588
599
set_main_stack ();
589
600
#endif
590
601
osThreadCreate (& os_thread_def_main , NULL );
591
- a = osKernelStart ();
592
- exit ( a );
593
-
602
+ osKernelStart ();
603
+ /* osKernelStart should not return */
604
+ while ( 1 );
594
605
}
595
606
596
607
#endif
You can’t perform that action at this time.
0 commit comments