CEO 亲自写代码登上GitHub 热榜,从零开始打造 “裸金属” 树莓派!
码农有道公众号
共 2065字,需浏览 5分钟
·
2021-11-15 07:45
从启动硬件到 Hello World
CFILES = $(wildcard *.c)OFILES = $(CFILES:.c=.o)GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -nostartfilesGCCPATH = ../../gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/binall: clean kernel8.imgboot.o: boot.S$(GCCPATH)/aarch64-none-elf-gcc $(GCCFLAGS) -c boot.S -o boot.o%.o: %.c$(GCCPATH)/aarch64-none-elf-gcc $(GCCFLAGS) -c $< -o $@kernel8.img: boot.o $(OFILES)$(GCCPATH)/aarch64-none-elf-ld -nostdlib boot.o $(OFILES) -T link.ld -o kernel8.elf$(GCCPATH)/aarch64-none-elf-objcopy -O binary kernel8.elf kernel8.imgclean:/bin/rm kernel8.elf .o .img > /dev/null 2> /dev/null || true
void main()
{
uart_init();
uart_writeText(“Hello world!\n”);
while (1);
}
关于作者
[1]https://github.com/isometimes/rpi4-osdev
[2]https://www.rpi4os.com
[3]https://twitter.com/isometim_es/status/1446359865274871818
[4]https://news.ycombinator.com/item?id=2877402
评论