Skip to main content
Associate III
May 21, 2025
Question

stm32n6 using cubeai to train its model; compilation fails: `.rodata' will not fit in region `ROM'

  • May 21, 2025
  • 1 reply
  • 515 views

Hello
I trained handwritten digits using Keras, and then used cubeai of cubeMX to train and deploy, and then there was an error when compiling. Do you know how to solve it?

16:20:25 **** Incremental Build of configuration Debug for project stm32N6_hand02_FSBL ****

make -j8 all

arm-none-eabi-gcc -o "stm32N6_hand02_FSBL.elf" @"objects.list" -l:NetworkRuntime1000_CM55_GCC.a -mcpu=cortex-m55 -T"E:\07_Stm32\stm32u575\stm32N6_hand02\FSBL\STM32N657X0HXQ_AXISRAM2_fsbl.ld" --specs=nosys.specs -Wl,-Map="stm32N6_hand02_FSBL.map" -Wl,--gc-sections -static -Wl,--cmse-implib -Wl,--out-implib=./secure_nsclib.o -L../../Middlewares/ST/AI/Lib -Wl,--wrap=malloc -Wl,--wrap=free -u _printf_float --specs=nano.specs -mfpu=fpv5-d16 -mfloat-abi=hard -mthumb -Wl,--start-group -lc -lm -Wl,--end-group

D:\15_STM32CubeIDE_1.18.0\stm32cubeide1.17\STM32CubeIDE_1.17.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.1.0.202410251130\tools\arm-none-eabi\bin\ld.exe: D:/15_STM32CubeIDE_1.18.0/stm32cubeide1.17/STM32CubeIDE_1.17.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.1.0.202410251130/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v8-m.main+dp/hard\libc_nano.a(libc_a-closer.o): in function `_close_r':

(.text._close_r+0xc): warning: _close is not implemented and will always fail

D:\15_STM32CubeIDE_1.18.0\stm32cubeide1.17\STM32CubeIDE_1.17.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.1.0.202410251130\tools\arm-none-eabi\bin\ld.exe: D:/15_STM32CubeIDE_1.18.0/stm32cubeide1.17/STM32CubeIDE_1.17.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.1.0.202410251130/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v8-m.main+dp/hard\libc_nano.a(libc_a-fstatr.o): in function `_fstat_r':

(.text._fstat_r+0xe): warning: _fstat is not implemented and will always fail

D:\15_STM32CubeIDE_1.18.0\stm32cubeide1.17\STM32CubeIDE_1.17.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.1.0.202410251130\tools\arm-none-eabi\bin\ld.exe: D:/15_STM32CubeIDE_1.18.0/stm32cubeide1.17/STM32CubeIDE_1.17.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.1.0.202410251130/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v8-m.main+dp/hard\libc_nano.a(libc_a-signalr.o): in function `_getpid_r':

(.text._getpid_r+0x0): warning: _getpid is not implemented and will always fail

D:\15_STM32CubeIDE_1.18.0\stm32cubeide1.17\STM32CubeIDE_1.17.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.1.0.202410251130\tools\arm-none-eabi\bin\ld.exe: D:/15_STM32CubeIDE_1.18.0/stm32cubeide1.17/STM32CubeIDE_1.17.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.1.0.202410251130/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v8-m.main+dp/hard\libc_nano.a(libc_a-isattyr.o): in function `_isatty_r':

(.text._isatty_r+0xc): warning: _isatty is not implemented and will always fail

D:\15_STM32CubeIDE_1.18.0\stm32cubeide1.17\STM32CubeIDE_1.17.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.1.0.202410251130\tools\arm-none-eabi\bin\ld.exe: D:/15_STM32CubeIDE_1.18.0/stm32cubeide1.17/STM32CubeIDE_1.17.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.1.0.202410251130/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v8-m.main+dp/hard\libc_nano.a(libc_a-signalr.o): in function `_kill_r':

(.text._kill_r+0xe): warning: _kill is not implemented and will always fail

D:\15_STM32CubeIDE_1.18.0\stm32cubeide1.17\STM32CubeIDE_1.17.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.1.0.202410251130\tools\arm-none-eabi\bin\ld.exe: D:/15_STM32CubeIDE_1.18.0/stm32cubeide1.17/STM32CubeIDE_1.17.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.1.0.202410251130/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v8-m.main+dp/hard\libc_nano.a(libc_a-lseekr.o): in function `_lseek_r':

(.text._lseek_r+0x10): warning: _lseek is not implemented and will always fail

D:\15_STM32CubeIDE_1.18.0\stm32cubeide1.17\STM32CubeIDE_1.17.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.1.0.202410251130\tools\arm-none-eabi\bin\ld.exe: D:/15_STM32CubeIDE_1.18.0/stm32cubeide1.17/STM32CubeIDE_1.17.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.1.0.202410251130/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v8-m.main+dp/hard\libc_nano.a(libc_a-readr.o): in function `_read_r':

(.text._read_r+0x10): warning: _read is not implemented and will always fail

D:\15_STM32CubeIDE_1.18.0\stm32cubeide1.17\STM32CubeIDE_1.17.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.1.0.202410251130\tools\arm-none-eabi\bin\ld.exe: stm32N6_hand02_FSBL.elf section `.rodata' will not fit in region `ROM'

