A bare-metal OS/Application for Raspberry Pi 3
The OS looks for a file named "COUNTER" in the root folder of the FAT32 partitioned SD card. Then, it increases the number stored in the file by 1 and saves it. The file before and after the change is sent via UART.
- UART Communication
- SD Card I/O
- FAT32 File System
- Standard C Library
Install aarch64-none-elf-gcc using the following script:
wget https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz
tar -xf gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz --directory /usr/local
for f in /usr/local/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin/*
do
n=${f##*/}
update-alternatives --install /usr/bin/$n $n $f 1
done
Run qemu using:
qemu-system-aarch64 -M raspi3b -serial stdio -kernel kernel.elf -drive file=image.img,if=sd,format=raw
Mount the image using:
mkdir -p /mnt/image
mount image.img /mnt/image
Unmount using:
umount /mnt/image
rmdir /mnt/image
You may need root privileges.