Linking issues: ITCM overflow

 bin/ethos-u-vww.axf section `.text.at_itcm' will not fit in region `ITCM'
/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: ITCM overflow
/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: region `ITCM' overflowed by 45948 bytes
/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: bin/ethos-u-inference_runner.axf section `.text.at_itcm' will not fit in region `ITCM'
/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: ITCM overflow
/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: region `ITCM' overflowed by 210588 bytes
/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: bin/ethos-u-ad.axf section `.text.at_itcm' will not fit in region `ITCM'
/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: ITCM overflow
/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: BRAM overflow
/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: region `ITCM' overflowed by 48724 bytes
/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: bin/ethos-u-kws.axf section `.text.at_itcm' will not fit in region `ITCM'
/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: bin/ethos-u-kws_asr.axf section `.text.at_itcm' will not fit in region `ITCM'
/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: ITCM overflow
/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: BRAM overflow
/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: region `ITCM' overflowed by 71620 bytes
/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: ITCM overflow
/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: BRAM overflow
/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: region `ITCM' overflowed by 89380 bytes
/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: bin/ethos-u-img_class.axf section `.text.at_itcm' will not fit in region `ITCM'
/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: ITCM overflow
/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: region `ITCM' overflowed by 52124 bytes
/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: bin/ethos-u-asr.axf section `.text.at_itcm' will not fit in region `ITCM'
/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: ITCM overflow
/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: BRAM overflow
/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: region `ITCM' overflowed by 52356 bytes
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/ethos-u-vww.dir/build.make:122: bin/ethos-u-vww.axf] Error 1
make[1]: *** [CMakeFiles/Makefile2:396: CMakeFiles/ethos-u-vww.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/ethos-u-inference_runner.dir/build.make:122: bin/ethos-u-inference_runner.axf] Error 1
make[1]: *** [CMakeFiles/Makefile2:535: CMakeFiles/ethos-u-inference_runner.dir/all] Error 2
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/ethos-u-ad.dir/build.make:122: bin/ethos-u-ad.axf] Error 1
make[1]: *** [CMakeFiles/Makefile2:340: CMakeFiles/ethos-u-ad.dir/all] Error 2
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/ethos-u-kws.dir/build.make:122: bin/ethos-u-kws.axf] Error 1
make[1]: *** [CMakeFiles/Makefile2:508: CMakeFiles/ethos-u-kws.dir/all] Error 2
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/ethos-u-img_class.dir/build.make:122: bin/ethos-u-img_class.axf] Error 1
make[1]: *** [CMakeFiles/Makefile2:255: CMakeFiles/ethos-u-img_class.dir/all] Error 2
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/ethos-u-kws_asr.dir/build.make:122: bin/ethos-u-kws_asr.axf] Error 1
make[1]: *** [CMakeFiles/Makefile2:423: CMakeFiles/ethos-u-kws_asr.dir/all] Error 2
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/ethos-u-asr.dir/build.make:122: bin/ethos-u-asr.axf] Error 1
make[1]: *** [CMakeFiles/Makefile2:199: CMakeFiles/ethos-u-asr.dir/all] Error 2
make: *** [Makefile:103: all] Error

Hi, I’m seeing errors like this when trying to build the example project. I used the default config.
Wondering if anyone has some thought on this.
I’m new to the arm toolchain.
I tried to change the mps3-sse-300.ld file to make the ITCM larger, but then I got error like

Failed to write bytes at address range [0x00080000…0x0008CB9B] when loading image “bin/ethos-u-img_class.axf”

Hi, can you help us understand the issue better by answering these:

  • have there been any changes made in the code for you to see this error? If so, this might have increased the code size which then results in link failure because the ITCM size on the supported targets is limited to 512 kiB. For example, if you have declared a big array of a fixed size in main, this might make the linker fail to fit it into the available memory.
  • are you using default versions of the git submodules?

I tried to change the mps3-sse-300.ld file to make the ITCM larger, but then I got error like

We would recommend editing the linker script only when you can build the default configuration successfully. Please note that the sizes mentioned in the linker scripts should not be changed as they conform to the target platforms (FVP and FPGA).

Oh, I realized I added a std::cout statement and that might brings a large piece of libc++? into the binary…
Removing the std::cout resolve the issue.
Thanks

Thanks for letting us know. Yes, you’re right - using cout functionality will bring in its dependency linkage from libstdc++ and with arm-none-eabi- toolchain, this can bloat the code region. You can use C style logging functionality provided by bsp_core_log.h instead. See example in Main.cc line 36.

Hope this helps! :slight_smile: