This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

M4 fall into HardFault while running program compiled by arm-none-eabi-gcc (10.3.1)with -thumb -mcpu=cortex-M4 -march=armV7e-m

I try compile a paromgran with cmsis 5.8  for cortex-m4 by arm-none-eabi-gcc (10.3.1) with options " -g -O0 -mthumb -mcpu=cortex-M4 -march=armV7e-m  --specs=nosys.specs --specs=nano.specs ". But the program falll into HardFault handler. because that  in _libc_init_array session , there is  :

    ldr.w     r3, [r5], #4

    blx    r3

but   r3  is  0x0 ,  causes the cpu taking the  __StackTop as an instrunction.

And it is very confusing that if I use  '-march=armV7-m  -mtune=cortex-M4' instead of '-mcpu=cortex-M4 -march=armV7e-m ',it seems to be ok.