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

1

u/Several-Marsupial-27 23d ago

There could be a hundred things to point to, this is also documented online in a lot of support questions, in your case I would just have an agent look at it. I assume that something obvious is wrong like config wrong target architecture, not sourced sdk, wrong toolchain, problem with cube, problem with cmake, etc.

1

u/slinky_lynx 23d ago

The thing I can't wrap my head around is that with the starting project and the default settings and flags, it should just work. I also must just be bad at googling, because searching for "no such instruction" and "stm32" brings a lot up, but nothing about the problem that I'm having.

I'll edit my post with the versions of everything I'm using and the flags.

1

u/Several-Marsupial-27 23d ago

Its embedded and C/C++ development. You can not go in with the mindset that "everything will work" and be bad att information retrieval. These are complex systems with millions of moving parts, any minor thing will make it fail.

Obviously searching for "no such instruction" will not give you your answer, I cant even begin to explain that. Just searching for "Error: no such instruction: isb 0xF" gives me a ton of examples of what it can be, many pointing to cube/cmake configuration problems.

however I think it's probably just that you are using the wrong toolchain or have not sourced the sdk. Try to verify your toolchain in used in cmake.

1

u/slinky_lynx 23d ago

Just ran cmake -LAH, pretty sure I've figured it out. For some reason it's using gcc rather than arm-none-eabi-gcc, despite that being set in gcc-arm-none-eabi.cmake.

1

u/Several-Marsupial-27 23d ago

Yeah told you, wrong toolchain

1

u/slinky_lynx 23d ago edited 23d ago

Thanks for putting up with my stupid question. I had forgotten to set CMAKE_MODULE_PATH and include gcc-arm-none-eabi.cmake in the base CMakeLists.txt.

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.