diff options
-rw-r--r-- | demos/ARMCM3-STM32F103-IAR/main.c | 3 | ||||
-rw-r--r-- | os/ports/IAR/ARMCMx/cstartup.s | 21 |
2 files changed, 19 insertions, 5 deletions
diff --git a/demos/ARMCM3-STM32F103-IAR/main.c b/demos/ARMCM3-STM32F103-IAR/main.c index fca30c731..a3a5c062e 100644 --- a/demos/ARMCM3-STM32F103-IAR/main.c +++ b/demos/ARMCM3-STM32F103-IAR/main.c @@ -40,13 +40,10 @@ static msg_t Thread1(void *arg) { * Entry point.
*/
int main(int argc, char **argv) {
- void hwinit1(void);
(void)argc;
(void)argv;
- hwinit1();
-
/*
* Activates the serial driver 2 using the driver default configuration.
*/
diff --git a/os/ports/IAR/ARMCMx/cstartup.s b/os/ports/IAR/ARMCMx/cstartup.s index 97757362a..2084ff929 100644 --- a/os/ports/IAR/ARMCMx/cstartup.s +++ b/os/ports/IAR/ARMCMx/cstartup.s @@ -39,10 +39,13 @@ CONTROL_USE_PSP SET 2 SECTION .intvec:CODE:NOROOT(3)
PUBLIC __iar_program_start
- EXTERN __cmain
+ EXTERN main
+ EXTERN _exit
EXTERN __vector_table
EXTWEAK __iar_init_core
EXTWEAK __iar_init_vfp
+ EXTWEAK __low_level_init
+ EXTWEAK __iar_data_init3
SECTION .text:CODE:REORDER(2)
THUMB
@@ -56,12 +59,26 @@ __iar_program_start: bl hwinit0
bl __iar_init_core
bl __iar_init_vfp
- bl __cmain
+
+; Replicated cmain.s here in order to insert the call to hwinit1.
+ bl __low_level_init
+ cmp r0, #0
+ beq.n _call_main
+ bl __iar_data_init3
+_call_main:
+ bl hwinit1
+ bl main
+ bl _exit
PUBWEAK hwinit0
hwinit0
bx lr
+
+ PUBWEAK hwinit1
+hwinit1
+ bx lr
+
REQUIRE __vector_table
END
|