Skip to content

Commit

Permalink
Updated 21_day/harib18c with app.lds
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreyc2017 committed Jul 15, 2024
1 parent 37b25ba commit 2016cb3
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
8 changes: 4 additions & 4 deletions projects/21_day/harib18c/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ a_nask.obj: a_nask.nas

a.hrb: a_nask.obj a.c
$(CC) $(APP_CFLAGS) -c a.c -o a.obj
$(LD) $(APP_LDFLAGS) --oformat binary a.obj a_nask.obj -o $@
$(LD) $(APP_LDFLAGS) --oformat binary a.obj a_nask.obj -o $@ -T app.lds

hello3.hrb: a_nask.obj hello3.c
$(CC) $(APP_CFLAGS) -c hello3.c -o hello3.obj
$(LD) $(APP_LDFLAGS) --oformat binary hello3.obj a_nask.obj -o $@
$(LD) $(APP_LDFLAGS) --oformat binary hello3.obj a_nask.obj -o $@ -T app.lds

crack1.hrb: crack1.c
$(CC) $(APP_CFLAGS) -c crack1.c -o crack1.obj
$(LD) $(APP_LDFLAGS) --oformat binary crack1.obj -o $@
$(LD) $(APP_LDFLAGS) --oformat binary crack1.obj -o $@ -T app.lds

haribote.img: ipl10.bin haribote.sys \
hello.hrb hello2.hrb a.hrb hello3.hrb crack1.hrb
Expand All @@ -120,7 +120,7 @@ haribote.img: ipl10.bin haribote.sys \
# copy to 0x4200
mcopy -i $@ haribote.sys ::/
mcopy -i $@ ipl10.nas ::/
mcopy -i $@ Makefile ::/
mcopy -i $@ make.bat ::/
mcopy -i $@ hello.hrb ::/
mcopy -i $@ hello2.hrb ::/
mcopy -i $@ a.hrb ::/
Expand Down
31 changes: 31 additions & 0 deletions projects/21_day/harib18c/app.lds
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
This linker script is created by refer following page.
https://vanya.jp.net/os/haribote.html
*/

OUTPUT_FORMAT("binary");

SECTIONS
{
.head 0x0 : {
LONG(128 * 1024) /* 0 : stack+.data+heap の大きさ(4KBの倍数) */
LONG(0x69726148) /* 4 : シグネチャ "Hari" */
LONG(0) /* 8 : mmarea の大きさ(4KBの倍数) */
LONG(0x0400) /* 12 : スタック初期値&.data転送先 */
LONG(SIZEOF(.data)) /* 16 : .dataサイズ */
LONG(LOADADDR(.data)) /* 20 : .dataの初期値列のファイル位置 */
LONG(0xE9000000) /* 24 : 0xE9000000 */
LONG(_HariMain - 0x20) /* 28 : エントリアドレス - 0x20 */
LONG(24*1024) /* 32 : heap領域(malloc領域)開始アドレス */
}

.text : { *(.text) }

.data 0x0400 : AT ( ADDR(.text) + SIZEOF(.text) ) {
*(.data)
*(.rodata*)
*(.bss)
}

/DISCARD/ : { *(.eh_frame) }
}
1 change: 1 addition & 0 deletions projects/21_day/harib18c/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9

0 comments on commit 2016cb3

Please sign in to comment.