Booting Raspberry Pi 3: Difference between revisions

no edit summary
[unchecked revision][unchecked revision]
No edit summary
No edit summary
Line 1:
 
This is a tutorial on bare-metal OS development on the AArch64 architecture. This article oriented to the Raspberry Pi 3 (RPi 3), but is aimed to be as device agnostic as possible. Therefore, some sections will be specific to the RPi 3 and will be marked to represent that.
 
'''THIS IS NOT A PRACTICAL IMPLEMENTATION! THIS ARTICLE IS MEANT TO BE A REFERENCE/SOMETHING TO BE BUILT UP ON!'''
 
This is the author's very first ARM system and wiki page. I learn as I write and will continue to develop this page once I feel comfortable enough at the subjet to share.
Line 40 ⟶ 42:
https://elinux.org/RPi_Software#Overview
 
. = ALIGN(16);
__bss_start = .;
https://raspberrypi.stackexchange.com/a/10595
 
Line 82 ⟶ 86:
.bss (NOLOAD) : {
. = ALIGN(16);
__bss_start = .;
*(.bss*)
. = ALIGN(16);
__bss_nlwords = (. - __bss_start);
}
}
Line 95:
For the RPi 3, after the start.elf finishes, the CPU and SRAM have been enabled and control is given to the kernel image. But there are a few things we must do in order to set up a basic C environment. This is known as a bootstrap stage which initializes our OS and programming environment on startup and hands control to the kernel. Keep in mind that this is for a minimalistic development environment on a single core.
 
====How to Proceed====
 
If you are new to operating system development, I encourage you to take the time and read '''Basic Information''' section of OsDev's [https://wiki.osdev.org/Main_Page Main Page]. You should know they developing an operating system, even a microkernel, is difficult. The lack of explicit documentation is enough to frustrate novices and even experienced developers (which is exactly the main purpose of this series). The goal is to be patient and understand that what may be ahead is fun but also challanging. Continuing forward also means that you must be accustomed to and aware of the functionalities an operating system must provide. I also recommend that you take the time to go through the resources in Extra Resources to make sure you are acquainted with operating systems and their engineering for beginners and those who are familiar.
 
That being said, if you have committed to the project then take note that from this point on I will be focusing on RPi 3 development.
 
====Extra Resources====
* [https://pdos.csail.mit.edu/6.828/2017/xv6/book-rev10.pdf Short book on operating systems with reference implemenation]
* [https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-828-operating-system-engineering-fall-2012/ MIT OpenCourseWare class on operating system engineering]
When the CPU starts running the kernel, all cores will be executing the same code. This can be tricky for multiple reasons, which will be described later. For now, all we want is just one core running the kernel. To do that, we need get the core identification number and set all but one core to run an infinite loop.
 
Line 137 ⟶ 146:
 
At the time of writing, QEMU does not yet emulate the RPi 3. The only way to test is to hook up the RPi 3 to an HDMI monitor. If start.elf was successfully able to run, then a square with interpolated colors will appear on the screen. That paird with the ACT (green LED) flashing even after the square shows means that it most likely has loaded the kernel and started executing. As this lacks a UART example, it will be difficult to get concrete proof that the kernel has booted.
 
====How to Proceed====
 
If you are new to operating system development, I encourage you to take the time and read '''Basic Information''' section of OsDev's [https://wiki.osdev.org/Main_Page Main Page]. You should know they developing an operating system, even a microkernel, is difficult. The lack of explicit documentation is enough to frustrate novices and even experienced developers (which is exactly the main purpose of this series). The goal is to be patient and understand that what may be ahead is fun but also challanging. Continuing forward also means that you must be accustomed to and aware of the functionalities an operating system must provide. I also recommend that you take the time to go through the resources in Extra Resources to make sure you are acquainted with operating systems and their engineering for beginners and those who are familiar.
 
That being said, if you have committed to the project then take note that from this point on I will be focusing on RPi 3 development.
 
====Extra Resources====
* [https://pdos.csail.mit.edu/6.828/2017/xv6/book-rev10.pdf Short book on operating systems with reference implemenation]
* [https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-828-operating-system-engineering-fall-2012/ MIT OpenCourseWare class on operating system engineering]
Anonymous user