D:\15_STM32CubeIDE_1.18.0\stm32cubeide1.17\STM32CubeIDE_1.17.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.1.0.202410251130\tools\arm-none-eabi\bin\ld.exe: section .data VMA [341c0000,341c0bf7] overlaps section .rodata VMA [34190f80,341d236f]

D:\15_STM32CubeIDE_1.18.0\stm32cubeide1.17\STM32CubeIDE_1.17.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.1.0.202410251130\tools\arm-none-eabi\bin\ld.exe: region `ROM' overflowed by 92512 bytes

collect2.exe: error: ld returned 1 exit status

make: *** [makefile:68: stm32N6_hand02_FSBL.elf] Error 1

"make -j8 all" terminated with exit code 2. Build might be incomplete.

 

16:20:27 Build Failed. 4 errors, 7 warnings. (took 1s.454ms)

1 reply

Julian E.
Technical Moderator
May 21, 2025

Hello @LQC_,

 

I would suggest you using the ST Model Zoo to deploy your model.

You can follow this tutorial: https://github.com/STMicroelectronics/stm32ai-modelzoo-services/blob/main/image_classification/deployment/README_STM32N6.md

 

You will be able to see the source code of the application deployed in the folder /application_code/image_classification/stm32n6

 

Have a good day,

Julian

​In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
LQC_Author
Associate III
May 22, 2025

Hello, I use st-minst in ST Model Zoo to deploy my project, but when I burned stm32N6570_DK, it didn't work. However, I tried flower and food and they both worked fine. Why can't st-minst work? Are there other steps required?
This is my command and .yaml content

python stm32ai_main.py --config-path ./src/config_file_examples/ --config-name deployment_n6_config.yaml
general:
 # path to a `.tflite` or `.onnx` file.
# model_path: ../../stm32ai-modelzoo/image_classification/mobilenetv2/ST_pretrainedmodel_public_dataset/flowers/mobilenet_v2_0.35_128_fft/mobilenet_v2_0.35_128_fft_int8.tflite
 model_path: ../../stm32ai-modelzoo/image_classification/st_mnist/ST_pretrainedmodel_public_dataset/emnist_byclass/st_mnist_v1_28_tfs/st_mnist_v1_28_tfs_int8.tflite
# model_path: ../../stm32ai-modelzoo/image_classification/mobilenetv2/ST_pretrainedmodel_public_dataset\food-101\mobilenet_v2_0.35_128_fft/mobilenet_v2_0.35_128_fft_int8.tflite
operation_mode: deployment

dataset:
# name: flowers_dataset
# class_names: [daisy, dandelion, roses, sunflowers, tulips]
 name: hande
 class_names: [A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z]
# name: food-101
# class_names: [apple_pie,baby_back_ribs,baklava,beef_carpaccio,beef_tartare,beet_salad,beignets,bibimbap,bread_pudding,breakfast_burrito,bruschetta,caesarsalad,cannoli,caprese_salad,carrot_cake,ceviche,cheesecake,cheese_plate,chicken_curry,chicken_quesadilla,chicken_wings,chocolate_cake,chocolte_mousse,churros,clam_chowder,club_sandwich,crab_cakes,creme_brulee,croque_madame,cup_cakes,deviled_eggs,donuts,dumplings,edamame,eggs_beneict,escargots,falafel,filet_mignon,fish_and_chips,foie_gras,french_fries,french_onion_soup,french_toast,fried_calamari,fried_rice,frozen_yogrt,garlic_bread,gnocchi,greek_salad,grilled_cheese_sandwich,grilled_salmon,guacamole,gyoza,hamburger,hot_and_sour_soup,hot_dog,huevos_rancheos,hummus,ice_cream,lasagna,lobster_bisque,lobster_roll_sandwich,macaroni_and_cheese,macarons,miso_soup,mussels,nachos,omelette,onion_rings,oysters,pad_hai,paella,pancakes,panna_cotta,peking_duck,pho,pizza,pork_chop,poutine,prime_rib,pulled_pork_sandwich,ramen,ravioli,red_velvet_cake,risotto,smosa,sashimi,scallops,seaweed_salad,shrimp_and_grits,spaghetti_bolognese,spaghetti_carbonara,spring_rolls,steak,strawberry_shortcake,sushi,tacs,takoyaki,tiramisu,tuna_tartare,waffles]
preprocessing:
 resizing:
 interpolation: bilinear
 aspect_ratio: crop
 color_mode: rgb # rgb, bgr

tools:
 stedgeai:
 version: 10.1.0
 optimization: balanced
 on_cloud: False # Not Available For STM32N6
 path_to_stedgeai: D:/16_STEdgeAI/2.1/Utilities/windows/stedgeai.exe
 path_to_cubeIDE: D:/15_STM32CubeIDE_1.18.0/stm32cubeide1.17/STM32CubeIDE_1.17.0/STM32CubeIDE/stm32cubeide.exe

deployment:
 c_project_path: ../application_code/image_classification/STM32N6/
 IDE: GCC
 verbosity: 1
 hardware_setup:
 serie: STM32N6
 board: STM32N6570-DK

hydra:
 run:
 dir: ./src/experiments_outputs/${now:%Y_%m_%d_%H_%M_%S}

mlflow:
 uri: ./src/experiments_outputs/mlruns