Bare Metal resources


24 posts
by mahjongg » Sun Mar 16, 2014 5:48 pm
Links to resources for Bare Metal programming go here.

Please do not post comments/discussions here, just links to info.
Post "contaminating" the sticky will be deleted.
For these use the normal threads.
User avatar
Forum Moderator
Forum Moderator
Posts: 9216
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands
by mahjongg » Sun Mar 16, 2014 5:52 pm
headers from the Broadcom GPU source code
  • SD - for SDRAM
  • L1 - for Level 1 cache
  • L2 - for Level 2 cache
  • H264 - for the H264 encoder/devoder i assume
  • FPGA - ?

The generated html page is here:
https://rawgithub.com/msperl/rpi-registers/master/rpi-registers.html

The full project including the scripts which were used to generate it can be found here:
https://github.com/msperl/rpi-registers
User avatar
Forum Moderator
Forum Moderator
Posts: 9216
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands
by mahjongg » Sun Mar 16, 2014 5:55 pm
User avatar
Forum Moderator
Forum Moderator
Posts: 9216
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands
by ghans » Fri Mar 28, 2014 7:57 pm
Information for the Raspberry Pi / BCM2835

Information for the Raspberry Pi 2 / BCM2836

NEW ! Information for the BCM2837 (Raspberry Pi 3)
Communicating with the GPU via Mailboxes

https://github.com/raspberrypi/firmware/wiki
https://github.com/raspberrypi/firmware/wiki/_pages

ghans
Last edited by ghans on Mon May 15, 2017 7:05 am, edited 14 times in total.
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org
Posts: 7243
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany
by ghans » Thu May 15, 2014 1:42 pm
The USB Controller on the Pi has no official publicly available documentation.
As USB was envisaged as the main way of connecting a keyboard plus mouse AND getting an
internet connection, this might be unfortunate for everybody who writes their own OS.
Currently information on the controller has to be gleaned from open drivers.
The one of the embedded Xinu project might be a good starting point:

http://xinu.mscs.mu.edu/Synopsys_Design ... Controller

Otherwise , have a look at the USPi project of R. Stange , which
is ready for integration in your open-source projects (GPLv3) :
viewtopic.php?f=72&t=92579

GPU Documentation / VideoCore® IV 3D Architecture Reference Guide
https://docs.broadcom.com/docs/12358545


More documentation for the GPU (reverse-engineered) :
https://github.com/hermanhermitage/videocoreiv

Documentation for the LAN9512 chip of the Model B (an USB hub with an integrated USB Network card):
http://ww1.microchip.com/downloads/en/D ... c/9512.pdf

ghans
Last edited by ghans on Mon May 15, 2017 7:05 am, edited 17 times in total.
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org
Posts: 7243
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany
by mahjongg » Tue May 20, 2014 10:37 am
User avatar
Forum Moderator
Forum Moderator
Posts: 9216
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands
by ghans » Sat May 24, 2014 8:24 am
David Welchs bare metal examples :

https://github.com/dwelch67/raspberrypi

Also includes code which illustrates how to load new
kernels over a serial connection
, so you don't need to
constantly swap the SD card from the Pi to your dev machine
and back.

Baking Pi :
http://www.cl.cam.ac.uk/projects/raspbe ... orials/os/

A nice tutorial on writing bare-metal assembly for the Pi.

ghans
Last edited by ghans on Mon Apr 13, 2015 9:50 am, edited 2 times in total.
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org
Posts: 7243
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany
by macload1 » Mon Jul 07, 2014 6:54 am
Link to an example of Raspberry Pi running FreeRTOS and µGFX as GUI using the framebuffer (output on HDMI or composite)

-> http://macload1.frogcp.com
Posts: 1
Joined: Mon Jul 07, 2014 6:50 am
by krom » Thu Dec 11, 2014 10:37 am
Here are some Bare Metal Raspberry Pi examples that use very minimal & simple ARM Assembly only:
https://github.com/PeterLemon/RaspberryPi

Here is what you will find:
LZSS & Huffman Decompression: https://github.com/PeterLemon/RaspberryPi/tree/master/Compress
GB Z80 Emulator with minimal hardware attached to run some GameBoy ROMs: https://github.com/PeterLemon/RaspberryPi/tree/master/EMU/GameBoy
Hello World console text output demos, using the CPU or DMA with Stride: https://github.com/PeterLemon/RaspberryPi/tree/master/HelloWorld
GPIO Input demos using a SNES or NES Controller, & the SNES Mouse: https://github.com/PeterLemon/RaspberryPi/tree/master/Input
Sound Playback demos using the PWM: https://github.com/PeterLemon/RaspberryPi/tree/master/Sound/PWM
TAGS Channel demo which prints all Raspberry Pi Mailbox TAGS information to the screen: https://github.com/PeterLemon/RaspberryPi/tree/master/TagsChannel
V3D demos to show howto initialize the V3D (Rasperry Pi GPU) & prints all V3D information to the screen, & howto display a control list to show a Clear Color & Triangles: https://github.com/PeterLemon/RaspberryPi/tree/master/V3D
VFP demos to display a static Mandelbrot fractal using Raspberry Pi ARM Floating point (FPU) instructions, & an animated Julia fractal: https://github.com/PeterLemon/RaspberryPi/tree/master/VFP/Fractal

You will not find a simpler suite of assembly source for bare metal programming on the Raspberry Pi, I recommend you check out my github repository if you like programming in ARM assembly.
I hope you all have fun with this stuff!

