-
Notifications
You must be signed in to change notification settings - Fork 2
richcole/RaspberryPi
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
= Adventures in Bare Metal Programming on the Raspberry Pi == Introduction This code is is an example of working in bare metal on the Raspberry Pi. == Requirements 1. Linux desktop (my instructions are Debian based) 2. Raspberry Pi 3. A 3.3v USB UART that supports linux, e.g. http://www.amazon.com/gp/product/B006JKNWLE == Instructions === The bootloader First you need to install bootloader05 from https://github.com/dwelch67/raspberrypi on your pi. Copy kernel.img and make an empty config.txt file on your SD card. I presume you already have one with the other stuff used by the pi to boot, e.g. I had a berriboot SD card. === Bootstrap your Linux desktop for development First add the following to /etc/apt/sources.list deb http://www.emdebian.org/debian/ squeeze main Then execute sudo apt-get update Next execute sudo apt-get install rake rake bootstrap This will install the GNU ARM C compiler. === Connect up your Serial UART See this diagram https://sites.google.com/site/burngatehouse/home/drawings/GPIOs2.gif I position the board so that the HDMI cable is on the left the serial cables and Ethernet cable are on the bottom. When position so the set of p1 connectors is on the top right of the board. It is labled on the board p1 just to the top left of the connector. The UART lines 3 (GND), 4 (TX), 5 (RX) counting down from the top the right column from starting with the first pin being pin 1. The pins on my serial UART are also labled. Connect TX to RX and RX to TX and GND to GND. My serial UART came with female to female connectors and so it was easy. === Build the bare metal program and load it 1. Execute rake run 2. Apply power to your Raspberry pi. You should see a pattern on the HDMI screen and some output from the serial program running from the previous command. You should see output like this: Sending /home/richcole/clients/github/RaspberryPi/build/kernel/kernel.bin, 3 blocks: Give your local XMODEM receive command now. Xmodem sectors/kbytes sent: [snip] 00000014 00000015 00000016 Bytes Sent: 512 BPS:125 Transfer complete PIPE Signal 13 Process terminated 0000017 00000018 00000019 0000001A 0000001B 0000001C 0000001D 11111111 22222222 333! === You're done This is as far as I got so far. The lack of a power reset switch is going to be painful as one has to unplug the power and plug it back in again to reset the device. I'm hesitant to open up the the power cord to install a switch. Instead I might find a power socket with a switch, they don't seem to have power socket switches here in the US like they do in Australia. David Welch recommends the purchase of jtag adapter. http://www.raspberrypi.org/phpBB3/viewtopic.php?f=72&t=19623 Next steps are to make the bootloaded program do something more interesting and to find more specs about what is where. This document has some info: BCM2835-ARM-Peripherals.pdf Here is a link to a nice blog about writing a OS for beagle boards http://www.embedded-bits.co.uk/category/beagleboard/ === QEMU === arm-linux-gnueabi-gdb --annotate=3 file build/kernel/kernel.qemu.elf target remote :1234
About
Notes and code for developing hobby OS's for the Raspberry PI
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published