Showing results for 
Search instead for 
Did you mean: 

STM32C0 (M0) via makefile: gcc throws "processor does not support `cpsid i' in Thumb mode"

Associate II

My goal is to have a build system that I can either use locally to program/debug but also would work for CI integration.

I am fairly new to ST environment but to me it seems something is going wrong with makefile generation.

  • I am using Windows 10, CubeIDE 1.11.2, CubeMX 6.8.0
  • I have configured the NUCLEO-C031C6 board through CubeMX.
  • I generated an CubeIDE project and added some blinky code -> everything works.
  • I removed the CubeIDE project files and generated a makefile through CubeMX
  • I installed make through chocolatey as forums advised and added its folder to "PATH"
  • I also set the ARM-GNU bin directory to GCC_PATH
  • In CubeIDE I created a makefile project and selected the project directory.

I am faced with the following assembler error though: "selected processor does not support `cpsid i' in Thumb mode".

This happens in the following situations:

  • either calling make from CubeIDE as from commandline
  • having GCC_PATH pointing to arm-gnu or to cubeide...externaltools...gnu-tools... plugin. (copied that out of program files though)

So it seems seems that either the makefile is not correct or gnu does not support this chip yet?

for completeness the gcc call (made by makefile) that throws the error:

C:\arm-gnu\12.2-rel1\bin/arm-none-eabi-gcc -c -mthumb  -DUSE_HAL_DRIVER -DSTM32C031xx -ICore/Inc -IC:/Users/HansW/STM32Cube/Repository/STM32Cube_FW_C0_V1.0.1/Drivers/STM32C0xx_HAL_Driver/Inc -IC:/Users/HansW/STM32Cube/Repository/STM32Cube_FW_C0_V1.0.1/Drivers/STM32C0xx_HAL_Driver/Inc/Legacy -IC:/Users/HansW/STM32Cube/Repository/STM32Cube_FW_C0_V1.0.1/Drivers/CMSIS/Device/ST/STM32C0xx/Include -IC:/Users/HansW/STM32Cube/Repository/STM32Cube_FW_C0_V1.0.1/Drivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/main.d" -Wa,-a,-ad,-alms=build/main.lst Core/Src/main.c -o build/main.o

Pavel A.
Evangelist III

For CI integration you could very well use the CubeIDE in "headless" mode and save all the self-inflicted wounds.

Please check the command line from Cube-generated eclipse project, make sure that all relevant options are present in your makefile. Looks like some -m option is missing.

If the problem persists, use one or ARM or (STM32) toolchains available from CubeIDE toolchain manager, these support STM32C0 for sure. Recently ST also released a command line toolset.

Associate II

Generally you do not want to use a vendor IDE as CI tool; make and the arm-gnu tools should be enough.

If a flag is missing that still means that CubeMX is not generating a correct Makefile which is a bug.

I will switch back to CubeIDE project for now anyhow but do not have the time (right now, anymore) to deep dive into the eclipse calls, that has to come later.


> CubeMX is not generating a correct Makefile which is a bug

Yes, this was already reported IIRC.

Associate II

Thank you, I did not know that.

I changed MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)

to MCU = -mcpu=cortex-m0plus

in the Makefile and that did the trick.

FYI: building with arm-gnu\12.2-rel1 throws the following 4 errors:

closer.c:(.text._close_r+0xc): warning: _close is not implemented and will always fail

lseekr.c:(.text._lseek_r+0x10): warning: _lseek is not implemented and will always fail

readr.c:(.text._read_r+0x10): warning: _read is not implemented and will always fail

writer.c:(.text._write_r+0x10): warning: _write is not implemented and will always fail

using the st32cube plugin version works fine, so I will go with that one for now.

Thank you for the help and hope CubeMX gets fixed soon and gnu gets support for the above 4 issues as well.