Skip to content

Commit e0dded3

Browse files
committed
Revert partially "Remove Cortex A support from CMSIS/RTOS"
This reverts commit 5f29445 - but only partially. cmain.S for IAR is still required to keep mbed SDK boot process as it was. This startup file for IAR is active for non-rtos projects. Fixes #4330
1 parent 8f29517 commit e0dded3

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

cmsis/TOOLCHAIN_IAR/cmain.S

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/**************************************************
2+
*
3+
* Part two of the system initialization code, contains C-level
4+
* initialization, thumb-2 only variant.
5+
*
6+
* Copyright 2006 IAR Systems. All rights reserved.
7+
*
8+
* $Revision: 59783 $
9+
*
10+
**************************************************/
11+
12+
13+
; --------------------------------------------------
14+
; Module ?cmain, C-level initialization.
15+
;
16+
17+
18+
SECTION SHT$$PREINIT_ARRAY:CONST:NOROOT(2)
19+
SECTION SHT$$INIT_ARRAY:CONST:NOROOT(2)
20+
21+
SECTION .text:CODE:NOROOT(2)
22+
23+
PUBLIC __cmain
24+
;; Keep ?main for legacy reasons, it is accessed in countless instances of cstartup.s around the world...
25+
PUBLIC ?main
26+
EXTWEAK __iar_data_init3
27+
EXTWEAK __iar_argc_argv
28+
EXTERN __low_level_init
29+
EXTERN __call_ctors
30+
EXTERN main
31+
EXTERN exit
32+
EXTERN __iar_dynamic_initialization
33+
EXTERN mbed_sdk_init
34+
EXTERN SystemInit
35+
36+
THUMB
37+
__cmain:
38+
?main:
39+
40+
; Initialize segments.
41+
; __segment_init and __low_level_init are assumed to use the same
42+
; instruction set and to be reachable by BL from the ICODE segment
43+
; (it is safest to link them in segment ICODE).
44+
45+
FUNCALL __cmain, __low_level_init
46+
bl __low_level_init
47+
cmp r0,#0
48+
beq ?l1
49+
FUNCALL __cmain, __iar_data_init3
50+
bl __iar_data_init3
51+
MOVS r0,#0 ; No parameters
52+
FUNCALL __cmain, mbed_sdk_init
53+
BL mbed_sdk_init
54+
MOVS r0,#0 ; No parameters
55+
FUNCALL __cmain, __iar_dynamic_initialization
56+
BL __iar_dynamic_initialization ; C++ dynamic initialization
57+
58+
?l1:
59+
REQUIRE ?l3
60+
61+
SECTION .text:CODE:NOROOT(2)
62+
63+
PUBLIC _main
64+
PUBLIC _call_main
65+
THUMB
66+
67+
__iar_init$$done: ; Copy initialization is done
68+
69+
?l3:
70+
_call_main:
71+
MOVS r0,#0 ; No parameters
72+
FUNCALL __cmain, __iar_argc_argv
73+
BL __iar_argc_argv ; Maybe setup command line
74+
75+
FUNCALL __cmain, main
76+
BL main
77+
_main:
78+
FUNCALL __cmain, exit
79+
BL exit
80+
81+
END

0 commit comments

Comments
 (0)