#WioTerminal – @EdgeImpulse projects and the error: `FLASH’ overflowed by 42784 bytes

Hi !

Yesterday I hosted a session where I show how to train a Computer Vision model and run the model in a Wio Terminal.

TinyML 🧠 and Azure IoT with Edge Impulse and Wio Terminal

In this video I also explain how to connect and use an ArduCAM to take photos with the device.

The build process for this machine learning model takes some time, so I show a precorded set of videos where I show, what’s happens when we build a model, and this becomes to big for the device.

In example, let’s try to build a model with the next set of settings.

  • Neural Network Architecture based on MobileNetV2
  • Size: 96×96
  • Final layer: 16 neurons
  • Dropout: 0.1
  • Unoptimized (float32)
  • RAM usage: 934.3K
  • Latency: 465 ms
  • Flash usage: 454.0K
  • Accuracy: 90.91%

Once I added the exported library to the Platform IO project, the following log show this error.

wio terminal cant build firmware
Linking .pio\build\seeed_wio_terminal\firmware.elf
c:/users/bruno/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: .pio\build\seeed_wio_terminal\firmware.elf section `.text' will not fit in region `FLASH'
c:/users/bruno/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: region `FLASH' overflowed by 14256 bytes
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\seeed_wio_terminal\firmware.elf] Error 1
================================================================================================================================ [FAILED] Took 75.96 seconds ================================================================================================================================
The terminal process "C:\Users\bruno\.platformio\penv\Scripts\platformio.exe 'run', '--environment', 'seeed_wio_terminal'" terminated with exit code: 1.

So, the model configuration is too big.

This is when EON Tuner comes handy in order to help us fit the trained model.

The EON Tuner helps you find and select the best embedded machine learning model for your application within the constraints of your target device. The EON Tuner analyzes your input data, potential signal processing blocks, and neural network architectures – and gives you an overview of possible model architectures that will fit your chosen device’s latency and memory requirements.

Edge Impulse – EON Tuner

Let’s try to build the same project with EON tuner enabled and the following configuration:

  • Neural Network Architecture based on MobileNetV2
  • Size: 96×96
  • Final layer: 16 neurons
  • Dropout: 0.1
  • Quantized (int8)
  • RAM usage: 292.9K
  • Latency: 126 ms
  • Flash usage: 222.8K
  • Accuracy: 90.91%

The output is a happy moment now ! The firmware will fit into the Wio Terminal device.

Linking .pio\build\seeed_wio_terminal\firmware.elf
Checking size .pio\build\seeed_wio_terminal\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [====      ]  40.0% (used 78576 bytes from 196608 bytes)
Flash: [======    ]  57.2% (used 290504 bytes from 507904 bytes)
Building .pio\build\seeed_wio_terminal\firmware.bin
======================================= [SUCCESS] Took 70.99 seconds =======================================

Happy coding!

Greetings

El Bruno

More posts in my blog ElBruno.com.


Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: