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