Hello,
I just read the tutorial about Raspberry Pi Bare Bones :
https://wiki.osdev.org/Raspberry_Pi_Bare_Bones#Pi_Model_A.2C_B.2C_A.2B.2C_B.2B.2C_and_ZeroI was wondering if the code is up-to-date for BCM2835 (arm11) ? Because I can't get it working on QEMU.
My steps :
- Create
kernel.c,
boot.S and
linker.ld- Change in kernel.c -> GPIO_BASE = 0x20200000
- Change in kernel.c -> UART0_BASE = (GPIO_BASE + 0x1000)
- Check linker.ld's LOADER_ADDR is equal to 0x8000
- Check boot.S' stack setup is using #0x8000
Build :
Code:
arm-none-eabi-gcc -mcpu=arm1176jzf-s -fpic -ffreestanding -std=gnu99 -c kernel.c -o kernel.o -O2 -Wall -Wextra
arm-none-eabi-gcc -mcpu=arm1176jzf-s -fpic -ffreestanding -c boot.S -o boot.o
arm-none-eabi-gcc -T linker.ld -o myos.elf -ffreestanding -O2 -nostdlib boot.o kernel.o -lgcc
Test :
Code:
qemu-system-arm -m 256 -M versatilepb -cpu arm1176 -serial stdio -kernel myos.elf
There's no output in stdio, it just hangs.
The version of GCC is 9.2.1 (20191025).
I was able to make it work for raspberry Pi 2 and 3, but not for the first one. That's unfortunate because I have a Pi Zero which uses the same architecture as the first Pi...
Thank you.