Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/mainargs with " #85

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ jobs:
- uses: actions/checkout@v2
with:
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
submodules: recursive
- name: Set job variables
id: job_vars
run: |
Expand Down Expand Up @@ -136,18 +137,20 @@ jobs:
git clone https://github.com/orix-software/docker-unit-test.git
cd docker-unit-test && bash install.sh ${GITHUB_WORKSPACE} && cd ..
cp build/usr/share/kernel/kernelsd.rom ${GITHUB_WORKSPACE}/oricutron/roms/kernel.rom
cat tests/unit_test/xopen.sub > ${GITHUB_WORKSPACE}/oricutron/sdcard/ETC/AUTOBOOT
cat tests/unit_test/xrm.sub >> ${GITHUB_WORKSPACE}/oricutron/sdcard/ETC/AUTOBOOT
cat tests/unit_test/xopen.sub > ${GITHUB_WORKSPACE}/oricutron/sdcard/ETC/AUTOBOOT
cat tests/unit_test/xrm.sub >> ${GITHUB_WORKSPACE}/oricutron/sdcard/ETC/AUTOBOOT
#cp mainarg ${GITHUB_WORKSPACE}/oricutron/sdcard/BIN
#cat mainarg >> ${GITHUB_WORKSPACE}/oricutron/sdcard/ETC/AUTOBOOT
cd ${GITHUB_WORKSPACE}/oricutron
timeout --preserve-status 5 ./xvfb.sh || exit 0
timeout --preserve-status 10 ./xvfb.sh || exit 0

- name: Check unit-test
run: |
ls -l ${GITHUB_WORKSPACE}/oricutron/sdcard/
bash tests/unit_test/verify.sh ${GITHUB_WORKSPACE}/oricutron/sdcard/

- name: Upload Artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: ${{ steps.job_vars.outputs.REPO_NAME }}
path: |
Expand All @@ -159,8 +162,6 @@ jobs:
mv ../cc65 . && mv ../orix-software . && mv ../orix-sdk . && mv ../md2hlp .
ls -l



upload:
needs: build
runs-on: ubuntu-22.04
Expand Down
97 changes: 65 additions & 32 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ CFLAGS=-ttelestrat
ASFLAGS=-ttelestrat
LDFILES=

all : init kernel memmap
all : init kernel memmap unittest
.PHONY : all

SOURCE=src/kernel.asm

PROGRAM_NAME=kernel

ifeq ($(CC65_HOME),)
CC = cl65
AS = ca65
LD = ld65
AR = ar65
CC = cl65
AS = ca65
LD = ld65
AR = ar65
else
CC = $(CC65_HOME)/bin/cl65
AS = $(CC65_HOME)/bin/ca65
LD = $(CC65_HOME)/bin/ld65
AR = $(CC65_HOME)/bin/ar65
CC = $(CC65_HOME)/bin/cl65
AS = $(CC65_HOME)/bin/ca65
LD = $(CC65_HOME)/bin/ld65
AR = $(CC65_HOME)/bin/ar65
endif

PATH_PACKAGE_ROM=build/usr/share/$(PROGRAM_NAME)/
Expand All @@ -37,40 +37,73 @@ init:
kernel: $(SOURCE)
@echo Rom are built in $(PATH_PACKAGE_ROM)
@echo Build kernelsd.rom for Twilighte board
@$(AS) --verbose -s -tnone --debug-info -o kernelsd.ld65 -DWITH_SDCARD_FOR_ROOT=1 $(SOURCE) $(ASFLAGS) > output.log
@$(LD) -C src/kernel.cfg kernelsd.ld65 -m kernelsd.map -DWITH_SDCARD_FOR_ROOT=1 -DWITH_TWILIGHTE_BOARD=1 -Ln kernelsd.sym > output.log
@$(AS) --cpu 6502 -tnone src/functions/strings/xminma.asm -o tmp/xminma.o
@$(AS) --cpu 6502 -tnone src/functions/bank_mng/search_free_bank.s -o tmp/search_free_bank.o
@$(AS) --cpu 6502 -tnone src/functions/bank_mng/kernel_free_bank.s -o tmp/kernel_free_bank.o
@$(AS) --cpu 6502 -tnone src/functions/bank_mng/kernel_free_bank_by_pid.s -o tmp/kernel_free_bank_by_pid.o
@$(AR) r tmp/kernel.lib tmp/xminma.o
@$(AR) r tmp/kernel.lib tmp/switch_to_kernel_extended.o
@$(AR) r tmp/kernel.lib tmp/kernel_restore_banking_states.o
@$(AR) r tmp/kernel.lib tmp/xbank_routine.o
@$(AR) r tmp/kernel_bank8.lib tmp/init_network.o
@$(AR) r tmp/kernel_bank8.lib tmp/search_free_bank.o
@$(AR) r tmp/kernel_bank8.lib tmp/kernel_free_bank.o
@$(AR) r tmp/kernel_bank8.lib tmp/kernel_free_bank_by_pid.o
@$(AR) r tmp/kernel_bank8.lib tmp/xsocket.o
@$(AR) r tmp/kernel_bank8.lib tmp/xconnect.o
@$(AR) r tmp/kernel_bank8.lib tmp/xsend.o
@$(AR) r tmp/kernel_bank8.lib tmp/xclose_socket.o


