mirror of
https://github.com/thamugadi/powerpc-ofw-boot.git
synced 2024-06-19 17:29:26 +00:00
Compare commits
2 Commits
e4435696ae
...
acfac4f69e
Author | SHA1 | Date | |
---|---|---|---|
|
acfac4f69e | ||
|
cf35510749 |
12
Makefile
12
Makefile
|
@ -2,7 +2,7 @@ MACHINE = mac99
|
||||||
PPC = powerpc-eabi
|
PPC = powerpc-eabi
|
||||||
QEMU = qemu-system-ppc
|
QEMU = qemu-system-ppc
|
||||||
RES = 1600x900x32
|
RES = 1600x900x32
|
||||||
|
CPU = g4
|
||||||
SOURCES_C = $(shell find src -name "*.c")
|
SOURCES_C = $(shell find src -name "*.c")
|
||||||
SOURCES_S = $(shell find src -name "*.s")
|
SOURCES_S = $(shell find src -name "*.s")
|
||||||
OBJECTS = $(SOURCES_C:.c=.elf) $(SOURCES_S:.s=.elf)
|
OBJECTS = $(SOURCES_C:.c=.elf) $(SOURCES_S:.s=.elf)
|
||||||
|
@ -26,8 +26,8 @@ bootinfo.txt: loader/load.fth loader/def.fth
|
||||||
cat loader/load.fth >> bootinfo.txt
|
cat loader/load.fth >> bootinfo.txt
|
||||||
echo "</boot-script></chrp-boot>" >> bootinfo.txt
|
echo "</boot-script></chrp-boot>" >> bootinfo.txt
|
||||||
|
|
||||||
kernel.elf: $(OBJECTS)
|
kernel.elf: linker.ld $(OBJECTS)
|
||||||
$(PPC)-ld -Ttext=0x02000000 -Tdata=0x02100000 $^ -o $@
|
$(PPC)-ld -T $^ -o $@
|
||||||
|
|
||||||
%.elf: %.c
|
%.elf: %.c
|
||||||
$(PPC)-gcc -I include -c $< -o $@
|
$(PPC)-gcc -I include -c $< -o $@
|
||||||
|
@ -40,7 +40,9 @@ clean:
|
||||||
find src -name "*.elf" -type f -delete
|
find src -name "*.elf" -type f -delete
|
||||||
|
|
||||||
run:
|
run:
|
||||||
$(QEMU) -hda *.APM -g $(RES) -machine $(MACHINE)
|
$(QEMU) -hda *.APM -g $(RES) -machine $(MACHINE) -cpu $(CPU)
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
$(QEMU) -hda *.APM -d in_asm -g $(RES) -machine $(MACHINE)
|
$(QEMU) -hda *.APM -d in_asm -g $(RES) -machine $(MACHINE) -cpu $(CPU)
|
||||||
|
gdb:
|
||||||
|
$(QEMU) -hda *.APM -s -S -g $(RES) -machine $(MACHINE) -cpu $(CPU)
|
||||||
|
|
21
linker.ld
Normal file
21
linker.ld
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
ENTRY(_start)
|
||||||
|
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
. = 0x02000000;
|
||||||
|
.text BLOCK(4K) : ALIGN(4K)
|
||||||
|
{
|
||||||
|
*(.text)
|
||||||
|
}
|
||||||
|
. = 0x02100000;
|
||||||
|
.data BLOCK(4K) : ALIGN(4K)
|
||||||
|
{
|
||||||
|
|
||||||
|
*(.rodata)
|
||||||
|
*(.data)
|
||||||
|
}
|
||||||
|
.bss BLOCK(4K) (NOLOAD) : ALIGN(4K)
|
||||||
|
{
|
||||||
|
*(.bss)
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,7 +3,7 @@
|
||||||
: inf dup sup 1 + ;
|
: inf dup sup 1 + ;
|
||||||
: diff = if 0 else -1 then ;
|
: diff = if 0 else -1 then ;
|
||||||
: fba frame-buffer-adr ;
|
: fba frame-buffer-adr ;
|
||||||
: beige-vram 80000000 ; : mac99-vram 81000000 ;
|
: beige-fba 80000000 ; : mac99-fba 81000000 ;
|
||||||
: hardware-error ." Hardware not supported." cr ;
|
: hardware-error ." Hardware not supported." cr ;
|
||||||
: beige-message ." Beige hardware detected" cr ;
|
: beige-message ." Beige hardware detected" cr ;
|
||||||
: mac99-message ." mac99 hardware detected" cr ;
|
: mac99-message ." mac99 hardware detected" cr ;
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
initmsg
|
initmsg
|
||||||
fba beige-vram = if beige-message beige-magic-number beige-vram c! then
|
fba beige-fba = if beige-message beige-magic-number beige-fba c! then
|
||||||
fba mac99-vram = if mac99-message mac99-magic-number mac99-vram c! then
|
fba mac99-fba = if mac99-message mac99-magic-number mac99-fba c! then
|
||||||
fba beige-vram = if screen-width 4 beige-vram + l! then
|
fba beige-fba = if screen-width 4 beige-fba + l! then
|
||||||
fba beige-vram = if screen-height 8 beige-vram + l! then
|
fba beige-fba = if screen-height 8 beige-fba + l! then
|
||||||
fba mac99-vram = if screen-width 4 mac99-vram + l! then
|
fba mac99-fba = if screen-width 4 mac99-fba + l! then
|
||||||
fba mac99-vram = if screen-height 8 mac99-vram + l! then
|
fba mac99-fba = if screen-height 8 mac99-fba + l! then
|
||||||
variable run
|
variable run
|
||||||
-1 run !
|
-1 run !
|
||||||
fba beige-vram diff fba mac99-vram diff and if hardware-error 0 run ! then
|
fba beige-fba diff fba mac99-fba diff and if hardware-error 0 run ! then
|
||||||
run @ 0 = if 1 0 do 0 +loop then
|
run @ 0 = if 1 0 do 0 +loop then
|
||||||
boot hd:,\boot\kernel.elf
|
boot hd:,\boot\kernel.elf
|
||||||
|
|
|
@ -13,6 +13,7 @@ void __eabi(void)
|
||||||
//void* ofw_interpret(char* cmd, int32_t* stack_args, int n_stack_args, int n_ret_args, int32_t* reta
|
//void* ofw_interpret(char* cmd, int32_t* stack_args, int n_stack_args, int n_ret_args, int32_t* reta
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
|
ofw_interpret("show-devs", 0, 0, 0, 0);
|
||||||
puts("Press any key to continue", 25);
|
puts("Press any key to continue", 25);
|
||||||
ofw_interpret("blink-screen", 0, 0, 0, 0);
|
ofw_interpret("blink-screen", 0, 0, 0, 0);
|
||||||
ofw_interpret("key", 0, 0, 1, (int32_t*)0x03020000);
|
ofw_interpret("key", 0, 0, 1, (int32_t*)0x03020000);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user