cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CUBEIDE Nested Project Library Path Problem

erhangk
Associate

I am working on X-CUBE-AZURE in B-U585I-IOT02A board. My IDE version is 1.18 and i am using Fedora 41. When i enable FDCAN peripheral in CubeMX it places the stm32u5xx_hal_fdcan.c and .h file into the X-CUBE-AZURE/Drivers/STM32U5xx_HAL_Driver/Src. Even though it places the correct .c and .h files the build fails when i enable FDCAN from CubeMX. Here is the build error message.

/home/erhangok/Documents/GitHub/IOT_Node_Azure_v01fw/Projects/B-U585I-IOT02A/Applications/NetXDuo/Nx_Azure_IoT/Core/Src/main.c:357:(.text.MX_FDCAN1_Init+0x72): undefined reference to `HAL_FDCAN_Init'
collect2: error: ld returned 1 exit status
make: *** [makefile:104: Nx_Azure_IoT.elf] Error 1
"make -j8 all" terminated with exit code 2. Build might be incomplete.

15:41:47 Build Failed. 2 errors, 478 warnings. (took 19s.801ms)

Even though the file exists in Drivers/STM32U5xx_HAL_Driver it still cannot find it. When i look further into this i saw that subdir.mk file does not contain this line: "./Drivers/STM32U5xx_HAL_Driver/stm32u5xx_hal_fdcan.o \". Furthermore in the project explorer tab -> stm32u5xx_hal_fdcan.c -> Properties, it says the location does not exist and the resolved location points in the wrong location. Instead it points to "/Projects/B-U585I-IOT02A/Applications/NetXDuo/Nx_Azure_IoT/STM32CubeIDE/Drivers/STM32U5xx_HAL_Driver/stm32u5xx_hal_fdcan.c - (does not exist)" which the folder is empty. I do not quite understand the structure of this project since it is a nested project. There are two Drivers and Middlewares folders in the project, one is in the main location of the project and the other one is inside Projects/B-U585I-IOT02A/Applications/NetXDuo/Nx_Azure_IoT/STM32CubeIDE/Debug/Drivers/. I found out about this while the comparing the subdir.mk makefile in Windows build and Fedora build. This project builds successfully when FDCAN is enabled through CubeMX.

Screenshot From 2025-03-24 15-45-00.pngCan someone help me about this problem? I could change the file location manually but i believe the same problem will occur again if i enable another peripheral and it will still point to the wrong location thus it will not build and fail.

0 REPLIES 0