Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
e3352fab06
|
|||
b4d44f4e84
|
|||
da1d22988e
|
|||
cc8a9fc95f
|
|||
a0427ad949
|
@@ -1,13 +1,5 @@
|
|||||||
# chibi pc-09
|
# chibi pc-09
|
||||||
|
|
||||||
## Archived!
|
|
||||||
|
|
||||||
This repo has been archived, and the different parts have been migrated to other repos.
|
|
||||||
|
|
||||||
The PCB for prototype 1 has been moved to https://gitea.ambersplace.net/chibi/pc09-prototype-1
|
|
||||||
|
|
||||||
The firmware has been moved to https://gitea.ambersplace.net/chibi/chibi-firmware
|
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
|
3
code/boot/.gitignore
vendored
3
code/boot/.gitignore
vendored
@@ -5,3 +5,6 @@
|
|||||||
*.s19
|
*.s19
|
||||||
map.txt
|
map.txt
|
||||||
build/
|
build/
|
||||||
|
|
||||||
|
# Build system generated files
|
||||||
|
src/version.s
|
||||||
|
@@ -1,31 +1,37 @@
|
|||||||
# Boot Firmware for CHIBI PC-09
|
# Boot Firmware for CHIBI PC-09
|
||||||
|
|
||||||
TODO: Description of what the firmware does for the PC-09.
|
This is the firmware for the CHIBI PC-09. In the future it will provide the
|
||||||
|
CHIBI with initialization code, a UART driver, some self test features.
|
||||||
|
|
||||||
## Building the Firmware
|
## Building the Firmware
|
||||||
|
|
||||||
You will need GNU `make`, and [`asm6809`](https://www.6809.org.uk/asm6809) to
|
Building the firmware from source requires [LWTOOLS](http://www.lwtools.ca/) for
|
||||||
build the firmware. Obtaining a working copy of `asm6809` could be difficult if
|
building S-Records of the ROM, and `mot2bin` from
|
||||||
you aren't on Debian, Ubuntu, or Windows as instructions for building it are not
|
[F9DASM](https://github.com/Arakula/f9dasm) for building binary images. A GNU
|
||||||
given on the `asm6809` website. Functional instructions for building from Git or
|
Make makefile is provided for building on Linux.
|
||||||
tarball are given here:
|
|
||||||
|
### Using the Makefile
|
||||||
|
|
||||||
|
To generate an S-Record run:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone https://www.6809.org.uk/git/asm6809.git
|
make generate
|
||||||
cd asm6809
|
make boot.s19
|
||||||
./configure
|
|
||||||
make
|
|
||||||
sudo make install
|
|
||||||
```
|
```
|
||||||
|
|
||||||
From there all you should have to do to generate a `boot.bin` is:
|
To generate a binary run:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone https://github.com/amberisvibin/chibi-pc09.git
|
make generate
|
||||||
cd chibi-pc09/code/boot
|
|
||||||
make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The makefile also can clean up after itself:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
make clean
|
||||||
|
```
|
||||||
|
|
||||||
## Firmware Licensing
|
## Firmware Licensing
|
||||||
|
|
||||||
This firmware like the rest of the CHIBI PC-09 is licensed under the MIT
|
This firmware like the rest of the CHIBI PC-09 is licensed under the MIT
|
||||||
|
33
code/boot/genver.sh
Executable file
33
code/boot/genver.sh
Executable file
@@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# Script to generate version information
|
||||||
|
|
||||||
|
# Current git tag
|
||||||
|
TAG="$(git describe --always --dirty --tags)"
|
||||||
|
DATE="$(date)"
|
||||||
|
|
||||||
|
# Output filename
|
||||||
|
OUTFILE='src/version.s'
|
||||||
|
|
||||||
|
sed -e "s/<TAG>/$TAG/g" -e "s/<DATE>/$DATE/g" <<EOF > "$OUTFILE"
|
||||||
|
; CHIBI PC-09 Prototype #1 Boot ROM -- Version Information
|
||||||
|
; Copyright (c) 2024-2025 Amber Zeller, Gale Faraday
|
||||||
|
; Licensed under MIT
|
||||||
|
|
||||||
|
; This file generated by genver.sh
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;;
|
||||||
|
;; Boot ROM Version & Build Information
|
||||||
|
;;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
SECTION VERSION
|
||||||
|
|
||||||
|
EXPORT VERMSG
|
||||||
|
|
||||||
|
VERMSG
|
||||||
|
fcc "CHIBI PC-09 BOOT ROM <TAG>"
|
||||||
|
fcb \$0A
|
||||||
|
fcn "BUILT <DATE>"
|
||||||
|
EOF
|
@@ -3,3 +3,4 @@ section SERIAL
|
|||||||
section MEMTEST
|
section MEMTEST
|
||||||
|
|
||||||
section VECTORS high 100000
|
section VECTORS high 100000
|
||||||
|
section VERSION high
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
# Makefile for CHIBI PC-09 Firmware
|
# Makefile for CHIBI PC-09 Firmware
|
||||||
|
|
||||||
.PHONY: all clean
|
.PHONY: generate all clean
|
||||||
.IGNORE: clean
|
.IGNORE: clean
|
||||||
.DEFAULT_GOAL := all
|
.DEFAULT_GOAL := all
|
||||||
|
|
||||||
@@ -8,13 +8,15 @@
|
|||||||
# Project Defaults & Folders
|
# Project Defaults & Folders
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
TARGET := boot
|
TARGET := boot
|
||||||
TARGROM := $(TARGET).bin
|
TARGREC := $(TARGET).s19
|
||||||
SRCDIR := src/
|
TARGROM := $(TARGET).bin
|
||||||
|
SRCDIR := src/
|
||||||
BUILDDIR := build/
|
BUILDDIR := build/
|
||||||
SRCS := $(wildcard $(SRCDIR)*.s)
|
GENS := $(SRCDIR)version.s
|
||||||
OBJS := $(patsubst $(SRCDIR)%.s,$(BUILDDIR)%.o,$(SRCS))
|
SRCS := $(wildcard $(SRCDIR)*.s)
|
||||||
INCS := $(wildcard $(SRCDIR)*.inc)
|
OBJS := $(patsubst $(SRCDIR)%.s,$(BUILDDIR)%.o,$(SRCS))
|
||||||
|
INCS := $(wildcard $(SRCDIR)*.inc)
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# Toolchain Definitions
|
# Toolchain Definitions
|
||||||
@@ -22,7 +24,7 @@ INCS := $(wildcard $(SRCDIR)*.inc)
|
|||||||
|
|
||||||
AS := lwasm
|
AS := lwasm
|
||||||
LD := lwlink
|
LD := lwlink
|
||||||
FIX := mot2bin
|
FIX := objcopy
|
||||||
|
|
||||||
ASFLAGS := -f obj
|
ASFLAGS := -f obj
|
||||||
LDFLAGS := -f srec -m map.txt -s linkscript
|
LDFLAGS := -f srec -m map.txt -s linkscript
|
||||||
@@ -34,11 +36,11 @@ LDFLAGS := -f srec -m map.txt -s linkscript
|
|||||||
all: $(TARGROM)
|
all: $(TARGROM)
|
||||||
|
|
||||||
# Fix srec into flashable bin file
|
# Fix srec into flashable bin file
|
||||||
$(TARGROM): $(TARGET).s19
|
$(TARGROM): $(TARGREC)
|
||||||
$(FIX) -out $@ $<
|
$(FIX) -I srec -O binary $< $@
|
||||||
|
|
||||||
# Link objects
|
# Link objects
|
||||||
$(TARGET).s19: $(OBJS)
|
$(TARGREC): $(OBJS)
|
||||||
$(LD) $(LDFLAGS) -o $@ $^
|
$(LD) $(LDFLAGS) -o $@ $^
|
||||||
|
|
||||||
# Assemble objects
|
# Assemble objects
|
||||||
@@ -46,7 +48,12 @@ $(OBJS): $(BUILDDIR)%.o : $(SRCDIR)%.s
|
|||||||
-@mkdir -p $(BUILDDIR)
|
-@mkdir -p $(BUILDDIR)
|
||||||
$(AS) $(ASFLAGS) -o $@ $<
|
$(AS) $(ASFLAGS) -o $@ $<
|
||||||
|
|
||||||
.IGNORE: clean
|
generate: $(GENS)
|
||||||
|
|
||||||
|
$(GENS):
|
||||||
|
./genver.sh
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo 'Cleaning up intermediary files...'
|
@echo 'Cleaning up intermediary files...'
|
||||||
@rm -rv $(TARGROM) $(TARGET).s19 map.txt $(BUILDDIR)
|
@rm -rv $(TARGROM) $(TARGREC) map.txt $(BUILDDIR)
|
||||||
|
@rm -rv $(GENS)
|
||||||
|
@@ -15,6 +15,16 @@ UART_BASE EQU $7F00 ; UART Base Address
|
|||||||
ROM_BASE EQU $8000 ; ROM Base Address and Entry Point
|
ROM_BASE EQU $8000 ; ROM Base Address and Entry Point
|
||||||
VECS_BASE EQU $FFF0 ; Vectors Base Address
|
VECS_BASE EQU $FFF0 ; Vectors Base Address
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;;
|
||||||
|
;; Stack Base Address and Size Information
|
||||||
|
;;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
STACK_BOTTOM EQU $0100 ; Bottom address of system stack
|
||||||
|
STACK_DEPTH EQU $FF ; System stack's depth
|
||||||
|
STACK_TOP EQU STACK_BOTTOM+STACK_DEPTH ; Top address of system stack
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;
|
;;
|
||||||
;; UART Registers and Flags
|
;; UART Registers and Flags
|
||||||
|
@@ -16,8 +16,21 @@
|
|||||||
EXPORT RESET
|
EXPORT RESET
|
||||||
|
|
||||||
RESET
|
RESET
|
||||||
|
|
||||||
|
CLRSTACK
|
||||||
|
; Initialize the system stack
|
||||||
|
lda #$00 ; Initialize A & X to zero out the stack
|
||||||
|
ldx #$0000
|
||||||
|
NEXT@
|
||||||
|
sta STACK_BOTTOM,x ; Write a zero and progress to the next byte
|
||||||
|
leax 1,x
|
||||||
|
cmpx #STACK_DEPTH ; See if we're at the top of the stack yet
|
||||||
|
blo NEXT@ ; Loop if we aren't at the end yet
|
||||||
|
lds #STACK_TOP ; Set S to top of newly cleared stack
|
||||||
|
|
||||||
|
SERINIT
|
||||||
; 8n1 Serial Enable DLAB
|
; 8n1 Serial Enable DLAB
|
||||||
lda #UARTF_LCR_WLS | UARTF_LCR_DLAB
|
lda #UARTF_LCR_WLS|UARTF_LCR_DLAB
|
||||||
sta UART_LCR
|
sta UART_LCR
|
||||||
; REVIEW: Potential endianness hiccough here
|
; REVIEW: Potential endianness hiccough here
|
||||||
ldd #$0C00 ; Set divisor to 12 (9600 baud)
|
ldd #$0C00 ; Set divisor to 12 (9600 baud)
|
||||||
@@ -27,9 +40,10 @@ RESET
|
|||||||
sta UART_LCR
|
sta UART_LCR
|
||||||
lda #(UARTF_MCR_RTS) ; Enable Request-to-Send
|
lda #(UARTF_MCR_RTS) ; Enable Request-to-Send
|
||||||
sta UART_MCR
|
sta UART_MCR
|
||||||
lda #'H ; send 'H'
|
lda #'H ; send 'H'
|
||||||
sta UART_BUFR
|
sta UART_BUFR
|
||||||
WAIT@
|
|
||||||
|
WAIT
|
||||||
sync ; Wait for interrupts
|
sync ; Wait for interrupts
|
||||||
nop
|
nop
|
||||||
bra WAIT@
|
bra WAIT
|
||||||
|
Reference in New Issue
Block a user