,,

Fork of Application by Daniel Sygut

Committer:
Zaitsev
Date:
Tue Jan 10 20:42:26 2017 +0000
Revision:
10:41552d038a69
USB Serial bi-directional bridge

Who changed what in which revision?

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