t
Fork of mbed-dev by
cmsis/TOOLCHAIN_IAR/cmain.S@166:c97ed07ec1a8, 2017-06-08 (annotated)
- Committer:
- AnnaBridge
- Date:
- Thu Jun 08 15:02:37 2017 +0100
- Revision:
- 166:c97ed07ec1a8
- Parent:
- 149:156823d33999
- Child:
- 168:9672193075cf
This updates the lib to the mbed lib v 144
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 | * $Revision: 59783 $ |
<> | 144:ef7eb2e8f9f7 | 7 | * |
<> | 144:ef7eb2e8f9f7 | 8 | **************************************************/ |
AnnaBridge | 166:c97ed07ec1a8 | 9 | /* Copyright 2008-2017, IAR Systems AB. |
AnnaBridge | 166:c97ed07ec1a8 | 10 | This source code is the property of IAR Systems. The source code may only |
AnnaBridge | 166:c97ed07ec1a8 | 11 | be used together with the IAR Embedded Workbench. Redistribution and use |
AnnaBridge | 166:c97ed07ec1a8 | 12 | in source and binary forms, with or without modification, is permitted |
AnnaBridge | 166:c97ed07ec1a8 | 13 | provided that the following conditions are met: |
AnnaBridge | 166:c97ed07ec1a8 | 14 | - Redistributions of source code, in whole or in part, must retain the |
AnnaBridge | 166:c97ed07ec1a8 | 15 | above copyright notice, this list of conditions and the disclaimer below. |
AnnaBridge | 166:c97ed07ec1a8 | 16 | - IAR Systems name may not be used to endorse or promote products |
AnnaBridge | 166:c97ed07ec1a8 | 17 | derived from this software without specific prior written permission. |
<> | 144:ef7eb2e8f9f7 | 18 | |
AnnaBridge | 166:c97ed07ec1a8 | 19 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
AnnaBridge | 166:c97ed07ec1a8 | 20 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
AnnaBridge | 166:c97ed07ec1a8 | 21 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
AnnaBridge | 166:c97ed07ec1a8 | 22 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
AnnaBridge | 166:c97ed07ec1a8 | 23 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
AnnaBridge | 166:c97ed07ec1a8 | 24 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
AnnaBridge | 166:c97ed07ec1a8 | 25 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
AnnaBridge | 166:c97ed07ec1a8 | 26 | */ |
<> | 144:ef7eb2e8f9f7 | 27 | |
<> | 144:ef7eb2e8f9f7 | 28 | ; -------------------------------------------------- |
<> | 144:ef7eb2e8f9f7 | 29 | ; Module ?cmain, C-level initialization. |
<> | 144:ef7eb2e8f9f7 | 30 | ; |
<> | 144:ef7eb2e8f9f7 | 31 | |
<> | 144:ef7eb2e8f9f7 | 32 | |
<> | 144:ef7eb2e8f9f7 | 33 | SECTION SHT$$PREINIT_ARRAY:CONST:NOROOT(2) |
<> | 144:ef7eb2e8f9f7 | 34 | SECTION SHT$$INIT_ARRAY:CONST:NOROOT(2) |
<> | 144:ef7eb2e8f9f7 | 35 | |
<> | 144:ef7eb2e8f9f7 | 36 | SECTION .text:CODE:NOROOT(2) |
<> | 144:ef7eb2e8f9f7 | 37 | |
<> | 144:ef7eb2e8f9f7 | 38 | PUBLIC __cmain |
<> | 144:ef7eb2e8f9f7 | 39 | ;; Keep ?main for legacy reasons, it is accessed in countless instances of cstartup.s around the world... |
<> | 144:ef7eb2e8f9f7 | 40 | PUBLIC ?main |
<> | 144:ef7eb2e8f9f7 | 41 | EXTWEAK __iar_data_init3 |
<> | 144:ef7eb2e8f9f7 | 42 | EXTWEAK __iar_argc_argv |
<> | 144:ef7eb2e8f9f7 | 43 | EXTERN __low_level_init |
<> | 144:ef7eb2e8f9f7 | 44 | EXTERN __call_ctors |
<> | 144:ef7eb2e8f9f7 | 45 | EXTERN main |
<> | 144:ef7eb2e8f9f7 | 46 | EXTERN exit |
<> | 144:ef7eb2e8f9f7 | 47 | EXTERN __iar_dynamic_initialization |
<> | 144:ef7eb2e8f9f7 | 48 | EXTERN mbed_sdk_init |
<> | 144:ef7eb2e8f9f7 | 49 | EXTERN SystemInit |
<> | 144:ef7eb2e8f9f7 | 50 | |
<> | 144:ef7eb2e8f9f7 | 51 | THUMB |
<> | 144:ef7eb2e8f9f7 | 52 | __cmain: |
<> | 144:ef7eb2e8f9f7 | 53 | ?main: |
<> | 144:ef7eb2e8f9f7 | 54 | |
<> | 144:ef7eb2e8f9f7 | 55 | ; Initialize segments. |
<> | 144:ef7eb2e8f9f7 | 56 | ; __segment_init and __low_level_init are assumed to use the same |
<> | 144:ef7eb2e8f9f7 | 57 | ; instruction set and to be reachable by BL from the ICODE segment |
<> | 144:ef7eb2e8f9f7 | 58 | ; (it is safest to link them in segment ICODE). |
<> | 144:ef7eb2e8f9f7 | 59 | |
<> | 144:ef7eb2e8f9f7 | 60 | FUNCALL __cmain, __low_level_init |
<> | 144:ef7eb2e8f9f7 | 61 | bl __low_level_init |
<> | 144:ef7eb2e8f9f7 | 62 | cmp r0,#0 |
<> | 144:ef7eb2e8f9f7 | 63 | beq ?l1 |
<> | 144:ef7eb2e8f9f7 | 64 | FUNCALL __cmain, __iar_data_init3 |
<> | 144:ef7eb2e8f9f7 | 65 | bl __iar_data_init3 |
<> | 144:ef7eb2e8f9f7 | 66 | MOVS r0,#0 ; No parameters |
<> | 144:ef7eb2e8f9f7 | 67 | FUNCALL __cmain, mbed_sdk_init |
<> | 144:ef7eb2e8f9f7 | 68 | BL mbed_sdk_init |
<> | 144:ef7eb2e8f9f7 | 69 | MOVS r0,#0 ; No parameters |
<> | 144:ef7eb2e8f9f7 | 70 | FUNCALL __cmain, __iar_dynamic_initialization |
<> | 144:ef7eb2e8f9f7 | 71 | BL __iar_dynamic_initialization ; C++ dynamic initialization |
<> | 144:ef7eb2e8f9f7 | 72 | |
<> | 144:ef7eb2e8f9f7 | 73 | ?l1: |
<> | 144:ef7eb2e8f9f7 | 74 | REQUIRE ?l3 |
<> | 144:ef7eb2e8f9f7 | 75 | |
<> | 144:ef7eb2e8f9f7 | 76 | SECTION .text:CODE:NOROOT(2) |
<> | 144:ef7eb2e8f9f7 | 77 | |
<> | 144:ef7eb2e8f9f7 | 78 | PUBLIC _main |
<> | 144:ef7eb2e8f9f7 | 79 | PUBLIC _call_main |
<> | 144:ef7eb2e8f9f7 | 80 | THUMB |
<> | 144:ef7eb2e8f9f7 | 81 | |
<> | 144:ef7eb2e8f9f7 | 82 | __iar_init$$done: ; Copy initialization is done |
<> | 144:ef7eb2e8f9f7 | 83 | |
<> | 144:ef7eb2e8f9f7 | 84 | ?l3: |
<> | 144:ef7eb2e8f9f7 | 85 | _call_main: |
<> | 144:ef7eb2e8f9f7 | 86 | MOVS r0,#0 ; No parameters |
<> | 144:ef7eb2e8f9f7 | 87 | FUNCALL __cmain, __iar_argc_argv |
<> | 144:ef7eb2e8f9f7 | 88 | BL __iar_argc_argv ; Maybe setup command line |
<> | 144:ef7eb2e8f9f7 | 89 | |
<> | 144:ef7eb2e8f9f7 | 90 | FUNCALL __cmain, main |
<> | 144:ef7eb2e8f9f7 | 91 | BL main |
<> | 144:ef7eb2e8f9f7 | 92 | _main: |
<> | 144:ef7eb2e8f9f7 | 93 | FUNCALL __cmain, exit |
<> | 144:ef7eb2e8f9f7 | 94 | BL exit |
<> | 144:ef7eb2e8f9f7 | 95 | |
<> | 144:ef7eb2e8f9f7 | 96 | END |