linker: ensured .bss comes after .data, and added map file output

This commit is contained in:
A.M. Rowsell 2025-12-21 14:40:15 -05:00
commit e3c9c7b642
Signed by: amr
GPG key ID: E0879EDBDB0CA7B1
4 changed files with 11 additions and 5 deletions

2
.gitignore vendored
View file

@ -11,6 +11,6 @@
*.srec *.srec
*.s19 *.s19
*.elf *.elf
*.map
AGENTS.md AGENTS.md
.pre-commit-config.yaml .pre-commit-config.yaml

View file

@ -2,9 +2,10 @@
# SPDX-FileCopyrightText: (c) 2025 A.M. Rowsell # SPDX-FileCopyrightText: (c) 2025 A.M. Rowsell
ASM=vasm_z80_std ASM=vasm_z80_std
LINK=vlink LINK=vlink
MAP=zone.map
ASMFLAGS=-Fvobj ASMFLAGS=-Fvobj
LINKFLAGS=-b ihex -T linker.cmd LINKFLAGS=-b ihex -T linker.cmd -M
all: zone.hex all: zone.hex
@ -21,9 +22,9 @@ boot.o: boot.asm
$(ASM) $(ASMFLAGS) -o $@ $< $(ASM) $(ASMFLAGS) -o $@ $<
zone.hex: float.o vectorTable.o zone.o boot.o linker.cmd zone.hex: float.o vectorTable.o zone.o boot.o linker.cmd
$(LINK) $(LINKFLAGS) -o $@ float.o vectorTable.o zone.o boot.o $(LINK) $(LINKFLAGS) -o $@ float.o vectorTable.o zone.o boot.o > $(MAP)
clean: clean:
rm -f float.o vectorTable.o zone.o boot.o zone.hex rm -f float.o vectorTable.o zone.o boot.o zone.hex $(MAP)
.PHONY: all clean .PHONY: all clean

View file

@ -5,6 +5,10 @@
.global os_warm_boot .global os_warm_boot
.extern os_main_loop .extern os_main_loop
; ==================================
; This is the cold boot entry point!
; It is linked to land at 0xC3C3
; ==================================
zone_setup: zone_setup:
ld sp, 0x6FFF ld sp, 0x6FFF
jp os_main_loop jp os_main_loop

View file

@ -6,5 +6,6 @@ SECTIONS
.boot 0xC3C3 : { *(.boot) *(boot) } .boot 0xC3C3 : { *(.boot) *(boot) }
.vectors 0xF000 : { *(.vectors) } .vectors 0xF000 : { *(.vectors) }
.data 0x7000 : { *(.data) } .data 0x7000 : { *(.data) }
.bss : { *(.bss) } __data_end = .;
.bss __data_end : { *(.bss) }
} }