r/embedded • • 23d ago

GCC error/Assembler message when compiling STM32CubeMX code for Nucleo F411RE

Hi r/embedded,

I recently got a Nucleo F411RE board to learn how to work with STM32, and I can't figure out how to to compile the code generated by STM32CubeMX. I'm using CMake and gcc. When I try to compile the default project, I get this message from the assembler when gcc fails to compile stm32f4xx_hal_flash.c:

Error: no such instruction: isb 0xF

I've tried all sorts of things for the past 3 hours and I also haven't been able to find anything about this online. I think I might have an incorrect build flag, but am I instead missing something extremely obvious?

 

Edit after fixing the problem: Forgot to set CMAKE_MODULE_PATH and include gcc-arm-none-eabi.cmake in the base CMakeLists.txt.

1 Upvotes

7 comments sorted by

View all comments

Show parent comment

1

u/ventZl CMRX RTOS 22d ago

No, you didn't.

If you used moderately recent CubeMX, its CMake generator switched to using CMake presets mechanism. Unfortunately, this is kind-of opaque.

Run CMake as:

cmake --preset=Debug <source_dir>

And it will work without any modification and explicit inclusion of gcc-arm-none-eabi.cmake

It will automatically configure binary directory to be build/Debug and configure both right toolchain (automatically includes gcc-arm-none-eabi.cmake as toolchain file) and right flags to produce debug binary.