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