1
votes

2.3.4. Vector table

The vector table contains the reset value of the stack pointer, and the start addresses, also called exception vectors, for all exception handlers. Figure 2.2 shows the order of the exception vectors in the vector table. The least-significant bit of each vector must be 1, indicating that the exception handler is Thumb code, see Thumb state.

That totaly confused me, i defined my vectors like this:

vector_table:
.word _estack 
.word Reset_Handler  
.word Hard_Fault

and my reset handler ends up at 0x8000020 <Reset_Handler>: so LSB is 0. but my processor runs it perfectly. I am using cortex m7.

1
Yes your handler is at even address, but the entry in the table should have the LSB set. Probably done automatically by your assembler since it knows the function is thumb mode. Check the hexdump of the vector table. - Jester
00010000 00 00 04 20 21 00 00 08, yes indeed. i never used hexdump, not that advanced but managed to figure out where it was. thanks for your help - Anton Stafeyev
@Jester and so marking .type %function will actually add LSB, and if i dont specify to compiler that this label is a functiont hen it wont i guess ? - Anton Stafeyev

1 Answers

2
votes

Compiler does this automatically. aftet Jester's suggestion, i looked at hexdump and found that it was modified from 0x0800 0020 to 0x0800 0021

However if global symbol wasnt defined as .tpye foo, %function or .thumb_func compiler will not modify its value and it will result in a hard fault since cortex m7 only supports thumb instruction set.