2025-05-13 12:13 AM
I am trying to deploy an AI model on the STM32N6570-DK board. And I followed these steps:
1. Open the STM32CUBEMX, choose the secure only mode, activate X-CUBE-AI, and click the FSBL, choose the application template choice.
2. click the RIF
3. choose the onnx and NeuralART runtime, and upload the onnx model
4. The rest configurations are: profile:n6-allmem-O3; validation inputs:processed_features_reshaped.npy; validation outputs:processed_labels_oneshot.npy(these two npy files are the train set of the model, one input and one output)
5. use cubeIDE to generate the code.
6. move the middleware to FSBL and modify the include path and the .a path
When I compile the generated code, there are some errors and warnings, I am wondering how I can deal with these errors.
The errors are listed below:
arm-none-eabi-gcc -o "AIN6_FSBL.elf" @"objects.list" -l:NetworkRuntime1000_CM55_GCC.a -mcpu=cortex-m55 -T"D:\projForSTM32\AIN6\FSBL\STM32N657X0HXQ_AXISRAM2_fsbl.ld" --specs=nosys.specs -Wl,-Map="AIN6_FSBL.map" -Wl,--gc-sections -static -Wl,--cmse-implib -Wl,--out-implib=./secure_nsclib.o -L../../Middlewares/ST/AI/Lib --specs=nano.specs -mfpu=fpv5-d16 -mfloat-abi=hard -mthumb -Wl,--start-group -lc -lm -Wl,--end-group
D:/ST/STM32CubeIDE_1.18.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: ./X-CUBE-AI/App/app_x-cube-ai.o: in function `MX_X_CUBE_AI_Init':
D:/projForSTM32/AIN6/FSBL/Debug/../X-CUBE-AI/App/app_x-cube-ai.c:105:(.text.MX_X_CUBE_AI_Init+0x48): undefined reference to `npu_cache_init'
D:/ST/STM32CubeIDE_1.18.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: ./X-CUBE-AI/App/app_x-cube-ai.o: in function `MX_X_CUBE_AI_Process':
D:/projForSTM32/AIN6/FSBL/Debug/../X-CUBE-AI/App/app_x-cube-ai.c:118:(.text.MX_X_CUBE_AI_Process+0x2e): undefined reference to `LL_ATON_RT_RuntimeInit'
D:/ST/STM32CubeIDE_1.18.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: D:/projForSTM32/AIN6/FSBL/Debug/../X-CUBE-AI/App/app_x-cube-ai.c:127:(.text.MX_X_CUBE_AI_Process+0x3a): undefined reference to `LL_ATON_RT_Init_Network'
D:/ST/STM32CubeIDE_1.18.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: D:/projForSTM32/AIN6/FSBL/Debug/../X-CUBE-AI/App/app_x-cube-ai.c:130:(.text.MX_X_CUBE_AI_Process+0x40): undefined reference to `LL_ATON_RT_RunEpochBlock'
D:/ST/STM32CubeIDE_1.18.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: D:/projForSTM32/AIN6/FSBL/Debug/../X-CUBE-AI/App/app_x-cube-ai.c:139:(.text.MX_X_CUBE_AI_Process+0x58): undefined reference to `LL_ATON_RT_DeInit_Network'
D:/ST/STM32CubeIDE_1.18.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: D:/projForSTM32/AIN6/FSBL/Debug/../X-CUBE-AI/App/app_x-cube-ai.c:144:(.text.MX_X_CUBE_AI_Process+0x68): undefined reference to `LL_ATON_RT_RuntimeDeInit'
D:/ST/STM32CubeIDE_1.18.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: ./X-CUBE-AI/App/network.o: in function `LL_ATON_End_EpochBlock_2':
D:/projForSTM32/AIN6/FSBL/Debug/../X-CUBE-AI/App/network.c:179:(.text.LL_ATON_End_EpochBlock_2+0x1ea): undefined reference to `ll_sw_forward_conv'
D:/ST/STM32CubeIDE_1.18.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: D:/projForSTM32/AIN6/FSBL/Debug/../X-CUBE-AI/App/network.c:188:(.text.LL_ATON_End_EpochBlock_2+0x1f2): undefined reference to `mcu_cache_clean_range'
D:/ST/STM32CubeIDE_1.18.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: ./X-CUBE-AI/App/network.o: in function `LL_ATON_End_EpochBlock_3':
D:/projForSTM32/AIN6/FSBL/Debug/../X-CUBE-AI/App/network.c:248:(.text.LL_ATON_End_EpochBlock_3+0xc4): undefined reference to `ll_sw_forward_arith'
D:/ST/STM32CubeIDE_1.18.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: D:/projForSTM32/AIN6/FSBL/Debug/../X-CUBE-AI/App/network.c:257:(.text.LL_ATON_End_EpochBlock_3+0xcc): undefined reference to `mcu_cache_clean_range'
D:/ST/STM32CubeIDE_1.18.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: ./X-CUBE-AI/App/network.o: in function `LL_ATON_End_EpochBlock_5':
D:/projForSTM32/AIN6/FSBL/Debug/../X-CUBE-AI/App/network.c:307:(.text.LL_ATON_End_EpochBlock_5+0x86): undefined reference to `ll_sw_forward_activ'
D:/ST/STM32CubeIDE_1.18.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: D:/projForSTM32/AIN6/FSBL/Debug/../X-CUBE-AI/App/network.c:316:(.text.LL_ATON_End_EpochBlock_5+0x8e): undefined reference to `mcu_cache_clean_range'
D:/ST/STM32CubeIDE_1.18.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: ./X-CUBE-AI/App/network.o: in function `LL_ATON_End_EpochBlock_7':
D:/projForSTM32/AIN6/FSBL/Debug/../X-CUBE-AI/App/network.c:383:(.text.LL_ATON_End_EpochBlock_7+0x1f8): undefined reference to `ll_sw_forward_conv'
D:/ST/STM32CubeIDE_1.18.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: D:/projForSTM32/AIN6/FSBL/Debug/../X-CUBE-AI/App/network.c:392:(.text.LL_ATON_End_EpochBlock_7+0x200): undefined reference to `mcu_cache_clean_range'
D:/ST/STM32CubeIDE_1.18.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: ./X-CUBE-AI/App/network.o: in function `LL_ATON_End_EpochBlock_8':
D:/projForSTM32/AIN6/FSBL/Debug/../X-CUBE-AI/App/network.c:452:(.text.LL_ATON_End_EpochBlock_8+0xb8): undefined reference to `ll_sw_forward_arith'
D:/ST/STM32CubeIDE_1.18.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: D:/projForSTM32/AIN6/FSBL/Debug/../X-CUBE-AI/App/network.c:461:(.text.LL_ATON_End_EpochBlock_8+0xc0): undefined reference to `mcu_cache_clean_range'
D:/ST/STM32CubeIDE_1.18.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: ./X-CUBE-AI/App/network.o: in function `LL_ATON_End_EpochBlock_10':
D:/projForSTM32/AIN6/FSBL/Debug/../X-CUBE-AI/App/network.c:511:(.text.LL_ATON_End_EpochBlock_10+0x7e): undefined reference to `ll_sw_forward_activ'
D:/ST/STM32CubeIDE_1.18.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: D:/projForSTM32/AIN6/FSBL/Debug/../X-CUBE-AI/App/network.c:520:(.text.LL_ATON_End_EpochBlock_10+0x86): undefined reference to `mcu_cache_clean_range'
D:/ST/STM32CubeIDE_1.18.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: ./X-CUBE-AI/App/network.o: in function `LL_ATON_End_EpochBlock_12':
D:/projForSTM32/AIN6/FSBL/Debug/../X-CUBE-AI/App/network.c:543:(.text.LL_ATON_End_EpochBlock_12+0x14): undefined reference to `mcu_cache_invalidate_range'
D:/ST/STM32CubeIDE_1.18.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: D:/projForSTM32/AIN6/FSBL/Debug/../X-CUBE-AI/App/network.c:601:(.text.LL_ATON_End_EpochBlock_12+0x1f2): undefined reference to `ll_sw_forward_conv'
D:/ST/STM32CubeIDE_1.18.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: D:/projForSTM32/AIN6/FSBL/Debug/../X-CUBE-AI/App/network.c:610:(.text.LL_ATON_End_EpochBlock_12+0x1fa): undefined reference to `mcu_cache_clean_range'
D:/ST/STM32CubeIDE_1.18.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: ./X-CUBE-AI/App/network.o: in function `LL_ATON_End_EpochBlock_13':
D:/projForSTM32/AIN6/FSBL/Debug/../X-CUBE-AI/App/network.c:631:(.text.LL_ATON_End_EpochBlock_13+0xc): undefined reference to `mcu_cache_invalidate_range'
D:/ST/STM32CubeIDE_1.18.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: D:/projForSTM32/AIN6/FSBL/Debug/../X-CUBE-AI/App/network.c:684:(.text.LL_ATON_End_EpochBlock_13+0xae): undefined reference to `ll_sw_forward_arith'
D:/ST/STM32CubeIDE_1.18.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: D:/projForSTM32/AIN6/FSBL/Debug/../X-CUBE-AI/App/network.c:693:(.text.LL_ATON_End_EpochBlock_13+0xb6): undefined reference to `mcu_cache_clean_range'
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:68: AIN6_FSBL.elf] Error 1
2025-05-16 1:30 AM
Hello @Z-YF ,
The error "Undefined reference" is due to your linker not being able to correctly retrieve the sources. Both LL and MCU Cache functions are implemented in the AI Middleware package whose NPU folder you can find externally to the FSBL CubeIDE project, as shown in the image below.
To fix this problem, you can add these folders inside the FSBL project. Don't import the whole Middleware folder. Add only the sources (.c) from "Devices" and from "ll_aton" as new folders. You can do these by right clicking on FSBL and selecting "Import". Then under "General" you go on to "File System". Then you should import both the directories shown in image above. Make sure to filter file types on "Filter Types" in order to only import the sources.
Don't forget to set these newly imported folders as source paths. To do so, right click and go on "Properties". On "Properties", go on "C/C++ General" and then "Paths and Symbols". Under "Source Location", add both the "ll_aton" and the "Devices" folders. You should now note this blue "c" icon on top of the folder, as it is already in the previous image.
I've done it for Appli because mine is a LRUN project. Just do yours in FSBL. This should fix your errors.
Best regards,
Pedro.