Makefile Rework

Changing build process to more easily support different models and memory targets.
This commit is contained in:
Peter Weingartner 2021-11-27 20:03:00 -05:00
parent 60c40b750f
commit 7ac621fa2a
11 changed files with 10069 additions and 10002 deletions

View file

@ -31,7 +31,7 @@ Please refer to processor specific building instructions that will be included.
For the 65816 and 68000 computers, the project will be built using the VBCC For the 65816 and 68000 computers, the project will be built using the VBCC
compiler. compiler.
### Building for the M68000 CPU ### Building for the M68000 CPU Family
Building this project requires the [VBCC](http://www.compilers.de/vbcc.html) compiler and the Building this project requires the [VBCC](http://www.compilers.de/vbcc.html) compiler and the
```MAKE``` utility. Using your command line, go into the ```src``` directory and type: ```MAKE``` utility. Using your command line, go into the ```src``` directory and type:
@ -48,14 +48,29 @@ To remove binaries and intermediate files:
make clean make clean
``` ```
#### Built Options #### Build Options
There are three option variables that can be set in the makefile: There are three option variables that can be set in the makefile:
* `CPU`: This specifies which CPU is the target. Currently only the M68000 is supported, with a CPU code of 32 (0x20). * `UNIT`: This specifies which Foenix model is the targetted machine for the build. There are currently two options:
* `MODEL`: This species which Foenix model is the target. Currently only the Foenix A2560K is supported, with a code of 13. 1. `UNIT=a2560u`, this covers both the A2560U and A2560U+. It sets the CPU to be the M68000.
2. `UNIT=a2560k`, this covers the A2560K and sets the CPU to M68040.
* `MEMORY`: This species where in memory Foenix/MCP will run. There are two values here:
1. `MEMORY=ram`: This specifies that the MCP will run from RAM.
2. `MEMORY=flash`: This specifies that the MCP will be programmed to flash memory.
* `KBD_POLLED`: As a temporary feature, if this option variable is defined, it will specify to the kernel that polled I/O is to be used for keyboard access instead of interrupt driven I/O. * `KBD_POLLED`: As a temporary feature, if this option variable is defined, it will specify to the kernel that polled I/O is to be used for keyboard access instead of interrupt driven I/O.
Examples:
```
make all UNIT=a2560u MEMORY=ram
```
Builds an SREC file suitable for loading into RAM of the A2560U/U+.
```
make all UNIT=a2560k MEMORY=flash
```
Builds a binary file suitable for programming the flash of the A2560K.
## License ## License
Most of the source code for this kernel is made available under the open source Most of the source code for this kernel is made available under the open source

View file

@ -1,4 +1,15 @@
#
# User may over-ride the UNIT and MEMORY parameters to specify target machine
# and where the MCP will run (ram or flash)
#
UNIT := a2560k
MEMORY := ram
export VER_MAJOR = 0
export VER_MINOR = 1
export VER_BUILD = 11
# CPU_WDC65816 0x16 /* CPU code for the Western Design Center 65816 */ # CPU_WDC65816 0x16 /* CPU code for the Western Design Center 65816 */
# CPU_M68000 0x20 /* CPU code for the Motorola 68000 */ # CPU_M68000 0x20 /* CPU code for the Motorola 68000 */
# CPU_M68010 0x21 /* CPU code for the Motorola 68010 */ # CPU_M68010 0x21 /* CPU code for the Motorola 68010 */
@ -6,7 +17,6 @@
# CPU_M68030 0x23 /* CPU code for the Motorola 68030 */ # CPU_M68030 0x23 /* CPU code for the Motorola 68030 */
# CPU_M68040 0x24 /* CPU code for the Motorola 68040 */ # CPU_M68040 0x24 /* CPU code for the Motorola 68040 */
# CPU_I486DX 0x34 /* CPU code for the Intel 486DX */ # CPU_I486DX 0x34 /* CPU code for the Intel 486DX */
export CPU=36
# MODEL_FOENIX_FMX 0 # MODEL_FOENIX_FMX 0
# MODEL_FOENIX_C256U 1 # MODEL_FOENIX_C256U 1
@ -16,33 +26,59 @@ export CPU=36
# MODEL_FOENIX_A2560X 8 # MODEL_FOENIX_A2560X 8
# MODEL_FOENIX_A2560U 9 # MODEL_FOENIX_A2560U 9
# MODEL_FOENIX_A2560K 13 # MODEL_FOENIX_A2560K 13
export MODEL=13
export VER_MAJOR = 0 # Determine target CPU and MODEL based on the UNIT
export VER_MINOR = 1
export VER_BUILD = 11 ifeq ($(UNIT),a2560k)
export CPU_NUMBER = 36 # M68040
export VASM_CPU = -m68040 # VASM CPU flag
export VBCC_CPU = 68040 # VBCC CPU flag
export MODEL_NUMBER = 13 # A2560K
export cpu = m68040
else ifeq ($(UNIT),a2560u)
export CPU_NUMBER = 32 # M68000
export VASM_CPU = -m68000 # VASM CPU flag
export VBCC_CPU = 68000 # VBCC CPU flag
export MODEL_NUMBER = 9 # A2560U
export CFG_FILE = $(VBCC)/config/a2560u_ram
export cpu = m68k
endif
# Determine the correct configuration file (barring OS)
ifeq ($(MEMORY),ram)
export CFG_FILE = $(VBCC)/config/$(UNIT)_ram
else
export CFG_FILE = $(VBCC)/config/$(UNIT)_flash
endif
export AS = vasmm68k_mot export AS = vasmm68k_mot
export ASFLAGS = -m68040 -quiet -Fvobj -nowarn=62 export ASFLAGS = $(VASM_CPU) -quiet -Fvobj -nowarn=62
export CC = vc export CC = vc
export DEFINES = -DCPU=$(CPU) -DMODEL=$(MODEL) -DVER_MAJOR=$(VER_MAJOR) -DVER_MINOR=$(VER_MINOR) -DVER_BUILD=$(VER_BUILD) # -DKBD_POLLED export DEFINES = -DCPU=$(CPU_NUMBER) -DMODEL=$(MODEL_NUMBER) -DVER_MAJOR=$(VER_MAJOR) -DVER_MINOR=$(VER_MINOR) -DVER_BUILD=$(VER_BUILD) # -DKBD_POLLED
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
export CFLAGS = -cpu=68040 +$(VBCC)/config/a2560k_ram -I. -I$(CURDIR)/include -I$(CURDIR) export CFLAGS = -cpu=$(VBCC_CPU) +$(CFG_FILE) -I. -I$(CURDIR)/include -I$(CURDIR)
# export CFLAGS = +$(VBCC)/config/a2560u_flash -I. -I$(CURDIR)/include -I$(CURDIR)
export RM = cmd /C del /Q /F export RM = cmd /C del /Q /F
else else
#export CFLAGS = +$(VBCC)/config/m68k-foenix-linux -I. -I$(CURDIR)/include -I$(CURDIR) export CFLAGS = -cpu=$(VBCC_CPU) +$(CFG_FILE)_linux -I. -I$(CURDIR)/include -I$(CURDIR)
export CFLAGS = +$(VBCC)/config/a2560u_flash-linux -I. -I$(CURDIR)/include -I$(CURDIR)
export RM = rm -f export RM = rm -f
endif endif
cpu = m68040
cpu_assembly_src := $(wildcard $(cpu)/*.s) cpu_assembly_src := $(wildcard $(cpu)/*.s)
cpu_c_src := $(wildcard $(cpu)/*.c) cpu_c_src := $(wildcard $(cpu)/*.c)
cpu_assembly_obj := $(subst .s,.o,$(cpu_assembly_src)) cpu_assembly_obj := $(subst .s,.o,$(cpu_assembly_src))
cpu_c_obj := $(subst .c,.o,$(cpu_c_src)) cpu_c_obj := $(subst .c,.o,$(cpu_c_src))
dev_c_src := $(wildcard dev/*.c)
dev_base_sources = dev/block.c dev/channel.c dev/console.c dev/fsys.c dev/pata.c dev/ps2.c dev/rtc.c dev/sdc.c dev/text_screen_iii.c dev/uart.c
ifeq ($(UNIT),a2560k)
dev_c_src := $(dev_base_sources) dev/fdc.c dev/kbd_mo.c dev/lpt.c dev/midi.c
else
dev_c_src := $(dev_base_sources)
endif
dev_c_obj := $(subst .c,.o,$(dev_c_src)) dev_c_obj := $(subst .c,.o,$(dev_c_src))
snd_c_src := $(wildcard snd/*.c) snd_c_src := $(wildcard snd/*.c)
snd_c_obj := $(subst .c,.o,$(snd_c_src)) snd_c_obj := $(subst .c,.o,$(snd_c_src))
fat_c_src := $(wildcard fatfs/*.c) fat_c_src := $(wildcard fatfs/*.c)

View file

@ -190,6 +190,7 @@ short cli_mem_test(short channel, int argc, char * argv[]) {
return 0; return 0;
} }
#if MODEL == MODEL_FOENIX_A2560K
short cli_test_recalibrate(short screen, int argc, char * argv[]) { short cli_test_recalibrate(short screen, int argc, char * argv[]) {
unsigned char buffer[512]; unsigned char buffer[512];
short i; short i;
@ -283,6 +284,7 @@ short cli_test_fdc(short screen, int argc, char * argv[]) {
bdev_ioctrl(BDEV_FDC, FDC_CTRL_MOTOR_OFF, 0, 0); bdev_ioctrl(BDEV_FDC, FDC_CTRL_MOTOR_OFF, 0, 0);
} }
#endif
/* /*
* Test the IDE interface by reading the MBR * Test the IDE interface by reading the MBR
@ -423,7 +425,9 @@ static t_cli_test_feature cli_test_features[] = {
{"BITMAP", "BITMAP: test the bitmap screen", cli_test_bitmap}, {"BITMAP", "BITMAP: test the bitmap screen", cli_test_bitmap},
{"CREATE", "CREATE <path>: test creating a file", cli_test_create}, {"CREATE", "CREATE <path>: test creating a file", cli_test_create},
{"IDE", "IDE: test reading the MBR of the IDE drive", cli_test_ide}, {"IDE", "IDE: test reading the MBR of the IDE drive", cli_test_ide},
#if MODEL == MODEL_FOENIX_A2560K
{"FDC", "FDC: test reading the MBR from the floppy drive", cli_test_fdc}, {"FDC", "FDC: test reading the MBR from the floppy drive", cli_test_fdc},
#endif
{"LPT", "LPT: test the parallel port", cli_test_lpt}, {"LPT", "LPT: test the parallel port", cli_test_lpt},
{"MEM", "MEM: test reading and writing memory", cli_mem_test}, {"MEM", "MEM: test reading and writing memory", cli_mem_test},
{"MIDILOOP", "MIDILOOP: perform a loopback test on the MIDI ports", midi_loop_test}, {"MIDILOOP", "MIDILOOP: perform a loopback test on the MIDI ports", midi_loop_test},
@ -434,8 +438,10 @@ static t_cli_test_feature cli_test_features[] = {
{"PANIC", "PANIC: test the kernel panic mechanism", cli_test_panic}, {"PANIC", "PANIC: test the kernel panic mechanism", cli_test_panic},
{"PSG", "PSG: test the PSG sound chip", psg_test}, {"PSG", "PSG: test the PSG sound chip", psg_test},
{"PRINT", "PRINT: sent text to the printer", cmd_test_print}, {"PRINT", "PRINT: sent text to the printer", cmd_test_print},
#if MODEL == MODEL_FOENIX_A2560K
{"RECALIBRATE", "RECALIBRATE: recalibrate the floppy drive", cli_test_recalibrate}, {"RECALIBRATE", "RECALIBRATE: recalibrate the floppy drive", cli_test_recalibrate},
{"SEEK", "SEEK <track>: move the floppy drive head to a track", cli_test_seek}, {"SEEK", "SEEK <track>: move the floppy drive head to a track", cli_test_seek},
#endif
{"UART", "UART: test the serial port", cli_test_uart}, {"UART", "UART: test the serial port", cli_test_uart},
{0, 0} {0, 0}
}; };

View file

@ -1,6 +1,8 @@
csources = $(wildcard *.c) csources = $(wildcard *.c)
cobjects = $(subst .c,.o,$(csources)) cobjects = $(subst .c,.o,$(csources))
cobjects = $(subst .c,.o,$(csources))
.PHONY: all .PHONY: all
all: $(cobjects) all: $(cobjects)
@ -10,4 +12,4 @@ all: $(cobjects)
.PHONY: clean .PHONY: clean
clean: clean:
$(RM) $(aobjects) $(cobjects) *.asm $(RM) *.o *.asm

File diff suppressed because it is too large Load diff

View file

@ -224,21 +224,13 @@ unsigned long syscall_dispatch(int32_t function, int32_t param0, int32_t param1,
return 0; return 0;
case KFN_KBD_SCANCODE: case KFN_KBD_SCANCODE:
#if MODEL == MODEL_FOENIX_A2560K
return kbdmo_get_scancode();
#else
return kbd_get_scancode(); return kbd_get_scancode();
#endif
case KFN_ERR_MESSAGE: case KFN_ERR_MESSAGE:
return (unsigned long)err_message((short)param0); return (unsigned long)err_message((short)param0);
case KFN_KBD_LAYOUT: case KFN_KBD_LAYOUT:
#if MODEL == MODEL_FOENIX_A2560K
return kbdmo_layout((const char *)param0);
#else
return kbd_layout((const char *)param0); return kbd_layout((const char *)param0);
#endif
default: default:
return ERR_GENERAL; return ERR_GENERAL;

13207
src/mapfile

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,13 @@
-cc=vbccm68k -quiet %s -o= %s %s -O=%ld -I$VBCC/targets/m68k-foenix/include
-ccv=vbccm68k %s -o= %s %s -O=%ld -I$VBCC/targets/m68k-foenix/include
-as=vasmm68k_mot -quiet -Fvobj -nowarn=62 %s -o %s
-asv=vasmm68k_mot -Fvobj -nowarn=62 %s -o %s
-rm=rm %s
-rmv=rm %s
-ld=vlink -bsrec28 -x -Cvbcc m68040/startup_m68040.o %s %s -L$VBCC/targets/m68k-foenix/lib -T$VBCC/targets/m68k-foenix/vlink.cmd -lvc -o %s -Mmapfile
-l2=vlink -bsrec28 -x -Cvbcc %s %s -L$VBCC/targets/m68k-foenix/lib -T$VBCC/targets/m68k-foenix/vlink.cmd -o %s -Mmapfile
-ldv=vlink -bsrec28 -t -x -Cvbcc m68040/startup.o %s %s -L$VBCC/targets/m68k-foenix/lib -T$VBCC/targets/m68k-foenix/vlink.cmd -lvc -o %s -Mmapfile
-l2v=vlink -bsrec28 -t -x -Cvbcc %s %s -L$VBCC/targets/m68k-foenix/lib -T$VBCC/targets/m68k-foenix/vlink.cmd -o %s -Mmapfile
-ul=-l%s
-cf=-F%s
-ml=1000