Error when building the firmware with CubeAI

Hi all,

I’m currently trying to use the OpenMV H7 Plus version installing the firmware including CubeAI. I have followed the steps in openmv/src/stm32cubeai at master · openmv/openmv · GitHub and in openmv/README.md at master · openmv/openmv · GitHub to build the firmware with the X CUBE AI package enabled for that specific target. For the compiling step, after selecting the correct version of the gcc arm toolchain, I run:

make -j4 CUBEAI=1 TARGET=OPENMV4P

This is the output I get when building it with the network that is in src/stm32cubeai/example/.

/home/elena/gcc-arm-none-eabi-7-2018-q2-update/bin/…/lib/gcc/arm-none-eabi/7.3.1/…/…/…/…/arm-none-eabi/bin/ld: /home/elena/openmv/src/build/bin/firmware.elf section .text' will not fit in region FLASH_TEXT’
/home/elena/gcc-arm-none-eabi-7-2018-q2-update/bin/…/lib/gcc/arm-none-eabi/7.3.1/…/…/…/…/arm-none-eabi/bin/ld: /home/elena/openmv/src/build/bin/firmware.elf section ._stack' will not fit in region SRAM1’
/home/elena/gcc-arm-none-eabi-7-2018-q2-update/bin/…/lib/gcc/arm-none-eabi/7.3.1/…/…/…/…/arm-none-eabi/bin/ld: region SRAM1' overflowed by 1776 bytes /home/elena/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld: region FLASH_TEXT’ overflowed by 133656 bytes
collect2: error: ld returned 1 exit status
Makefile:608: recipe for target ‘firmware’ failed
make: *** [firmware] Error 1

I tried to edit some parameters in src/omv/boards/OPENMV4P/omv_boardconfig.h as the troubleshooting indicates, but I did not get any results, basically I observe the same error.

Any ideas?

Thanks.

You need to disable features to make it fit.

See the imlib_config.h file and comment out things. Like, turn off the TF code (#define IMLIB_ENABLE_TF). That should make it fit.

We don’t really maintain that code path since ST just sent a PR to add it but hasn’t really done much else there. I guess we could make TF turn off if you enable cube-ai.

Please report a bug on guithub and I’ll fix it.

Hi again,

It worked!!! I commented the line that includes TF in imlib_config.h as you said:
// #define IMLIB_ENABLE_TF

That removed the FLASH overflow but the SRAM error kept appearing so I also lowed the OMV_HEAP_SIZE parameter to 200K in the file omv_boardconfig.h.

I will report the bug as soon as possible as an issue in GitHub as suggested.

Thanks for all.

Hi again,

I’m currently trying to run inference in a neural network, but I don’t need any preprocessing of the input data. What do you think it will be the necessary libraries for the firmware? I need as much flash free space in the device as possible.

Thanks.

The mapping of most of those features and the python functions they use is pretty direct. E.g. you don’t need AprilTags? Comment it out. Don’t need barcodes? Comment it out. Etc.

In the TF code you can also modify the default CNN used and switch from person detection to your own.

Ok, thanks for all.