cancel
Showing results for 
Search instead for 
Did you mean: 

Error creating image for STM32 board with buildroot

ECN
Associate
Dear

I am creating an image for the stm32mp157c_dk2_defconfig board. Using buildroot the following error appears:

Building stm32mp1
CC drivers/io/io_block.c
CC drivers/io/io_dummy.c
CC drivers/io/io_mtd.c
CC drivers/io/io_storage.c
CC drivers/st/crypto/stm32_hash.c
CC drivers/st/io/io_stm32image.c
CC plat/st/common/stm32mp_auth.c
CC plat/st/common/bl2_io_storage.c
CC plat/st/stm32mp1/bl2_plat_setup.c
CC drivers/mmc/mmc.c
drivers/st/io/io_stm32image.c: Na função ‘stm32image_partition_read’:
drivers/st/io/io_stm32image.c:249:13: erro: ‘result’ may be used uninitialized [-Werror=maybe-uninitialized]
249 | int result;
| ^~~~~~
cc1: todos os avisos estão sendo tratados como erros
make[2]: *** [Makefile:1131: /home/ubu/projects/buildroot/output/build/arm-trusted-firmware-v2.5/build/stm32mp1/release/bl2/io_stm32image.o] Erro 1
make[2]: ** Esperando que outros processos terminem.
CC drivers/partition/gpt.c
make[1]: *** [package/pkg-generic.mk:293: /home/ubu/projects/buildroot/output/build/arm-trusted-firmware-v2.5/.stamp_built] Erro 2
make: *** [Makefile:82: _all] Erro 2
The operating system is Linux Ubuntu 22.04.3 LTS22.4. How can I solve this problem? Thanks
 
1 REPLY 1
illi
Associate

Hi ECN,

 

I had the same problem and SOLVED it !

The error is:

drivers/st/io/io_stm32image.c:249:13: error: ‘result’ may be used uninitialized [-Werror=maybe-uninitialized]
249 | int result;
| ^~~~~~

One of the downloaded source files  contain an uninitialized variable named: result", and the compiler doesn't like it.

Manually, open the file to correct it (in my case, I had it here):

 

/buildroot/output/build/arm-trusted-firmware-v2.5/drivers/st/io/io_stm32image.c

 

Go to line 249, and you'll find it.

Initialize the variable to zero and save the file (just add "=0"):

int result=0;

Run again the "make" command, the compiler will continue from where it stopped.

 

My board is running OK.

 

Hope it helped you 🙂