diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2015-12-18 23:06:46 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2015-12-18 23:06:46 +0100 |
commit | 6d27f1755b782340d1c55c3f8f01a193514a3607 (patch) | |
tree | 40751b5d17d54ab69b2aaa44715d3889306a54b8 /init_low.s | |
parent | 62766425fe3a552440228c78f13a2c1dd62e228b (diff) | |
download | stm32f103-playground-6d27f1755b782340d1c55c3f8f01a193514a3607.tar.gz stm32f103-playground-6d27f1755b782340d1c55c3f8f01a193514a3607.tar.bz2 stm32f103-playground-6d27f1755b782340d1c55c3f8f01a193514a3607.tar.xz stm32f103-playground-6d27f1755b782340d1c55c3f8f01a193514a3607.zip |
o Splitting out init from main.
Diffstat (limited to 'init_low.s')
-rw-r--r-- | init_low.s | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/init_low.s b/init_low.s new file mode 100644 index 0000000..bd7f329 --- /dev/null +++ b/init_low.s @@ -0,0 +1,69 @@ +/* +https://github.com/dwelch67/stm32_samples +http://stackoverflow.com/questions/9565921/cortex-m3-initialisation +*/ + +.syntax unified +.cpu cortex-m3 +.thumb + +.section .isr_vectors + +.global vectors +vectors: +stacktop: .word 0x20001000 +.word _Reset_Handler +.word NMI_Handler +.word HardFault_Handler +.word MemManage_Handler +.word BusFault_Handler +.word UsageFault_Handler +.word halt +.word halt +.word halt +.word halt +.word halt +.word halt +.word halt +.word halt +.word halt + +/* VERY significant */ +.section .text + +.thumb_func +.global _Reset_Handler +_Reset_Handler: + bl init_high + b halt + +.thumb_func +.global halt +halt: + b . + +.thumb_func +NMI_Handler: + b halt + +.thumb_func +HardFault_Handler: + tst lr, #4 + ite eq + mrseq r0, msp + mrsne r0, psp + b HardFault_Handler_C + +.thumb_func +MemManage_Handler: + b halt + +.thumb_func +BusFault_Handler: + b halt + +.thumb_func +UsageFault_Handler: + b halt + +.end |