-
Software Build Toolchain
09/07/2020 at 16:20 • 0 commentsAssembler
- vasm - Assembler
- Built from source on Linux.
C Compiler
- GCC - 68k Cross-compiler
- Built from source on Linux
Build environment
- Run in VirtualBox under Windows.
Example Software
Makefile for Rectangles code
ARCH = 68000 BASE = /opt/m68k-elf/bin/m68k-elf CC = $(BASE)-gcc LD = $(BASE)-gcc AS = $(BASE)-as CP = $(BASE)-objcopy DUMP = $(BASE)-objdump VASM = ../../../vasm/vasmm68k_mot # we use crt0.s from here STARTUP_DIR = ../../Firmware_Common COMMON_DIR = ../../Firmware_Common BUILD_DIR=m68k_obj STARTUP_SRC = $(STARTUP_DIR)/startup_app.s $(STARTUP_DIR)/premain.s STARTUP_OBJ = $(patsubst $(STARTUP_DIR)/%.s,$(BUILD_DIR)/%.o,$(STARTUP_SRC)) COMMON_SRC = vga.c uart.c interrupts.c COMMON_OBJ = $(patsubst %.c,$(BUILD_DIR)/%.o,$(COMMON_SRC)) MAIN_PRJ = Rectangles MAIN_C_SRC = rectangles.c MAIN_C_OBJ = $(patsubst %.c,$(BUILD_DIR)/%.o,$(MAIN_C_SRC)) MAIN_S_SRC = draw.s MAIN_S_OBJ = $(patsubst %.s,$(BUILD_DIR)/%.o,$(MAIN_S_SRC)) MAIN_OBJ = $(COMMON_OBJ) $(MAIN_C_OBJ) $(MAIN_S_OBJ) LINKMAP = $(STARTUP_DIR)/ldscript_app.ld # Commandline options for each tool. CFLAGS = -m$(ARCH) -I. -c -O6 -DDISABLE_UART_RX -I$(COMMON_DIR) LFLAGS = -m$(ARCH) -nostartfiles -Wl,--relax -O6 # Our target. all: $(BUILD_DIR) $(MAIN_PRJ).sre $(MAIN_PRJ).rpt clean: rm -f $(BUILD_DIR)/*.o *.elf *.sre *.rpt *.map *.lst *.srec *~ */*.o *.bin # Convert ELF binary to bin file. %.sre: %.elf $(CP) -O srec $< $@ %.rpt: %.elf echo >$@ -n "End of code:\t" $(DUMP) -x $< | grep >>$@ _romend echo >>$@ -n "Start of BSS:\t" $(DUMP) -x $< | grep >>$@ __bss_start__ echo >>$@ -n "End of BSS:\t" $(DUMP) -x $< | grep >>$@ __bss_end__ cat $@ # Link - this produces an ELF binary. $(MAIN_PRJ).elf: $(STARTUP_OBJ) $(MAIN_OBJ) $(LD) $(LFLAGS) -T $(LINKMAP) -o $@ $+ $(LIBS) $(BUILD_DIR)/%.o: %.c Makefile $(CC) $(CFLAGS) -o $@ -c $< $(BUILD_DIR)/%.o: $(COMMON_DIR)/%.c Makefile $(CC) $(CFLAGS) -o $@ -c $< $(BUILD_DIR)/%.o: %.s $(VASM) -Felf -o $@ $< $(BUILD_DIR)/%.o: $(STARTUP_DIR)/%.s $(VASM) -Felf -o $@ $< $(BUILD_DIR): mkdir $(BUILD_DIR)
-
Software Examples
09/06/2020 at 21:17 • 0 commentsCode
AMR has several code examples. I've added some documentation and comments to the code. If you try them, make sure you are on the master branch of AMR's code. I've also got the code in my Linux repo.
HelloWorld
Prints out strings and numbers on the UART serial port using printf.
Rectangles
I added these comments to the source code
// rectangles.c - Draws rectangles on the VGA screen // random size rectangles // combined with previous rectangle colors // scrolls screen vertically as well // scrolls on vert sync interrupt // very busy screen // bootloader leaves debug window up
FrameBufferTest
Graphics test with sprite under PS/2 mouse control.
-
TG68 Hardware
09/06/2020 at 14:04 • 0 commentsThis project is intended to be a software project but a description of the hardware is necessary as a reference to understand the resources available to the software.
Features
- Runs on Altera Cyclone IV and V FPGA Cards
- 68000 CPU
- 32 MB SDRAM
- Host Serial Connection (USB to Serial)
- Video Display Unit (VDU)
- VGA
- PS/2 keyboard
FPGA Cards
- Initially running on Cyclone V FPGA card (very small resource utilization)
- Ported to Cyclone IV EP4CE15 FPGA card - compiled
- Resource efficient but probably wouldn't fit into anything smaller than an EP4CE10.
Flow Status Successful - Sun Sep 06 12:05:04 2020 Quartus Prime Version 20.1.0 Build 711 06/05/2020 SJ Lite Edition Revision Name SOC Top-level Entity Name C5BoardToplevel Family Cyclone IV E Device EP4CE15F23C8 Timing Models Final Total logic elements 7,984 / 15,408 ( 52 % ) Total registers 3629 Total pins 134 / 344 ( 39 % ) Total virtual pins 0 Total memory bits 107,520 / 516,096 ( 21 % ) Embedded Mult 9-bit els 2 / 112 ( 2 % ) Total PLLs 1 / 4 ( 25 % )
TG 68000 Core
- 100 MHz?
- Wait states
- 32-bits of addresses connected?
32MB SDRAM
- Winbond W9825G6KH-6 133 SDRAM
- 4M x 16 bits x 4 banks
Host Serial Interface
- FT-230XS USB to Serial
- 115200,N,8,1
- USB B connector
Video Display Unit
- VGA
- PS/2 keyboard and Mouse
Memory Map
- 0x00000000-0x0000FFFF = ROM
- 0x00100000 - Framebuffer
- 0x0FFFFA - Variables
- 0x7FFFFE - The initial stack pointer
- 0x800000 = VGA controller
- Screen base address register
- 0x810000 = Peripherals
- Four counters, t0 through t3
- 0x810010-0x810016 = Divisor register for all four counters
- 0x81000e = Control word at which contains interrupt enable bits and status bits for counters t1 through t3.
- T0 acts as a prescalar for the other three timers, so with the system clock set to 112.5MHz, setting T0’s divisor to 1125 gives the other three timers a 100KHz base clock.
- 0x820000 = Audio controller