Adding AI models to OpenMV ecosystem?


Has anyone successfully completed this procedure for adding an AI model to the OpenMV ecosystem?

I’ve been trying to do it with Ubuntu on VirtualBox, and it keeps failing on step “1.6.2 Build the firmware”; when executing this command:
make CUBEAI=1

The below is the error output:

CC uart.c
uart.c: In function 'uart_get_baudrate':
uart.c:748:12: error: implicit declaration of function 'LL_USART_GetBaudRate'; did you mean 'HAL_USART_GetState'? [-Werror=implicit-function-declaration]
  748 |     return LL_USART_GetBaudRate(self->uartx, uart_get_source_freq(self),
      |            ^~~~~~~~~~~~~~~~~~~~
      |            HAL_USART_GetState
uart.c:752:9: error: 'LL_USART_OVERSAMPLING_16' undeclared (first use in this function); did you mean 'USART_OVERSAMPLING_16'?
  752 |         LL_USART_OVERSAMPLING_16);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~
      |         USART_OVERSAMPLING_16
uart.c:752:9: note: each undeclared identifier is reported only once for each function it appears in
uart.c: In function 'uart_set_baudrate':
uart.c:756:5: error: implicit declaration of function 'LL_USART_SetBaudRate' [-Werror=implicit-function-declaration]
  756 |     LL_USART_SetBaudRate(self->uartx, uart_get_source_freq(self),
      |     ^~~~~~~~~~~~~~~~~~~~
uart.c:758:9: error: 'LL_USART_PRESCALER_DIV1' undeclared (first use in this function); did you mean 'USART_PRESCALER_DIV1'?
  758 |         LL_USART_PRESCALER_DIV1,
      |         ^~~~~~~~~~~~~~~~~~~~~~~
      |         USART_PRESCALER_DIV1
uart.c:760:9: error: 'LL_USART_OVERSAMPLING_16' undeclared (first use in this function); did you mean 'USART_OVERSAMPLING_16'?
  760 |         LL_USART_OVERSAMPLING_16, baudrate);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~
      |         USART_OVERSAMPLING_16
uart.c: In function 'uart_get_baudrate':
uart.c:753:1: error: control reaches end of non-void function [-Werror=return-type]
  753 | }
      | ^
cc1: all warnings being treated as errors
make[1]: *** [../../py/ /home/marwil/openmv_workspace/openmv/src/build/micropython/uart.o] Error 1
make: *** [omv/ports/stm32/ FIRMWARE_OBJS] Error 2

I carefully followed all steps. I tried it with both Ubuntu 18.04 LTS, as suggested, and Ubuntu 20.04 LTS. Prior to moving to the next step, I had always verified that each piece of software was installed, with the same version, e.g. stm32ai --version

Note, I did not install Keras. I just used the provided .h5 file.

Has anyone gone through this process successfully?


Yes very recently, and it was working. Don’t check the older tag just stay on the master branch, and use gcc-10.2.1.

Note you may need to reduce the heap as a final step to get the fimrware with CUBEAI=1 to link successfully.

1 Like


Thanks for the advice.


1 Like