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