bao-project / bao-demos

A guide on how to build and use a set of Bao guest configurations for various platforms
Other
33 stars 37 forks source link

Out-of-bounds Error #35

Closed e-nieto closed 1 year ago

e-nieto commented 1 year ago

While trying to compile the Linux+FreeRTOS demo for RPi4, throws the following error:

make[1]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
make[1]: Entering directory '~/Workspace/Bao-hypervisor/bao-demos/wrkdir/srcs/arm-trusted-firmware-aarch64'
  CC      plat/rpi/common/rpi3_pm.c
In file included from plat/rpi/common/rpi3_pm.c:14:
In function 'mmio_write_64',
    inlined from 'rpi3_pwr_down_wfi' at plat/rpi/common/rpi3_pm.c:182:3:
include/lib/mmio.h:51:35: error: array subscript 0 is outside array bounds of 'volatile uint64_t[0]' {aka 'volatile long unsigned int[]'} [-Werror=array-bounds]
   51 |         *(volatile uint64_t*)addr = value;
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
plat/rpi/common/rpi3_pm.c: In function 'plat_setup_psci_ops':
plat/rpi/common/rpi3_pm.c:270:9: error: array subscript 0 is outside array bounds of 'uintptr_t[0]' {aka 'long unsigned int[]'} [-Werror=array-bounds]
  270 |         *entrypoint = sec_entrypoint;
      |         ^~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:1341: ~/Workspace/Bao-hypervisor/bao-demos/wrkdir/srcs/arm-trusted-firmware-aarch64/build/rpi4/release/bl31/rpi3_pm.o] Error 1
make[1]: Leaving directory '~/Workspace/Bao-hypervisor/bao-demos/wrkdir/srcs/arm-trusted-firmware-aarch64'
make: *** [~/Workspace/Bao-hypervisor/bao-demos/platforms/rpi4/make.mk:18: ~/Workspace/Bao-hypervisor/bao-demos/wrkdir/imgs/rpi4/bl31.bin] Error 2

I followed the compiling guide on README.md on bao-demos, commit e6f1f6f (at the time of this PR writing, origin/master), up to the point of make -j$(nproc).

I am using the following versions of Appendix III programs: Program Version
aarch64-none-elf-gcc 12.2.Rel1
make 4.3
dtc 1.6.1
gcc 12.3.0-5
mkimage 2023.01
cmake 3.26.4
ninja 1.11.1

I am compiling on a Debian system following Testing, x86_64 architecture.

e-nieto commented 1 year ago

Update: It does also not work when trying to compile for DEMO=baremetal, so seems to be a problem of the RPi4 files.

ESCristiano commented 1 year ago

Hi @e-nieto

I was able to reproduce your build error, and it appears to be caused by a mismatch between your toolchain version and the version outlined in Appendix III.

To promptly resolve this issue, please consider downgrading your toolchain aarch64-none-elf-gcc to the version specified in Appendix III, which is 11.3, and everything should compile as expected.

We will investigate the error and work towards a permanent fix. Thank you for raising the issue.

josecm commented 1 year ago

I believe this was an issue related to arm-trusted-firmware. I've updated the bao arm-trusted -firmware repo to the latest 2.9 version, which already supports GCC 12.1.

@e-nieto Please delete arm-trusted-firmware from wrkdir/srcs and retry the build. It should work.

e-nieto commented 1 year ago

Looks like it does. I'll try again tomorrow. Cheers!

e-nieto commented 1 year ago

So I tried a clean make with both 12.2 and 11.3, and it seems like it works without the need of doing anything. I do not know if it was @josecm that pushed something, but it's fixed now :)

Thank you team!

sandro2pinto commented 1 year ago

Happy to hear that @e-nieto.

Closing the issue.