зеркало из https://github.com/microsoft/Komodo.git
stub "kernel"/makefile that boots in qemu
This commit is contained in:
Родитель
46835a613f
Коммит
5f127b9492
|
@ -0,0 +1,4 @@
|
|||
*.o
|
||||
kernel7.elf
|
||||
kernel7.img
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
PREFIX ?= arm-none-eabi-
|
||||
AS = $(PREFIX)as
|
||||
CC = $(PREFIX)gcc
|
||||
LD = $(PREFIX)ld
|
||||
OBJCOPY = $(PREFIX)objcopy
|
||||
|
||||
CFLAGS = -Wall -Werror -ffreestanding -march=armv7-a
|
||||
LDFLAGS = -nostdlib
|
||||
|
||||
KERNELBASE=0x8000
|
||||
|
||||
kernel7.img: kernel7.elf
|
||||
$(OBJCOPY) $< -O binary $@
|
||||
|
||||
kernel7.elf: entry.o main.o
|
||||
$(LD) $(LDFLAGS) -o $@ -Ttext=$(KERNELBASE) $^
|
||||
|
||||
clean::
|
||||
$(RM) kernel7.elf kernel7.img *.o
|
||||
|
||||
debug: kernel7.img kernel7.elf
|
||||
qemu-system-arm -M raspi2 -nographic -bios $< -gdb tcp:127.0.0.1:1234 -S & \
|
||||
QEMUPID=$$! \
|
||||
$(PREFIX)gdb --symbols=kernel7.elf -ex 'target remote :1234' \
|
||||
kill $$QEMUPID
|
|
@ -0,0 +1,12 @@
|
|||
.section .text
|
||||
.global _start
|
||||
|
||||
_start:
|
||||
ldr sp, =stack_top
|
||||
b main
|
||||
|
||||
.section .bss
|
||||
.align 3 // 8-byte alignment
|
||||
stack_end:
|
||||
.skip 0x4000
|
||||
stack_top:
|
|
@ -0,0 +1,5 @@
|
|||
void __attribute__((noreturn))
|
||||
main(void)
|
||||
{
|
||||
while (1) {}
|
||||
}
|
Загрузка…
Ссылка в новой задаче