Initial commit

Dependencies:   FastPWM

Committer:
lypinator
Date:
Wed Sep 16 01:11:49 2020 +0000
Revision:
0:bb348c97df44
Added PWM

Who changed what in which revision?

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