I wrote (IMO) almost simpliest ARM application and it didn't work :) What could be wrong? What is missed?
After flash write and CPU reset there are garbage in registers.
Please, be kind and if U know, tell me what has to be done to run simplest application on STM32F1.
May be someone coud enumerate what has to be done before application starts, ie.
The application:
@Directives
.thumb @.code 16
.syntax unified
.section .text
.org 0 @ Alters location of pointer - in this case set to zero
vectors: @ Define basic vectors for specific capabilities
.word _start + 1 @ Set - start address and increment pointer
.word _nmi_handler + 1 @ Below all other vectors will be declared:
.word _hard_fault + 1
.word _memory_fault + 1
.word _bus_fault + 1
.word _usage_fault + 1
_start:
mov r0, #5
mov r1, #4
add r2, r0, r1
_nmi_handler:
_hard_fault:
_memory_fault:
_bus_fault:
_usage_fault:
Maybe someone know any tutorials or books, about linker scripts, cpu initialisation etc.?
The processor is: STM32F103VBT6
Programmed by: OpenOCD.
Thanks in advance.
From the M3 documentation;
The vector table at location 0 is only required to have four values:
Stack top address
Reset routine location
NMI ISR location
Hard Fault ISR location.
The stack top address should be at address 0, seems you're missing it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With