@$(AS) --cpu 6502 -DWITH_SDCARD_FOR_ROOT=1 --verbose -s -ttelestrat src/kernel_main_memory.s -o tmp/kernel_main_memory.ld65
@$(AS) --verbose -s -tnone --debug-info --cpu 6502 -tnone src/kernel8/src/kernel8.s -o tmp/kernel_bank8.ld65 $(ASFLAGS) > output.log
@$(AS) --verbose -s -tnone --debug-info -o kernel_bank0.ld65 -DWITH_SDCARD_FOR_ROOT=1 src/kernel_bank0.s $(ASFLAGS) > output.log
@$(AS) --verbose -s -tnone --debug-info -o kernelsd.ld65 -DWITH_SDCARD_FOR_ROOT=1 $(SOURCE) $(ASFLAGS) > output.log

@$(AS) --cpu 6502 -DWITH_SDCARD_FOR_ROOT=1 --verbose -s -ttelestrat src/kernel_bank0.s -o tmp/kernel_bank0.ld65 --debug-info > memmap.md
@$(LD) -C cfg/rom.cfg tmp/kernel_bank8.ld65 tmp/kernel_bank0.ld65 tmp/kernel_main_memory.ld65 tmp/kernel_bank8.lib src/kernel8/orixlibs/ksocket/usr/share/ksocket/2025.1/ksocket.lib src/kernel8/orixlibs/ch395/usr/share/ch395/2024.4/ch395.lib -o kernel8.rom -Ln tmp/kernel8sd.sym -m tmp/memmap8.txt -vm


@cp kernel.rom kernelsd.rom
@sed -re 's/al 00(.{4}) \.(.+)$$/\1 \2/' kernelsd.sym| sort > kernelsd2.sym > output.log
#@sed -re 's/al 00(.{4}) \.(.+)$$/\1 \2/' kernelsd.sym| sort > kernelsd2.sym > output.log
@cp kernelsd.rom $(PATH_PACKAGE_ROM)/
@cp kernelsd.sym $(PATH_PACKAGE_ROM)/
@cp kernelsd.map $(PATH_PACKAGE_ROM)/
#@cp kernelsd.sym $(PATH_PACKAGE_ROM)/
#@cp kernelsd.map $(PATH_PACKAGE_ROM)/

@echo Build kernelus.rom for Twilighte board
@echo "########################################################"
@echo "# Build kernelus.rom for Twilighte board #"
@echo "########################################################"
@$(AS) --verbose -s -tnone --debug-info -o kernel_bank0.ld65 -DWITH_TWILIGHTE_BOARD=1 src/kernel_bank0.s $(ASFLAGS) > output.log
@echo "WITH_TWILIGHTE_BOARD">$(PATH_PACKAGE_ROM)/kernelus.lst
@$(AS) --verbose -s -tnone --debug-info -o kernelus.ld65 $(SOURCE) $(ASFLAGS) > output.log
@$(LD) -C src/kernel.cfg kernelus.ld65 -m kernelus.map -DWITH_TWILIGHTE_BOARD=1 -Ln kernelus.sym > output.log
@$(LD) -C cfg/kernel.cfg tmp/kernelsd.ld65 tmp/kernel_bank0.ld65 tmp/kernel_main_memory.ld65 tmp/kernel.lib -m kernelus.map -DWITH_TWILIGHTE_BOARD=1 -Ln kernelus.sym > output.log
@cp kernel.rom kernelus.rom
@cp kernelus.rom $(PATH_PACKAGE_ROM)/

unittest:
$(CC) $(CFLAGS) tests/mkdir.c -o tmkdir
$(CC) $(CFLAGS) tests/fwrite.c -o tfwrite
@$(CC) $(CFLAGS) tests/mkdir.c -o tmp/tmkdir
@$(CC) $(CFLAGS) tests/fwrite.c -o tmp/tfwrite
@$(CC) $(CFLAGS) tests/unit_test/mainarg.s -I dependencies/orix-sdk/macros/ -o tmp/1000 --start-addr 2048
@$(CC) $(CFLAGS) tests/unit_test/mainarg.s -I dependencies/orix-sdk/macros/ -o tmp/1256 --start-addr 2304

