2025-02-10 06:28 AM
Hi,
Can someone explain me why I have to use "+1" in vector table of STM32F103C8T6:
vectors:
.word STACKINIT @ stack pointer
.word _start + 1 @ reset vector
.word _nmi_handler + 1 @
.word _hard_fault + 1 @
.word _memory_fault + 1 @
.word _bus_fault + 1 @
.word _usage_fault + 1 @
instead of:
.word STACKINIT @ stack pointer
.word _start @ reset vector
.word _nmi_handler @
.word _hard_fault @
.word _memory_fault @
.word _bus_fault @
.word _usage_fault @
I thought that STM32F103C8T6 is 32bit processor and thus I can use:
.code 32
.cpu cortex-m3
.syntax unified
But it is NOT true. I can use only THUMB (code 16) instructions.
2025-02-12 11:22 PM
I finally found interesting solution - see below, it is possible to fix the reset handler address as e.g. 0x301 and reset handler place to .org 0x300 :) cute solution
@@@ Vectors
vectors:
.word STACKINIT @ stack pointer value when stack is empty
.word 0x301 @Reset_Handler @ reset vector (manually adjust to odd for thumb)
.word _nmi_handler @
.word _hard_fault @
.word _memory_fault @
.word _bus_fault @
.word _usage_fault @
.org 0x300
Reset_Handler:
ldr sp, =STACKINIT