Rock64 - Simple Bare-Metal Example - Printable Version +- PINE64 (https://forum.pine64.org) +-- Forum: ROCK64 (https://forum.pine64.org/forumdisplay.php?fid=85) +--- Forum: Rock64 Tutorials (https://forum.pine64.org/forumdisplay.php?fid=90) +--- Thread: Rock64 - Simple Bare-Metal Example (/showthread.php?tid=10079) |
Rock64 - Simple Bare-Metal Example - krjdev - 06-05-2020 Hi, I wrote a simple Bare-Metal example for the Rock64. It just sends a few strings over the UART interface and if a special char will be received, the program resets the Rock64. The main entry point of the program (written in Assembler): Code: #include <asm.h> It's a minimal setup. It just disables the MMU and the Alignment checks. Then it reads the processor ID and let only CPU0 run the C main entry point (kern_main). The C main entry point: Code: #include <dev/cru.h> Should be self explaining. There is also as very simple UART driver and the CRU driver for resetting the board. The code includes a very minimal C String library.Only GCC for AArch64 is needed. To start the application, U-Boot is needed. I have attached the full code. The code is also on my GitHub page available. Edit: Oops! There is a bug in the attached archive. Simple change the following line in the file start.S... Code: ldr x0, =_kern_stack_s to.. Code: ldr x0, =_kern_stack_e RE: Rock64 - Simple Bare-Metal Example - krjdev - 01-24-2021 Hi, I'm currently working on a new release for the bare-metal example. Current reached milestones: - Successfully implemented MMU support (Had some troubles with the translation tables in the past.) - Implemented cleaning and invalidating for the Instruction and data cache - Switching from EL2 (Hypervisor) to EL1 (Kernel) Currently working on the implementation of syscalls. Feature of the new release: - Simple kernel (EL1) for exception/interrupt handling, device and memory management - Small libc for userland (EL0) New release available soon. The actual status is available at the next branch. |