memmap:
@$(AS) --verbose -s -tnone --debug-info -o kernel-telestrat.ld65 -DWITH_SDCARD_FOR_ROOT=1 $(SOURCE) $(ASFLAGS) > memmap.md
@$(LD) -C src/kernel.cfg kernel-telestrat.ld65 -m kernel.map -o kernel-telestrat.ld65.rom -DWITH_ACIA=2 -DWITH_SDCARD_FOR_ROOT=1 -Ln kernel-telestrat.ca.sym
sh generate_memmap.sh
@echo "########################################################"
@echo "# Build memmap.md #"
@echo "########################################################"
@$(AS) --cpu 6502 -DMEMMAP_GENERATE=1 --verbose -s -ttelestrat src/kernel_main_memory.s -o tmp/kernel_main_memory.ld65 > memmap.md
#@$(LD) -C cfg/kernel.cfg tmp/kernelsd.ld65 tmp/kernel_bank0.ld65 tmp/kernel_main_memory.ld65 tmp/kernel.lib -m kernelus.map -o kernel-telestrat.ld65.rom -DWITH_ACIA=2 -DWITH_SDCARD_FOR_ROOT=1 -Ln kernel-telestrat.ca.sym
@sh generate_memmap.sh

test:
cp Makefile build/usr/src/kernel/
cp README.md build/usr/src/kernel/
cp src/* build/usr/src/kernel/ -adpR
cp README.md build/usr/share/doc/$(PROGRAM_NAME)/
ls -l $(HOMEDIR)
export ORIX_PATH=`pwd`
sh tools/builddocs.sh
cd build && tar -c * > ../$(PROGRAM_NAME).tar && cd ..
filepack $(PROGRAM_NAME).tar $(PROGRAM_NAME).pkg
gzip $(PROGRAM_NAME).tar
mv $(PROGRAM_NAME).tar.gz $(PROGRAM_NAME).tgz
@cp Makefile build/usr/src/kernel/
@cp README.md build/usr/src/kernel/
@cp src/* build/usr/src/kernel/ -adpR
@cp README.md build/usr/share/doc/$(PROGRAM_NAME)/
@ls -l $(HOMEDIR)
@export ORIX_PATH=`pwd`
@sh tools/builddocs.sh
@cd build && tar -c * > ../$(PROGRAM_NAME).tar && cd ..
@filepack $(PROGRAM_NAME).tar $(PROGRAM_NAME).pkg
@gzip $(PROGRAM_NAME).tar
@mv $(PROGRAM_NAME).tar.gz $(PROGRAM_NAME).tgz

50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,53 @@ here is the list of available "compile option"
* Kernel tries to start binary set in his rom label 'str_binary_to_start'
* it allocates a process struct (first malloc)
* and register it in processlist


## generate .inc

MEMORY {
#...

KRNL1: file = "kernel.rom", start = $C000, size = $3FFF;
KRNL2: file = "kernel2.rom", start =$C000, size = $3FFF;
INCL: file="kernel2.inc", start=$0000, size = $FFFF;
}
SEGMENTS {
# ...
KERNEL: load = KRNL1, type = ro, define = yes, optional = yes;
EXTEND: load = KRNL2, type = ro, define = yes, optional = yes;
INCLUDE: load = INCL, optional = yes;
}




.feature org_per_seg
.pushseg
.segment "EXTEND"
.org $C000 ;


; .segment "KERNEL"
; .org $C000


.popseg
Macro


.macro addsym symbole
.pushseg
.segment "INCLUDE"
.byte .sprintf("%s = $%x", .string(symbole), symbole)
.popseg
.endmacro

Et enfin, pour ajouter un symbole dans le fichier .inc:

.proc xvalue_routine
lda #$00
....
.endproc

addsym xvalue_routine
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024.1
2025.1
58 changes: 58 additions & 0 deletions cfg/kernel.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
FEATURES {
STARTADDRESS: default = $1000;
}
SYMBOLS {
__STACKSIZE__: type = weak, value = $0800; # 2k stack
__STACKSTART__: type = weak, value = $8000;
__ZPSTART__: type = weak, value = $0080;
}
MEMORY {
ZP: file = "", define = yes, start = __ZPSTART__, size = $001F;
MAIN: file = %O, start = %S, size = __STACKSTART__ - __STACKSIZE__ - %S;

BANK7: type = ro, start = $C000, size = $4000-16, file = "kernel.rom", fill = yes;
ORIXVEC7: start = $FFF0, size = 10 , file = "kernel.rom", fill = yes;
CPUVEC7: start = $FFFA, size = 6 , file = "kernel.rom", fill = yes;
INCL: file = "kernel_inc.inc", start=$0000, size = $FFFF;

}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
STARTUP: load = MAIN, type = ro, define = yes, optional = yes;
LOWCODE: load = MAIN, type = ro, define = yes, optional = yes;
ONCE: load = MAIN, type = ro, define = yes, optional = yes;
CODE: load = MAIN, type = rw, define = yes, optional = yes;
RODATA: load = MAIN, type = rw, define = yes, optional = yes;
DATA: load = MAIN, type = rw, define = yes, optional = yes;
BSS: load = MAIN, type = bss, define = yes, optional = yes;

SIGNATURE: load = MAIN, type = ro, define = yes, optional = yes;
INCLUDE: load = INCL, optional = yes;
# BANK8: load = BANK8, type = ro;
# ORIXVECT8: load = ORIXVEC8, type = ro, define = yes, optional = yes;
# CPUVECT8: load = CPUVEC8, type = ro, define = yes, optional = yes;

BANK7: load = BANK7 , type = ro, define = yes;
ORIXVECT7: load = ORIXVEC7, type = ro, define = yes;
CPUVECT7: load = CPUVEC7, type = ro, define = yes;

# BANK0: load = BANK0, type = ro;
# ORIXVECT0: load = ORIXVEC0, type = ro, define = yes, optional = yes;
# CPUVECT0: load = CPUVEC0, type = ro, define = yes, optional = yes;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
segment = RODATA;
CONDES: type = interruptor,
label = __INTERRUPTOR_TABLE__,
count = __INTERRUPTOR_COUNT__,
segment = RODATA,
import = __CALLIRQ__;
}

82 changes: 82 additions & 0 deletions cfg/kernel_bank8.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
FEATURES {
STARTADDRESS: default = $C000;
}
SYMBOLS {
__STACKSIZE__: type = weak, value = $0800; # 2k stack
__STACKSTART__: type = weak, value = $8000;
__ZPSTART__: type = weak, value = $0080;
}
MEMORY {
ZP: file = "", define = yes, start = __ZPSTART__, size = $001F;
MAIN: file = %O, start = %S, size = $10000 - %S - 16, fill = yes, fillval = $ff;

BANK8: type = ro, start = $C000, size = $4000-16, file = "kernel8.rom", fill = yes;
ORIXVEC: start = $FFF0, size = 10 , file = "kernel8.rom", fill = yes;
CPUVEC: start = $FFFA, size = 6 , file = "kernel8.rom", fill = yes;
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
STARTUP: load = MAIN, type = ro, optional = yes;
LOWCODE: load = MAIN, type = ro, optional = yes;
ONCE: load = MAIN, type = ro, optional = yes;
CODE: load = MAIN, type = rw;
RODATA: load = MAIN, type = rw;
DATA: load = MAIN, type = rw;
BSS: load = MAIN, type = bss, define = yes, optional = yes;
# BSS: load = MAIN, type = bss, define = yes;
SIGNATURE: load = MAIN, type = ro, define = yes, optional = yes;
ORIXVECT: load = ORIXVEC, type = ro, define = yes;
CPUVECT: load = CPUVEC, type = ro, define = yes;
BANK8: load = BANK8 , type = ro, define = yes;

}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
segment = RODATA;
CONDES: type = interruptor,
label = __INTERRUPTOR_TABLE__,
count = __INTERRUPTOR_COUNT__,
segment = RODATA,
import = __CALLIRQ__;
}

# FEATURES {
# STARTADDRESS: default = $C000;
# }
# SYMBOLS {
# # __STACKSIZE__: type = weak, value = $0800; # 2k stack
# # __STACKSTART__: type = weak, value = $8000;
# # __ZPSTART__: type = weak, value = $0080;
# }
# MEMORY {
# # ZP: file = "", define = yes, start = __ZPSTART__, size = $001F;
# MAIN: file = %O, start = %S, size = $4000;

# # BANK8: type = ro, start = $C000, size = $4000-16, file = "kernel8.rom", fill = yes;

# # CPUVEC8: start = $FFFA, size = 6 , file = "kernel8.rom", fill = yes;
# }
# SEGMENTS {
# # ZEROPAGE: load = ZP, type = zp;
# # STARTUP: load = MAIN, type = ro, define = yes, optional = yes;
# # LOWCODE: load = MAIN, type = ro, define = yes, optional = yes;
# # ONCE: load = MAIN, type = ro, define = yes, optional = yes;
# CODE: load = MAIN, type = ro, define = yes, optional = yes;
# # RODATA: load = MAIN, type = ro, define = yes, optional = yes;
# # DATA: load = MAIN, type = ro, define = yes, optional = yes;
# # BSS: load = MAIN, type = bss, define = yes, optional = yes;

# # SIGNATURE: load = MAIN, type = ro, define = yes, optional = yes;

# # BANK8: load = BANK8, type = ro;
# # ORIXVECT8: load = ORIXVEC8, type = ro, define = yes, optional = yes;
# # CPUVECT8: load = CPUVEC8, type = ro, define = yes, optional = yes;


# }
Loading
Loading