mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_GCC_CR/vector_functions.s@20:4263a77256ae, 2013-09-10 (annotated)
- Committer:
- bogdanm
- Date:
- Tue Sep 10 15:14:19 2013 +0300
- Revision:
- 20:4263a77256ae
- Parent:
- 13:0645d8841f51
Sync with git revision 171dda705c947bf910926a0b73d6a4797802554d
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 20:4263a77256ae | 1 | /* .include "vector_defns.h" */ |
bogdanm | 20:4263a77256ae | 2 | |
bogdanm | 13:0645d8841f51 | 3 | |
bogdanm | 20:4263a77256ae | 4 | |
bogdanm | 20:4263a77256ae | 5 | .section .privileged_code, "ax" |
bogdanm | 20:4263a77256ae | 6 | .arm |
bogdanm | 13:0645d8841f51 | 7 | |
bogdanm | 13:0645d8841f51 | 8 | |
bogdanm | 20:4263a77256ae | 9 | .weak __mbed_fiq |
bogdanm | 20:4263a77256ae | 10 | .weak __mbed_undef |
bogdanm | 20:4263a77256ae | 11 | .weak __mbed_prefetch_abort |
bogdanm | 20:4263a77256ae | 12 | .weak __mbed_data_abort |
bogdanm | 20:4263a77256ae | 13 | .weak __mbed_irq |
bogdanm | 20:4263a77256ae | 14 | .weak __mbed_swi |
bogdanm | 20:4263a77256ae | 15 | .weak __mbed_dcc_irq |
bogdanm | 20:4263a77256ae | 16 | .weak __mbed_reset |
bogdanm | 20:4263a77256ae | 17 | .global __mbed_init_realmonitor |
bogdanm | 20:4263a77256ae | 18 | /* .global __mbed_init */ |
bogdanm | 13:0645d8841f51 | 19 | |
bogdanm | 13:0645d8841f51 | 20 | |
bogdanm | 13:0645d8841f51 | 21 | |
bogdanm | 13:0645d8841f51 | 22 | |
bogdanm | 13:0645d8841f51 | 23 | __mbed_fiq: |
bogdanm | 13:0645d8841f51 | 24 | B __mbed_fiq |
bogdanm | 13:0645d8841f51 | 25 | __mbed_undef: |
bogdanm | 13:0645d8841f51 | 26 | LDR PC, =0x7fffffa0 |
bogdanm | 13:0645d8841f51 | 27 | __mbed_prefetch_abort: |
bogdanm | 13:0645d8841f51 | 28 | LDR PC, =0x7fffffb0 |
bogdanm | 13:0645d8841f51 | 29 | __mbed_data_abort: |
bogdanm | 13:0645d8841f51 | 30 | LDR PC, =0x7fffffc0 |
bogdanm | 13:0645d8841f51 | 31 | __mbed_irq: |
bogdanm | 13:0645d8841f51 | 32 | MSR CPSR_c, #0x1F|0x80|0x40 |
bogdanm | 20:4263a77256ae | 33 | |
bogdanm | 13:0645d8841f51 | 34 | STMDB sp!, {r0-r3,r12,lr} |
bogdanm | 20:4263a77256ae | 35 | |
bogdanm | 13:0645d8841f51 | 36 | MOV r0, #0xFFFFFF00 |
bogdanm | 13:0645d8841f51 | 37 | LDR r0, [r0] |
bogdanm | 20:4263a77256ae | 38 | |
bogdanm | 13:0645d8841f51 | 39 | MOV lr, pc |
bogdanm | 13:0645d8841f51 | 40 | BX r0 |
bogdanm | 20:4263a77256ae | 41 | |
bogdanm | 13:0645d8841f51 | 42 | MOV r0, #0xFFFFFF00 |
bogdanm | 20:4263a77256ae | 43 | STR r0, [r0] |
bogdanm | 20:4263a77256ae | 44 | |
bogdanm | 13:0645d8841f51 | 45 | LDMFD sp!,{r0-r3,r12,lr} |
bogdanm | 20:4263a77256ae | 46 | |
bogdanm | 13:0645d8841f51 | 47 | MSR CPSR_c, #0x12|0x80|0x40 |
bogdanm | 20:4263a77256ae | 48 | |
bogdanm | 13:0645d8841f51 | 49 | SUBS pc, lr, #4 |
bogdanm | 13:0645d8841f51 | 50 | __mbed_swi: |
bogdanm | 13:0645d8841f51 | 51 | STMFD sp!, {a4, r4, ip, lr} |
bogdanm | 20:4263a77256ae | 52 | |
bogdanm | 13:0645d8841f51 | 53 | LDR r4, =0x40000040 |
bogdanm | 20:4263a77256ae | 54 | |
bogdanm | 13:0645d8841f51 | 55 | LDR a4, =0x00940000 |
bogdanm | 13:0645d8841f51 | 56 | LDR PC, =0x7ffff820 |
bogdanm | 13:0645d8841f51 | 57 | __mbed_dcc_irq: |
bogdanm | 13:0645d8841f51 | 58 | LDMFD sp!,{r0-r3,r12,lr} |
bogdanm | 20:4263a77256ae | 59 | |
bogdanm | 13:0645d8841f51 | 60 | MSR CPSR_c, #0x12|0x80|0x40 |
bogdanm | 20:4263a77256ae | 61 | |
bogdanm | 20:4263a77256ae | 62 | SUB lr, lr, #4 |
bogdanm | 20:4263a77256ae | 63 | STMFD sp!, {ip,lr} |
bogdanm | 20:4263a77256ae | 64 | |
bogdanm | 13:0645d8841f51 | 65 | LDR LR, =0xfffff000 |
bogdanm | 13:0645d8841f51 | 66 | STR LR, [LR, #0xf00] |
bogdanm | 20:4263a77256ae | 67 | |
bogdanm | 13:0645d8841f51 | 68 | LDR PC, =0x7fffffe0 |
bogdanm | 20:4263a77256ae | 69 | /* |
bogdanm | 20:4263a77256ae | 70 | __mbed_reset is called after reset |
bogdanm | 20:4263a77256ae | 71 | we setup the stacks and realmonitor, then call Reset_Handler like on M3 |
bogdanm | 20:4263a77256ae | 72 | */ |
bogdanm | 13:0645d8841f51 | 73 | |
bogdanm | 20:4263a77256ae | 74 | .section .text, "ax" |
bogdanm | 20:4263a77256ae | 75 | .arm |
bogdanm | 20:4263a77256ae | 76 | .global Reset_handler |
bogdanm | 20:4263a77256ae | 77 | Reset_Handler: |
bogdanm | 20:4263a77256ae | 78 | .extern __libc_init_array |
bogdanm | 20:4263a77256ae | 79 | .extern SystemInit |
bogdanm | 20:4263a77256ae | 80 | .extern __wrap_main |
bogdanm | 20:4263a77256ae | 81 | LDR R0, =SystemInit |
bogdanm | 20:4263a77256ae | 82 | MOV LR, PC |
bogdanm | 20:4263a77256ae | 83 | BX R0 |
bogdanm | 13:0645d8841f51 | 84 | |
bogdanm | 20:4263a77256ae | 85 | LDR R0, =__libc_init_array |
bogdanm | 20:4263a77256ae | 86 | MOV LR, PC |
bogdanm | 20:4263a77256ae | 87 | BX R0 |
bogdanm | 13:0645d8841f51 | 88 | |
bogdanm | 20:4263a77256ae | 89 | LDR R0, =__wrap_main |
bogdanm | 20:4263a77256ae | 90 | BX R0 |
bogdanm | 13:0645d8841f51 | 91 | |
bogdanm | 20:4263a77256ae | 92 | __mbed_reset: |
bogdanm | 20:4263a77256ae | 93 | LDR R0, =( __SRAM_segment_end__ ) |
bogdanm | 20:4263a77256ae | 94 | |
bogdanm | 13:0645d8841f51 | 95 | MSR CPSR_c, #0x1B|0x80|0x40 |
bogdanm | 13:0645d8841f51 | 96 | MOV SP, R0 |
bogdanm | 13:0645d8841f51 | 97 | SUB R0, R0, #0x00000040 |
bogdanm | 20:4263a77256ae | 98 | |
bogdanm | 13:0645d8841f51 | 99 | MSR CPSR_c, #0x17|0x80|0x40 |
bogdanm | 13:0645d8841f51 | 100 | MOV SP, R0 |
bogdanm | 13:0645d8841f51 | 101 | SUB R0, R0, #0x00000040 |
bogdanm | 20:4263a77256ae | 102 | |
bogdanm | 13:0645d8841f51 | 103 | MSR CPSR_c, #0x11|0x80|0x40 |
bogdanm | 13:0645d8841f51 | 104 | MOV SP, R0 |
bogdanm | 13:0645d8841f51 | 105 | SUB R0, R0, #0x00000000 |
bogdanm | 20:4263a77256ae | 106 | |
bogdanm | 13:0645d8841f51 | 107 | MSR CPSR_c, #0x12|0x80|0x40 |
bogdanm | 13:0645d8841f51 | 108 | MOV SP, R0 |
bogdanm | 13:0645d8841f51 | 109 | SUB R0, R0, #0x00000040 |
bogdanm | 20:4263a77256ae | 110 | |
bogdanm | 13:0645d8841f51 | 111 | MSR CPSR_c, #0x13|0x80|0x40 |
bogdanm | 13:0645d8841f51 | 112 | MOV SP, R0 |
bogdanm | 13:0645d8841f51 | 113 | SUB R0, R0, #0x00000040 |
bogdanm | 20:4263a77256ae | 114 | |
bogdanm | 13:0645d8841f51 | 115 | MSR CPSR_c, #0x10 |
bogdanm | 13:0645d8841f51 | 116 | MOV SP, R0 |
bogdanm | 20:4263a77256ae | 117 | |
bogdanm | 20:4263a77256ae | 118 | /* Relocate .data section (Copy from ROM to RAM) */ |
bogdanm | 20:4263a77256ae | 119 | LDR R1, =__text_end__ /* _etext */ |
bogdanm | 20:4263a77256ae | 120 | LDR R2, =__data_start__ /* _data */ |
bogdanm | 20:4263a77256ae | 121 | LDR R3, =__data_end__ /* _edata */ |
bogdanm | 20:4263a77256ae | 122 | CMP R2, R3 |
bogdanm | 20:4263a77256ae | 123 | BEQ DataIsEmpty |
bogdanm | 20:4263a77256ae | 124 | LoopRel: CMP R2, R3 |
bogdanm | 20:4263a77256ae | 125 | LDRLO R0, [R1], #4 |
bogdanm | 20:4263a77256ae | 126 | STRLO R0, [R2], #4 |
bogdanm | 20:4263a77256ae | 127 | BLO LoopRel |
bogdanm | 20:4263a77256ae | 128 | DataIsEmpty: |
bogdanm | 13:0645d8841f51 | 129 | |
bogdanm | 20:4263a77256ae | 130 | /* Clear .bss section (Zero init) */ |
bogdanm | 20:4263a77256ae | 131 | MOV R0, #0 |
bogdanm | 20:4263a77256ae | 132 | LDR R1, =__bss_start__ |
bogdanm | 20:4263a77256ae | 133 | LDR R2, =__bss_end__ |
bogdanm | 20:4263a77256ae | 134 | CMP R1,R2 |
bogdanm | 20:4263a77256ae | 135 | BEQ BSSIsEmpty |
bogdanm | 20:4263a77256ae | 136 | LoopZI: CMP R1, R2 |
bogdanm | 20:4263a77256ae | 137 | STRLO R0, [R1], #4 |
bogdanm | 20:4263a77256ae | 138 | BLO LoopZI |
bogdanm | 20:4263a77256ae | 139 | BSSIsEmpty: |
bogdanm | 20:4263a77256ae | 140 | |
bogdanm | 20:4263a77256ae | 141 | |
bogdanm | 20:4263a77256ae | 142 | /* Init realmonitor */ |
bogdanm | 13:0645d8841f51 | 143 | LDR R0, =__mbed_init_realmonitor |
bogdanm | 13:0645d8841f51 | 144 | MOV LR, PC |
bogdanm | 13:0645d8841f51 | 145 | BX R0 |
bogdanm | 20:4263a77256ae | 146 | |
bogdanm | 20:4263a77256ae | 147 | /* Go to Reset_Handler */ |
bogdanm | 20:4263a77256ae | 148 | LDR R0, =Reset_Handler |
bogdanm | 13:0645d8841f51 | 149 | BX R0 |