Raspberry Pi 1 Bare Bones & QEMU

All about the OSDev Wiki. Discussions about the organization and general structure of articles and how to use the wiki. Request changes here if you don't know how to use the wiki.
Post Reply
jbltx
Posts: 1
Joined: Sat Nov 30, 2019 4:53 pm
Libera.chat IRC: jbltx

Raspberry Pi 1 Bare Bones & QEMU

Post 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.
User avatar
Velko
Member
Member
Posts: 153
Joined: Fri Oct 03, 2008 4:13 am
Location: Ogre, Latvia, EU

Re: Raspberry Pi 1 Bare Bones & QEMU

Post 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.
If something looks overcomplicated, most likely it is.
Post Reply