P.S I would like to say a special thanks to DexOS who helped me get my 1st pixel on the screen, & made all this possible =D
Last edited by krom on Wed Jan 21, 2015 3:42 am, edited 1 time in total.
Posts: 60
Joined: Wed Dec 05, 2012 9:12 am
by novellus » Sun Jan 11, 2015 8:19 am
Posts: 1
Joined: Sun Jan 11, 2015 8:16 am
by mrvn » Sat Feb 28, 2015 6:11 pm
Raspberry Pi
The Raspberry Pi has 5 LEDs on the board: Power, Activity, Full Douplex, Link and 100Mbit. The last 3 I assume are connected directly to the ethernet chip. I'm unsure about the power LED. The activity LED though is connected to GPIO pin 16 and configured for output on boot. One can simply set/clr the pin to make the LED react.

Note: peripheral base in 0x20000000 which makes the GPIO base 0x20200000.

Raspberry Pi2
The Raspbeery PI2 has only 2 LEDs on the board: Power and Activity. The RJ45 connector has 2 more LEDs but they will be controled by the ethernet chip for sure. The power LED is connected to GPIO pin 35 but configured at boot with pull up or pull down so it simply is on. Removing the pull up/down and reconfiguring the pin for output lets one control the LED via set/clr of the pin. The activity LED has moved compared to the Raspberry Pi and is now on GPIO pin 47. But it is still configured as output on boot and set/clr of the pin makes it react.

Note: peripheral base in 0x3F000000 which makes the GPIO base 0x3F200000.
Posts: 58
Joined: Wed Jan 09, 2013 6:50 pm
by turboscrew » Thu Mar 12, 2015 10:47 am
How about Pi 2 USB?
I understand that for RasPi A, there is one USB: the Synopsys' module built into the VideoCore IV, that is directly connected to the USB-connector. In RasPi B, that same module is used, but connected to the integrated USB HUB in LAN9512, but how about Pi B+ and Pi 2? It has 4 USB ports, but they were not found in the schema.
De-bugging is for sissies - real men do de-monstrations.
Posts: 175
Joined: Sat Jan 18, 2014 1:50 pm
Location: Nokia (town), Finland
by rpdom » Thu Mar 12, 2015 2:07 pm
The Pi 2 and B+ use a LAN9514 instead of a LAN9512. It's the same chip, but with 4 USB ports instead of 2.
User avatar
Posts: 10850
Joined: Sun May 06, 2012 5:17 am
Location: Essex, UK
by turboscrew » Thu Mar 12, 2015 5:56 pm
OK, thanks. Funny that I didn't find that mentioned anywhere.
And the USB-part is missing from the model B+ schema.
De-bugging is for sissies - real men do de-monstrations.
Posts: 175
Joined: Sat Jan 18, 2014 1:50 pm
Location: Nokia (town), Finland
by sheroy » Fri May 22, 2015 7:22 am
One more bare metal development link in c

This is a bit higher by using c but essentially instead of writing in assembly one can write in c

http://www.valvers.com/open-software/ra ... g-in-cpt1/
Posts: 24
Joined: Fri Jun 14, 2013 5:34 pm
by rascol » Sat Jun 13, 2015 1:44 pm
Posts: 9
Joined: Sat May 30, 2015 1:48 pm
by Akane » Mon Nov 23, 2015 9:19 am
VideoCore IV 3D Architecture Reference Guide errata: http://elinux.org/VideoCore_IV_3D_Architecture_Reference_Guide_errata
User avatar
Posts: 40
Joined: Tue May 27, 2014 1:20 pm
Location: Tsukuba, Japan
by Akane » Mon Nov 23, 2015 9:31 am
User avatar
Posts: 40
Joined: Tue May 27, 2014 1:20 pm
Location: Tsukuba, Japan
by 27troadster » Wed Nov 25, 2015 12:59 am
Coprocessor register values upon boot to bare metal:

https://www.raspberrypi.org/forums/view ... 2&t=126891
Posts: 16
Joined: Sun Apr 12, 2015 12:10 pm
by ausppc » Fri Dec 18, 2015 9:37 pm
From https://en.wikipedia.org/wiki/Raspberry_Pi

CPU for models A, A+, B, B+, CM & Pi Zero : ARM1176JZF-S
Links to useful reference material: https://en.wikipedia.org/wiki/ARM11#External_links

CPU for Pi 2 : ARM Cortex-A7
No useful links.
Posts: 18
Joined: Sat Apr 21, 2012 8:51 pm
by Ultibo » Thu Feb 04, 2016 2:45 am
Full featured Raspberry Pi bare metal in Free Pascal

https://ultibo.org

Includes threading, networking, filesystems, USB, MMC/SD and more.
Ultibo.org | Make the future
https://ultibo.org
User avatar
Posts: 83
Joined: Wed Sep 30, 2015 10:29 am
Location: Australia
by jangling » Sun May 29, 2016 10:02 pm
"You will not find a simpler suite of assembly source for bare metal programming on the Raspberry Pi"

So, what can we do to develop this work further?
Posts: 1
Joined: Sun May 29, 2016 9:59 pm
by sharpcoder » Wed Oct 12, 2016 3:48 am
complete c++ kernel for the raspberry pi: https://github.com/SharpCoder/rpi-kernel
And the guide on how to compile it: https://rpidev.wordpress.com

The kernel was developed with a raspberry A. Though it should work on newer ones (as far as I am aware). The code is mostly pretty well commented and does its best to be as comprehensible as possible.
User avatar
Posts: 39
Joined: Tue Mar 12, 2013 9:07 pm
Location: Seattle, WA
by dickon » Wed Nov 16, 2016 12:33 pm
Posts: 216
Joined: Sun Dec 09, 2012 3:54 pm
Location: Home, just outside Reading