Lab4: Multitasking
lab4 在概念上不會太難,難的是組語和 c 語言間的交替使用。例如,手動分配好 kernel stack,用 asm 寫入 sp, fp:
1 | asm volatile("msr tpidr_el1, %[task]\n\t" |
Lab3: Question and Elective
Lab3: Switch from EL2 to EL0
Lab3: ARM Exception and Interrupt
Exception and Interrupt
Reference: Exception types
造成程式暫停並切換 context 的事件稱為 exception (其他處理器架構可能將其描述為 interrupt),可分為:
- synchronous exception
- asynchronous exception
Lab2: Load Kernel Image
Rpi3 開機流程
Rpi3’s booting procedure could be roughly divided into 4 steps.
- GPU executes the first stage bootloader from ROM on the SoC.
- The first stage bootloader recognizes the FAT16/32 file system and loads the second stage bootloader
bootcode.binfrom SD card to L2 cache. bootcode.bininitializes SDRAM and loadsstart.elfstart.elfinitializes GPU’s firmware and readsconfig.txt,cmdline.txtandkernel8.imgto start OS.
Lab2: Splash
在啟動時,透過mailbox設定GPU framebuffer顯示splash image。
Lab2: PL011 UART
Mini UART基於system clock,PL011有著自己的clock,兩著皆可藉由mailbox去設定clock,之後在基於clock去設定baud rate register。
Lab2: Mailbox
CPU透過呼叫VideoCoreIV(GPU) routine來設定peripheral像是clock rate及framebuffer,Mailbox充當CPU和VideoCoreIV之間的橋。
目標:用Mailbox
- 取得board revision及VC Core base address
- 設定UART clock,並取代PL011 UART為mini UART
- 設定framebuffer,啟動時顯示splash image