Skip to content

Commit 59061b6

Browse files
0xc0170Bartek Szatkowski
authored andcommitted
mbed boot: fix IAR mbed_main
We do not use __iar_argc_argv() anymore. Invoke mbed_main right before main in pre_main function. This fixes the test call_before_main.
1 parent 43d4a84 commit 59061b6

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

rtos/mbed_boot.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ void pre_main(void)
520520
if (low_level_init_needed) {
521521
__iar_dynamic_initialization();
522522
}
523+
mbed_main();
523524
main();
524525
}
525526

@@ -547,16 +548,6 @@ void __iar_program_start( void )
547548
mbed_start_main();
548549
}
549550

550-
/* IAR doesn't have the $Super/$Sub mechanism of armcc, nor something equivalent
551-
* to ld's --wrap. It does have a --redirect, but that doesn't help, since redirecting
552-
* 'main' to another symbol looses the original 'main' symbol. However, its startup
553-
* code will call a function to setup argc and argv (__iar_argc_argv) if it is defined.
554-
* Since mbed doesn't use argc/argv, we use this function to call our mbed_main.
555-
*/
556-
void __iar_argc_argv() {
557-
mbed_main();
558-
}
559-
560551
/* Thread safety */
561552
static osMutexId_t std_mutex_id_sys[_MAX_LOCK] = {0};
562553
static os_mutex_t std_mutex_sys[_MAX_LOCK] = {0};

0 commit comments

Comments
 (0)