Skip to main content
Associate III
June 9, 2026
Solved

STM32N6570-DK SD Card Error

  • June 9, 2026
  • 4 replies
  • 158 views

Hello,

I have completed this guide successfully:
How to integrate TouchGFX and camera middleware on an STM32N6570-DK 

However, I am running into an issue when I try to add SDMMC2 or ETH in the .ioc.  After I generate code then build in the IDE, I get the below error:
 

C://TouchGFXProjects/VisionControlboard2/FSBL/Core/Src/main.c:334:(.text.startup.main+0x12c): undefined reference to `HAL_SD_Init'
C:/ST/STM32CubeIDE_2.0.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.14.3.rel1.win32_1.0.100.202602081740/tools/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/bin/ld.exe: (HAL_SD_Init): Unknown destination type (ARM/Thumb) in ./Application/User/Core/main.o
C://TouchGFXProjects/VisionControlboard2/FSBL/Core/Src/main.c:334:(.text.startup.main+0x12c): dangerous relocation: unsupported relocation


Project in link below:
https://app.box.com/s/bdbyzi5eqvqhgib90klxgehmhs8pkyns

What is the best method to get this resolved?  I am using STM32CubeIDE Version 2.1.1, CubeMX Version 6.17.0

Thank you
 

Best answer by Cococarbine

@Cococarbine 

A better method I have found is to:

  1. Clean FSBL and Appli projects.
  2. Delete all nested projects from STM32CubeIDE (but not from the file system).
  3. Close STM32CubeIDE.
  4. Update .ioc then Generate Code.  When prompt opens, click Open Project in STM32CubeIDE
  5. FSBL and Appli should be able to build without error now.

4 replies

ST Technical Moderator
June 11, 2026

Hello ​@Cococarbine 

Is HAL_SD_MODULE_ENABLED present in stm32n6xx_hal_conf.h?

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Saket_Om
Associate III
June 11, 2026

Hi Saket,

The HAL_SD_MODULE_ENABLED definition does enable when I check the SDMMC2 in the .ioc.



What I am finding is that the appropriate HAL drivers in the STM32N6xx_HAL_Driver folder (stm32n6xx_hal_sd.c, etc.) do not populate automatically when Generating Code after an STM IDE project has already been generated - I have to delete the STM32Cube IDE project entirely, then Generate Code from the .ioc to get the all the proper drivers loaded.  I confirmed this also happens with the Template_FSBL_LRUN template from the stm32cuben6-v1-3-0 FW as well.  In CubeMX Project Manager - Code Generator I also tried “Copy all used libraries into the project folder” option with no luck.

I can get by with this workaround for now, but it would be good in the long run to be able to enable certain hardware / middleware in the future without having to delete the STM32Cube IDE project.

Associate III
June 11, 2026

Edit: A simpler solution is to right click the Drivers/STM32N6xx_HAL_Driver folder for your FSBL & Appli and import the correct drivers manually from the file system.  This also works.  You can see the manually linked files below have a different icon: