jncronin / rpi-boot

A second stage bootloader for the Raspberry Pi
GNU General Public License v2.0
141 stars 48 forks source link

boot.s does not compile on arm-none-eabi-gcc v9.2.1 #27

Closed roadriverrail closed 2 years ago

roadriverrail commented 2 years ago

Having recently pulled down this project, I have been unable to compile it on arm-none-eabi-gcc v9.2.1 because of a build break caused by this commit:

commit 49354ee888a68c1803638a5f87495cc0dfd6fbb4
Author: John Cronin <jncronin@tysos.org>
Date:   Sat Jan 5 16:06:28 2019 +0000

    Add code to ensure a v2 pi is in svc rather than hyp mode
    Thanks to eryjus for highlighting this, see
    https://github.com/jncronin/rpi-boot/issues/23
gcc -P -traditional-cpp -std=gnu99 -E -o Makefile.rpi-boot -x c Makefile.rpi-boot.in 
make -f Makefile.rpi-boot kernel.img
make[1]: Entering directory '/home/rhett/rpi-boot'
arm-none-eabi-gcc  -include config.h -c boot.s -o boot.o
boot.s: Assembler messages:
boot.s:33: Error: selected processor does not support `cpsid iaf,#0x13' in ARM mode
boot.s:45: Error: Banked registers are not available with this architecture. -- `msr elr_hyp,r3'
boot.s:47: Error: selected processor does not support `eret' in ARM mode
boot.s:72: Error: selected processor does not support `blx r3' in ARM mode
boot.s:75: Error: selected processor does not support `wfe ' in ARM mode
make[1]: *** [Makefile.rpi-boot:173: boot.o] Error 1
make[1]: Leaving directory '/home/rhett/rpi-boot'
make: *** [Makefile:19: kernel.img] Error 2

I suspect that the issue is actually just a question of needing appropriate compiler flags, but for the life of me, I cannot determine what those should be.

roadriverrail commented 2 years ago

I was able to find a compilation command line that allows this:

arm-none-eabi-gcc  -include config.h -c boot.s -o boot.o -march=armv7ve -mcpu=arm1176jzf-s

Specifying the -march=armv7ve instructs gcc to use the virtualization extensions, which is exactly what the commit in question was in regards to.

I'll add this to my existing pull request.