By contrast more powerful hardware systems run Windows, MacOSX, GNU/linux or other OS variants. Raspberry Pi (RPi) comes under this heading, it is often loaded with Raspbian which is a full featured version of Linux tailored for RPi hardware.
It is interesting to consider how to use an RPi without an OS, in particular to better understand how a system starts up, how the components in an RPi communicate with each other, what tools are needed to build basic systems and discover what the different components do. It would be a huge amount of work to write an OS myself although this was an objective of the nandtotetris tutorials (which I will write about sometime).
Googling gives a good range of information available for RPi.
Baking Pi - OS development by Alex Chadwick from the Cambridge University Computer Laboratory provides an excellent starting point. Lesson 1 guides you through writing an assembler program to light the LED on RPi. Further lessons expand knowledge of assembly language programming and move on to writing to the screen.
Valvers provides a four-step tutorial based on the content of the Baking Pi project which allows you to write C programs and uses a much simpler platform to cross-compile programs.
David Welch appears to have a variety of bare metal programs including serial port (UART) programming which should be interesting.
Circle appears to provide 30 steps / examples which I will investigate.
OSDev.org is a serious bare metal development site which appears to provide a small but proper kernel for development.
A number of unusual challenges face us when starting bare metal programming.
- How to compile a program to run on a different computer?
Compilers are usually designed to compile programs on the computer you are using so what environment allows you to develop programs to run directly on an RPi. - How to load and run an executable?
The basic approach is to load the program onto an SD card and use the same procedure used to load linux, but it is also possible to load via a serial port (David Welch). - How to write programs that don't need an OS?
It is possible to use the special version of C used for writing the linux kernel and low level assembler libraries can be used. - Where can the information on the relevant hardware, interfaces and libraries be found?
This is crucial information which the tutorials and forum posters can help to provide.
No comments:
Post a Comment