Error: lo register required -- 'ldmia r0!, {r4-r11} and Thumb mode

I am compiling a project with the cpu MK40DX64VLH7 in KDS (Kinetis Design Studio).

I have the following Error message, can you help me resolving it please ?

Finished building: …/Generated_Code/mpu_wrappers.c

Building file: …/Generated_Code/port.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=cortex-m0plus -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -g3 -DNEW_M2S_CTRL -

I"C:/Users/RS01/Documents/Projects_M2S/Logiciel_M2S/CHU15 - VENMAR_MK40DX64VLH7/CHU15 - TEMPLATE…/…/SVN - CHU15 - VENMAR/Sources" -std=c99 -MMD -MP -MF"Generated_Code/port.d" -MT"Generated_Code/port.o" -c -o “Generated_Code/port.o” “…/Generated_Code/port.c”

C:\Users\RS01\AppData\Local\Temp\ccDjyF3Y.s: Assembler messages:

C:\Users\RS01\AppData\Local\Temp\ccDjyF3Y.s:665: Error: lo register required – `ldmia r0!,{r4-r11}’

C:\Users\RS01\AppData\Local\Temp\ccDjyF3Y.s:669: Error: unshifted register required – `orr r14,r14,#13

C:\Users\RS01\AppData\Local\Temp\ccDjyF3Y.s:703: Error: selected processor does not support `stmdb r0!,{r4-r11}’ in Thumb mode

C:\Users\RS01\AppData\Local\Temp\ccDjyF3Y.s:705: Error: selected processor does not support `stmdb sp!,{r3,r14}’ in Thumb mode

C:\Users\RS01\AppData\Local\Temp\ccDjyF3Y.s:711: Error: lo register required – `ldmia sp!,{r3,r14}’

C:\Users\RS01\AppData\Local\Temp\ccDjyF3Y.s:714: Error: lo register required – `ldmia r0!,{r4-r11}’

Generated_Code/ recipe for target ‘Generated_Code/port.o’ failed
make: *** [Generated_Code/port.o] Error 1

14:59:32 Build Finished (took 27s.826ms)


Hi Richard,

Looks like the code you are compiling is for a Cortex M4, which matches your MCU correctly, but the compiler switches indicate Cortex M0+. So the -mcpu=cortex-m0plus isn’t right.