Makefile Rework
Changing build process to more easily support different models and memory targets.
This commit is contained in:
parent
60c40b750f
commit
7ac621fa2a
23
README.md
23
README.md
|
@ -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
|
||||
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
|
||||
```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
|
||||
```
|
||||
|
||||
#### Built Options
|
||||
#### Build Options
|
||||
|
||||
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).
|
||||
* `MODEL`: This species which Foenix model is the target. Currently only the Foenix A2560K is supported, with a code of 13.
|
||||
* `UNIT`: This specifies which Foenix model is the targetted machine for the build. There are currently two options:
|
||||
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.
|
||||
|
||||
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
|
||||
|
||||
Most of the source code for this kernel is made available under the open source
|
||||
|
|
62
src/Makefile
62
src/Makefile
|
@ -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_M68000 0x20 /* CPU code for the Motorola 68000 */
|
||||
# CPU_M68010 0x21 /* CPU code for the Motorola 68010 */
|
||||
|
@ -6,7 +17,6 @@
|
|||
# CPU_M68030 0x23 /* CPU code for the Motorola 68030 */
|
||||
# CPU_M68040 0x24 /* CPU code for the Motorola 68040 */
|
||||
# CPU_I486DX 0x34 /* CPU code for the Intel 486DX */
|
||||
export CPU=36
|
||||
|
||||
# MODEL_FOENIX_FMX 0
|
||||
# MODEL_FOENIX_C256U 1
|
||||
|
@ -16,33 +26,59 @@ export CPU=36
|
|||
# MODEL_FOENIX_A2560X 8
|
||||
# MODEL_FOENIX_A2560U 9
|
||||
# MODEL_FOENIX_A2560K 13
|
||||
export MODEL=13
|
||||
export VER_MAJOR = 0
|
||||
export VER_MINOR = 1
|
||||
export VER_BUILD = 11
|
||||
|
||||
# Determine target CPU and MODEL based on the UNIT
|
||||
|
||||
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 ASFLAGS = -m68040 -quiet -Fvobj -nowarn=62
|
||||
export ASFLAGS = $(VASM_CPU) -quiet -Fvobj -nowarn=62
|
||||
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)
|
||||
export CFLAGS = -cpu=68040 +$(VBCC)/config/a2560k_ram -I. -I$(CURDIR)/include -I$(CURDIR)
|
||||
# export CFLAGS = +$(VBCC)/config/a2560u_flash -I. -I$(CURDIR)/include -I$(CURDIR)
|
||||
export CFLAGS = -cpu=$(VBCC_CPU) +$(CFG_FILE) -I. -I$(CURDIR)/include -I$(CURDIR)
|
||||
export RM = cmd /C del /Q /F
|
||||
else
|
||||
#export CFLAGS = +$(VBCC)/config/m68k-foenix-linux -I. -I$(CURDIR)/include -I$(CURDIR)
|
||||
export CFLAGS = +$(VBCC)/config/a2560u_flash-linux -I. -I$(CURDIR)/include -I$(CURDIR)
|
||||
export CFLAGS = -cpu=$(VBCC_CPU) +$(CFG_FILE)_linux -I. -I$(CURDIR)/include -I$(CURDIR)
|
||||
export RM = rm -f
|
||||
endif
|
||||
|
||||
cpu = m68040
|
||||
cpu_assembly_src := $(wildcard $(cpu)/*.s)
|
||||
cpu_c_src := $(wildcard $(cpu)/*.c)
|
||||
cpu_assembly_obj := $(subst .s,.o,$(cpu_assembly_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))
|
||||
|
||||
snd_c_src := $(wildcard snd/*.c)
|
||||
snd_c_obj := $(subst .c,.o,$(snd_c_src))
|
||||
fat_c_src := $(wildcard fatfs/*.c)
|
||||
|
|
|
@ -190,6 +190,7 @@ short cli_mem_test(short channel, int argc, char * argv[]) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if MODEL == MODEL_FOENIX_A2560K
|
||||
short cli_test_recalibrate(short screen, int argc, char * argv[]) {
|
||||
unsigned char buffer[512];
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 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},
|
||||
{"CREATE", "CREATE <path>: test creating a file", cli_test_create},
|
||||
{"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},
|
||||
#endif
|
||||
{"LPT", "LPT: test the parallel port", cli_test_lpt},
|
||||
{"MEM", "MEM: test reading and writing memory", cli_mem_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},
|
||||
{"PSG", "PSG: test the PSG sound chip", psg_test},
|
||||
{"PRINT", "PRINT: sent text to the printer", cmd_test_print},
|
||||
#if MODEL == MODEL_FOENIX_A2560K
|
||||
{"RECALIBRATE", "RECALIBRATE: recalibrate the floppy drive", cli_test_recalibrate},
|
||||
{"SEEK", "SEEK <track>: move the floppy drive head to a track", cli_test_seek},
|
||||
#endif
|
||||
{"UART", "UART: test the serial port", cli_test_uart},
|
||||
{0, 0}
|
||||
};
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
csources = $(wildcard *.c)
|
||||
cobjects = $(subst .c,.o,$(csources))
|
||||
|
||||
cobjects = $(subst .c,.o,$(csources))
|
||||
|
||||
.PHONY: all
|
||||
all: $(cobjects)
|
||||
|
||||
|
@ -10,4 +12,4 @@ all: $(cobjects)
|
|||
.PHONY: clean
|
||||
|
||||
clean:
|
||||
$(RM) $(aobjects) $(cobjects) *.asm
|
||||
$(RM) *.o *.asm
|
||||
|
|
6748
src/foenixmcp.s68
6748
src/foenixmcp.s68
File diff suppressed because it is too large
Load diff
|
@ -224,21 +224,13 @@ unsigned long syscall_dispatch(int32_t function, int32_t param0, int32_t param1,
|
|||
return 0;
|
||||
|
||||
case KFN_KBD_SCANCODE:
|
||||
#if MODEL == MODEL_FOENIX_A2560K
|
||||
return kbdmo_get_scancode();
|
||||
#else
|
||||
return kbd_get_scancode();
|
||||
#endif
|
||||
|
||||
case KFN_ERR_MESSAGE:
|
||||
return (unsigned long)err_message((short)param0);
|
||||
|
||||
case KFN_KBD_LAYOUT:
|
||||
#if MODEL == MODEL_FOENIX_A2560K
|
||||
return kbdmo_layout((const char *)param0);
|
||||
#else
|
||||
return kbd_layout((const char *)param0);
|
||||
#endif
|
||||
|
||||
default:
|
||||
return ERR_GENERAL;
|
||||
|
|
13207
src/mapfile
13207
src/mapfile
File diff suppressed because it is too large
Load diff
13
vbcc/config/a2560k_ram_linux
Normal file
13
vbcc/config/a2560k_ram_linux
Normal 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
|
Loading…
Reference in a new issue