Hi Pouya,
1. It took me a while to figure this out but it's really simple. We can find in startup_cm7.s:
.thumb
.thumb_func
.globl Reset_Handler
.globl _start
_start:
Reset_Handler:
/*****************************************************/
/* Skip normal entry point as nothing is initialized */
/*****************************************************/
cpsid i
mov r0, #0
mov r1, #0
...
At first sight, it seems to be ok, nothing to be afraid of. But there are two labels at one place:
_start:
Reset_Handler:
And the issue is that .thumb_func affects only one following symbol, not symbols. So, .thumb_func only says here that _start will be thumb function, not the Reset_Handler. We would need to use:
.thumb
.thumb_func
.globl Reset_Handler
.globl _start
_start:
.thumb_func
Reset_Handler:
Then the "+1" would not be needed in the vector table. Someone just obviously used that as workaround. But I can see no problem here, this will also work as expected.
2. I did quick test and I can reach the hard fault. How did you tested it? Notice that when you load new project to MCU by debugger, the debugger will sets program counter manually at this moment at entry point / reset_handler of application. You need to reset the device to see the effect.
Regards,
Lukas