cancel
Showing results for 
Search instead for 
Did you mean: 

Code 16 and Code 32 on STM32F103C8T6

JerryMC22
Associate II

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.

 

20 REPLIES 20

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