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
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.