The monitor's assembler takes GNU as directives (.org, .equ, .byte, .half, .word, .ascii, .string, .space, .align, .balign ...), # comments, 0x/0b numbers, '\n' constants, . for the current address, << >> ^ ~, %hi/%lo and the FP CSR short forms; the old ORG/DB/EQU/0FFH forms remain as aliases. The disassembler prints lower case and 0x hex as objdump does. The monitor is built with -msave-restore and puts .rodata first, to fit its ROM. BASIC gains UCASE$ and LCASE$. Manual, README and tests updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
22 lines
1.1 KiB
Bash
Executable File
22 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# Compile the monitor and write monitor.mem (its 32 KB bank) and monitor.bin;
|
|
# also out/monitor-host, the disassembler and assembler for the PC (tests).
|
|
set -e
|
|
cd "$(dirname "$0")"
|
|
source ../scripts/rv_env.sh
|
|
mkdir -p out
|
|
# -msave-restore: shared register saving, 2 KB smaller (the ROM is 32 KB)
|
|
CFLAGS="$RV_ARCH -Os -msave-restore -ffunction-sections -fdata-sections -fno-common -Wall -I../include"
|
|
${RV_PREFIX}gcc $CFLAGS -c -o out/crt0.o crt0.S
|
|
${RV_PREFIX}gcc $CFLAGS -c -o out/monitor.o monitor.c
|
|
${RV_PREFIX}gcc $CFLAGS -c -o out/string.o ../lib/string.c
|
|
${RV_PREFIX}gcc $CFLAGS -c -o out/setjmp.o ../lib/setjmp.S
|
|
${RV_PREFIX}gcc $RV_ARCH -nostdlib -nostartfiles -T monitor.ld -Wl,--gc-sections \
|
|
-Wl,--build-id=none -Wl,-Map,out/monitor.map -o out/monitor.elf \
|
|
out/crt0.o out/monitor.o out/string.o out/setjmp.o -lgcc
|
|
${RV_PREFIX}objcopy -O binary -j .text -j .data out/monitor.elf monitor.bin
|
|
${RV_PREFIX}nm -n out/monitor.elf > out/monitor.sym
|
|
python3 ../tools/bin2mem.py monitor.bin monitor.mem 8192
|
|
${RV_PREFIX}size out/monitor.elf
|
|
cc -O1 -Wall -o out/monitor-host monitor.c
|