Page 1 of 1

Raspberry Pi 1 Bare Bones & QEMU

Posted: Sat Nov 30, 2019 5:20 pm
by jbltx
Hello,

I just read the tutorial about Raspberry Pi Bare Bones : https://wiki.osdev.org/Raspberry_Pi_Bar ... C_and_Zero
I 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: Select all

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: Select all

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.

Re: Raspberry Pi 1 Bare Bones & QEMU

Posted: Mon Dec 02, 2019 6:27 am
by Velko
Have you tried to run it on a real RPi ?

It looks like you're launching Qemu specifying VersatilePB board, which (most likely) has different I/O addresses.