Simon-Willcocks / RISC-OS-Kernel-in-C

A multiprocessing RISC OS kernel in C
Apache License 2.0
17 stars 2 forks source link

Build expects a file ro_rom.o #10

Closed jr-peterzon closed 3 years ago

jr-peterzon commented 3 years ago

The build script expects to have a ro_rom.o file in the build tree. However there is no script or description on how to create that file.

Simon-Willcocks commented 3 years ago

It is all but the first 64KiB of a RISCOS.IMG file, but the hacks that give the locations of the modules in the ROM will be broken for anything but my home made ROM. I'll work out the numbers that come from this source:

https://www.riscosopen.org/zipfiles/platform/raspberry-pi/BCM2835.5.28.zip

dd if=RISCOS.IMG of=ro_rom.img bs=65536 skip=1 arm-linux-gnueabi-objcopy -I binary -O elf32-littlearm -B armv7 ro_rom.img ro_rom.o

Simon-Willcocks commented 3 years ago

Correction, that is the ROM I've been working with, so you can download it, extract RISCOS.IMG, and the commands above should create ro_rom.o.

jr-peterzon commented 3 years ago

We can add the following at the start of the build script:

mkdir -p rominstall cd rominstall wget https://www.riscosopen.org/zipfiles/platform/raspberry-pi/BCM2835.5.28.zip unzip BCM2835.5.28.zip dd if=RISCOS.IMG of=ro_rom.img bs=65536 skip=1 arm-linux-gnueabihf-objcopy -I binary -O elf32-littlearm -B armv7 ro_rom.img ../ro_rom.o cd .. rm -Rf rominstall

Simon-Willcocks commented 3 years ago

I protected it with if [ ! -f ro_rom.o ] ; then ... fi, so it's not done every build.

It's checked in, but I've made a mistake, it needs to have the section renamed. Just a minute.

Simon-Willcocks commented 3 years ago

Yes, it needs --prefix-sections=.modules, as well.

I notice you're using arm-linux-gnueabihf- where I'm using arm-linux-gnueabi- I don't know what difference that will make (or what the "hf" stands for). Can you think of a simple way of choosing other compilers (bearing in mind there's an annoying -8 after my gcc)?

janrinze commented 3 years ago

hf means hard float. Thus it won't be using soft float libraries.

janrinze commented 3 years ago

Since we are using cross compilers we could try to find out which compiler is installed and setup some variables to represent them. I have been fiddling with CMake to get more steps automated. (see: https://github.com/janrinze/RISC-OS-Kernel-in-C ) There is in CMakeList.txt the reference to the used cross compiler:

set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)
set(CMAKE_C_LINK_FLAGS "-nostartfiles -nostdlib -fno-zero-initialized-in-bss -static -g -march=armv8-a -Os -o rom.elf -static -T ${CMAKE_SOURCE_DIR}/rom.script -Os" )

to build the sources with cmake:

cd RISC-OS-Kernel-in-C
mkdir -p BUILD
cd BUILD
cmake ../
make

the build runs up to the link stage where it struggles to find some symbols.

Simon-Willcocks commented 3 years ago

Hi Jan!

I don't think the kernel will use any floating point. It probably doesn't even have to save FP context, since the Wimp is cooperative. The compiler's told not to use any: -march=armv8-a+nofp

I have no clue about cmake, but I'll be having a look at your fork. Actually, it's certain to be the better maintained of the two. :)

jr-peterzon commented 3 years ago

Let's close this issue since the build now works.