run: bare-metal hello boots on cortex-a7, emmc 8GiB real GPT33

This commit is contained in:
SashegDev
2026-09-07 08:46:07 +00:00
parent 5378d02ace
commit c7dcda0200
4 changed files with 145 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
/* hello guest: proves qemu cortex-a7 pipeline on zern. virt UART0 0x09000000. */
#define UART0 ((volatile unsigned int *)0x09000000)
static void uart_putc(char c) { *UART0 = (unsigned int)c; }
static void uart_puts(const char *s) { while (*s) uart_putc(*s++); }
void main(void) {
uart_puts("SAIMAA-STUB: cortex-a7 alive, RAM ok\r\n");
uart_puts("SAIMAA-STUB: next -> PBL reads SBL1 LBA 90112\r\n");
while (1) { }
}
Executable
+15
View File
@@ -0,0 +1,15 @@
#!/bin/bash
# run.sh — первый запуск: bare-metal hello на cortex-a7 + наш emmc.img на SDHCI.
# Ожидаем UART-привет. Это проверка трубы, не загрузка Lumia.
set -e
cd "$(dirname "$0")/.."
IMG=${IMG:-/tmp/emmc-test.img}
arm-none-eabi-gcc -nostartfiles -nostdlib -mcpu=cortex-a7 -marm \
-Wl,-Ttext=0x40008000 -o /tmp/hello.elf qemu/start.S qemu/hello.c 2>/dev/null
arm-none-eabi-objcopy -O binary /tmp/hello.elf /tmp/hello.bin
echo "[run] guest built, starting qemu (10s timeout)..."
timeout 10 qemu-system-arm -M virt -cpu cortex-a7 -m 1024 -nographic \
-kernel /tmp/hello.elf \
-drive file="$IMG",if=none,format=raw,id=emmc \
-device sdhci-pci -device sd-card,drive=emmc 2>&1 | head -10
echo "[run] exit=$? (124 = timeout после вывода = OK для вечного цикла)"
+8
View File
@@ -0,0 +1,8 @@
.section .text
.global _start
.arm
_start:
ldr sp, =0x40200000
bl main
hang:
b hang