Forked.
Fork of mbed-dev by
cmsis/TOOLCHAIN_IAR/cmain.S@168:9672193075cf, 2017-07-06 (annotated)
- Committer:
- AnnaBridge
- Date:
- Thu Jul 06 15:42:05 2017 +0100
- Revision:
- 168:9672193075cf
- Parent:
- 166:c97ed07ec1a8
This updates the lib to the mbed lib v 146
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 |
AnnaBridge | 168:9672193075cf | 49 | EXTERN mbed_main |
<> | 144:ef7eb2e8f9f7 | 50 | EXTERN SystemInit |
<> | 144:ef7eb2e8f9f7 | 51 | |
<> | 144:ef7eb2e8f9f7 | 52 | THUMB |
<> | 144:ef7eb2e8f9f7 | 53 | __cmain: |
<> | 144:ef7eb2e8f9f7 | 54 | ?main: |
<> | 144:ef7eb2e8f9f7 | 55 | |
<> | 144:ef7eb2e8f9f7 | 56 | ; Initialize segments. |
<> | 144:ef7eb2e8f9f7 | 57 | ; __segment_init and __low_level_init are assumed to use the same |
<> | 144:ef7eb2e8f9f7 | 58 | ; instruction set and to be reachable by BL from the ICODE segment |
<> | 144:ef7eb2e8f9f7 | 59 | ; (it is safest to link them in segment ICODE). |
<> | 144:ef7eb2e8f9f7 | 60 | |
<> | 144:ef7eb2e8f9f7 | 61 | FUNCALL __cmain, __low_level_init |
<> | 144:ef7eb2e8f9f7 | 62 | bl __low_level_init |
<> | 144:ef7eb2e8f9f7 | 63 | cmp r0,#0 |
<> | 144:ef7eb2e8f9f7 | 64 | beq ?l1 |
<> | 144:ef7eb2e8f9f7 | 65 | FUNCALL __cmain, __iar_data_init3 |
<> | 144:ef7eb2e8f9f7 | 66 | bl __iar_data_init3 |
<> | 144:ef7eb2e8f9f7 | 67 | MOVS r0,#0 ; No parameters |
<> | 144:ef7eb2e8f9f7 | 68 | FUNCALL __cmain, mbed_sdk_init |
<> | 144:ef7eb2e8f9f7 | 69 | BL mbed_sdk_init |
<> | 144:ef7eb2e8f9f7 | 70 | MOVS r0,#0 ; No parameters |
<> | 144:ef7eb2e8f9f7 | 71 | FUNCALL __cmain, __iar_dynamic_initialization |
<> | 144:ef7eb2e8f9f7 | 72 | BL __iar_dynamic_initialization ; C++ dynamic initialization |
<> | 144:ef7eb2e8f9f7 | 73 | |
<> | 144:ef7eb2e8f9f7 | 74 | ?l1: |
<> | 144:ef7eb2e8f9f7 | 75 | REQUIRE ?l3 |
<> | 144:ef7eb2e8f9f7 | 76 | |
<> | 144:ef7eb2e8f9f7 | 77 | SECTION .text:CODE:NOROOT(2) |
<> | 144:ef7eb2e8f9f7 | 78 | |
<> | 144:ef7eb2e8f9f7 | 79 | PUBLIC _main |
<> | 144:ef7eb2e8f9f7 | 80 | PUBLIC _call_main |
<> | 144:ef7eb2e8f9f7 | 81 | THUMB |
<> | 144:ef7eb2e8f9f7 | 82 | |
<> | 144:ef7eb2e8f9f7 | 83 | __iar_init$$done: ; Copy initialization is done |
<> | 144:ef7eb2e8f9f7 | 84 | |
<> | 144:ef7eb2e8f9f7 | 85 | ?l3: |
<> | 144:ef7eb2e8f9f7 | 86 | _call_main: |
<> | 144:ef7eb2e8f9f7 | 87 | MOVS r0,#0 ; No parameters |
<> | 144:ef7eb2e8f9f7 | 88 | FUNCALL __cmain, __iar_argc_argv |
<> | 144:ef7eb2e8f9f7 | 89 | BL __iar_argc_argv ; Maybe setup command line |
<> | 144:ef7eb2e8f9f7 | 90 | |
AnnaBridge | 168:9672193075cf | 91 | MOVS r0,#0 ; No parameters |
AnnaBridge | 168:9672193075cf | 92 | FUNCALL __cmain, mbed_main |
AnnaBridge | 168:9672193075cf | 93 | BL mbed_main |
AnnaBridge | 168:9672193075cf | 94 | |
<> | 144:ef7eb2e8f9f7 | 95 | FUNCALL __cmain, main |
<> | 144:ef7eb2e8f9f7 | 96 | BL main |
<> | 144:ef7eb2e8f9f7 | 97 | _main: |
<> | 144:ef7eb2e8f9f7 | 98 | FUNCALL __cmain, exit |
<> | 144:ef7eb2e8f9f7 | 99 | BL exit |
<> | 144:ef7eb2e8f9f7 | 100 | |
<> | 144:ef7eb2e8f9f7 | 101 | END |