zephyrproject-rtos / sdk-ng

Zephyr SDK (Toolchains, Development Tools)
Apache License 2.0
174 stars 125 forks source link

"Bus fault on vector table read" using SDK versions later than 0.16.0-beta1 #714

Open jonny-svaerd-arm opened 10 months ago

jonny-svaerd-arm commented 10 months ago

Hi,

Attempting to compile example application zephyr/samples/modules/tflite-micro/tflm_ethosu and run on Arm® Corstone™-300 software FVP (available for download here: https://developer.arm.com/downloads/-/arm-ecosystem-fvps) using an SDK version later than 0.16.0-beta1 results in a HARD FAULT. The below output is from an attempt to use SDK 0.16.3:

[00:00:00.000,000] <err> os:   Bus fault on vector table read
[00:00:00.000,000] <err> os: r0/a1:  0xfefa125b  r1/a2:  0x00000000  r2/a3:  0x00000000
[00:00:00.000,000] <err> os: r3/a4:  0xcfdfdfdf r12/ip:  0xdfdfdfcf r14/lr:  0x00000001
[00:00:00.000,000] <err> os:  xpsr:  0x10004200
[00:00:00.000,000] <err> os: Faulting instruction address (r15/pc): 0x00000005
[00:00:00.000,000] <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
[00:00:00.000,000] <err> os: Current thread: 0x30000700 (unknown)
[00:00:00.010,000] <err> os: Halting system

Compiling and running the same application using SDK 0.16.0-beta1 works as expected.

Building: west build -p -b mps3_an547 zephyr/samples/modules/tflite-micro/tflm_ethosu

Running: FVP_Corstone_SSE-300_Ethos-U55 -C mps3_board.visualisation.disable-visualisation=1 -C mps3_board.telnetterminal0.start_telnet=0 -C mps3_board.uart0.out_file="-" -C mps3_board.uart0.unbuffered_output=1 build/zephyr/zephyr.elf

Please let me know if you need anything more or if there is something I can help with.

Thanks

ithinuel commented 2 months ago

This has been investigated and it revealed that the fault was due to a use of malloc before malloc_prepare. Related to https://github.com/zephyrproject-rtos/zephyr/pull/74579

Malloc has been removed from the upstream driver: https://git.mlplatform.org/ml/ethos-u/ethos-u-core-driver.git/

So this should now be a matter of updating https://github.com/zephyrproject-rtos/hal_ethos_u