From 95b658897aa2f9039398bde46649dc3cd5ade4e3 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Mon, 17 Jun 2019 14:17:47 -0400 Subject: [PATCH] recipes/rc2014/zasm: add instructions to assemble kernel --- recipes/rc2014/zasm/Makefile | 14 ++++---------- recipes/rc2014/zasm/README.md | 44 +++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 12 deletions(-) diff --git a/recipes/rc2014/zasm/Makefile b/recipes/rc2014/zasm/Makefile index 93b06b6..f5f1942 100644 --- a/recipes/rc2014/zasm/Makefile +++ b/recipes/rc2014/zasm/Makefile @@ -1,9 +1,4 @@ -# source files required to build os.bin. We copy them in cfsin so that we can -# build the same kernel from within the RC2014. -KERNEL_SRCS = err.h acia.asm blockdev.asm blockdev_cmds.asm core.asm fs.asm \ - fs_cmds.asm mmap.asm parse.asm pgm.asm sdc.asm shell.asm stdio.asm - -CFSTARGETS = $(addprefix cfsin/, zasm sdct at28w user.h $(KERNEL_SRCS)) +CFSTARGETS = $(addprefix cfsin/, zasm sdct memt at28w user.h) BASE = ../../.. TOOLS = $(BASE)/tools ZASM = $(TOOLS)/zasm.sh @@ -29,15 +24,14 @@ cfsin/zasm: $(ZASMBIN) cfsin/sdct: $(ZASMBIN) $(ZASM) $(APPS) user.h < $(APPS)/sdct/glue.asm > $@ +cfsin/memt: $(ZASMBIN) + $(ZASM) $(APPS) user.h < $(APPS)/memt/glue.asm > $@ + cfsin/at28w: $(ZASMBIN) $(ZASM) $(APPS) $(KERNEL) user.h < $(APPS)/at28w/glue.asm > $@ cfsin/user.h: user.h cp $< $@ -cfsin/err.h: $(KERNEL)/err.h - cp $< $@ -cfsin/%.asm: $(KERNEL)/%.asm - cp $< $@ .PHONY: clean clean: diff --git a/recipes/rc2014/zasm/README.md b/recipes/rc2014/zasm/README.md index 8b22717..205ac2b 100644 --- a/recipes/rc2014/zasm/README.md +++ b/recipes/rc2014/zasm/README.md @@ -8,8 +8,6 @@ assembly to binary. Have a RC2014 assemble a Collapse OS kernel with its source living on a CFS on a SD card. -**Work in progress: for now, we compile a simple hello.asm source file.** - ## Gathering parts * Same parts as the [SD card recipe](../sdcard). @@ -59,3 +57,45 @@ Compiling and running `hello.asm` is done very much like in > That RC2014 is starting to feel powerful now, right? + +## Test your hardware + +Now that you have a fully functional filesystem that can load programs and run +them easily, you'll see that this recipe's CFS include a couple of programs +besides `zasm`. Among them, there's `sdct` that stress tests reading and +writing on the SD card and `memt` that stress tests RAM. You might be +interested in running them. Look at their description in `apps/`. All you need +to to do run them is to type their name. + +## Assembling the kernel + +Now let's go for something a little more fun! Jiu-jitsu? No, you're not going to +learn jiu-jitsu! You're going to assemble the kernel from within your RC2014! + +The makefile doesn't prepare a CFS blob for this, let's learn to build that blob +yourself. First of all, we'll need to have what we already had in `sdcard.cfs` +because it has `zasm` and `user.h`. But we're going to add the contents of +the `/kernel/` directory to it. + + $ cp ../../../kernel/*.{h,asm} cfsin + +You'll also need your glue file (at this time, the RC2014 can't assemble the +kernel of this very recipe, I'm not sure why. It can, however, assemble the +simpler kernel of the base RC2014 recipe. We'll use this one): + + $ cp ../glue.asm cfsin + +You're now ready to re-make your CFS: + + $ rm sdcard.cfs && make + +Now you can write this into your card and boot Collapse OS: + + Collapse OS + > sdci + > fson + > fopn 0 glue.asm + > fnew 10 dest + > fopn 1 dest + > zasm 1 2 # This takes a while. About 3 minutes. + > sdcf # success! sdcf flushes SD card buffers to the card.