Skip to content

Commit

Permalink
Build / release system
Browse files Browse the repository at this point in the history
- Made top level Makefile able to build lha and zip release images

hostsmash
- Fixed broken MacOS build -- should now support file service (untested)
  • Loading branch information
Chris Hooper committed Nov 9, 2024
1 parent 5ac4fbc commit 1f8f01a
Show file tree
Hide file tree
Showing 16 changed files with 363 additions and 49 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ generated.*.ld
cscope.out
.cscope_cmd.*
objs/
objs.x86_64/
objs.mac/
objs.rom/
objs.rom_d/
objs.win32/
Expand All @@ -32,3 +34,4 @@ amiga/smashfsrom
amiga/smashfsrom_d
sw/hostsmash
sw/crcit
kicksmash_*
75 changes: 69 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,83 @@
# Makefile to build KickSmash firmware, host software, and Amiga software
#

VER ?= 1.0+
MAKE ?= make
MAKEFLAGS += --no-print-directory

all: build-sw build-fw build-amiga
clean: clean-sw clean-fw clean-amiga

build-sw build-fw build-amiga:
build-fw build-amiga build-sw:
@echo
@echo Building in $(@:build-%=%)
@$(MAKE) -C $(@:build-%=%)
@echo "* Building in $(@:build-%=%)"
@$(MAKE) -C $(@:build-%=%) all

clean-sw clean-fw clean-amiga:
@echo
@echo Cleaning in $(@:clean-%=%)
@$(MAKE) -C $(@:clean-%=%) clean
@echo "* Cleaning in $(@:clean-%=%)"
@$(MAKE) -C $(@:clean-%=%) clean-all

.PHONY: build-sw build-fw build-amiga clean-sw clean-fw clean-amiga all clean
# ---------------------------------------------------------------

RELEASE_DIR := kicksmash_$(VER)
RELEASE_LHA := kicksmash_$(VER).lha
RELEASE_ZIP := kicksmash_$(VER).zip

RELEASE_TARGETS :=
RELEASE_DIRS :=
define RELEASE_IT
ifneq (,$(wildcard $(1)))
RELEASE_TARGETS += $(RELEASE_DIR)/$(2)
RELEASE_DIRS += $(dir $(RELEASE_DIR)/$(2))
$(RELEASE_DIR)/$(2): $(1)
endif
endef
$(eval $(call RELEASE_IT,sw/objs.x86_64/hostsmash,sw/hostsmash.linux_x86_64))
$(eval $(call RELEASE_IT,sw/objs.mac/hostsmash,sw/hostsmash.mac))
$(eval $(call RELEASE_IT,sw/objs.win32/hostsmash.exe,sw/hostsmash_win32.exe))
$(eval $(call RELEASE_IT,sw/objs.win64/hostsmash.exe,sw/hostsmash_win64.exe))
$(eval $(call RELEASE_IT,fw/objs/fw.bin,fw/fw.bin))
$(eval $(call RELEASE_IT,fw/objs/fw.elf,fw/fw.elf))
$(eval $(call RELEASE_IT,fw/Makefile.release,fw/Makefile))
$(eval $(call RELEASE_IT,fw/.gdbinit,fw/.gdbinit))
$(eval $(call RELEASE_IT,amiga/smash,amiga/smash))
$(eval $(call RELEASE_IT,amiga/smashftp,amiga/smashftp))
$(eval $(call RELEASE_IT,amiga/smashfs,amiga/smashfs))
$(eval $(call RELEASE_IT,amiga/smashfsrom,amiga/smashfsrom))
$(eval $(call RELEASE_IT,amiga/smashfsrom_d,amiga/smashfsrom_d))
$(eval $(call RELEASE_IT,README.md,README.md))
$(eval $(call RELEASE_IT,LICENSE.md,LICENSE.md))
$(foreach DOC,$(wildcard doc/*),$(eval $(call RELEASE_IT,$(DOC),$(DOC))))

RELEASE_DIRS := $(sort $(RELEASE_DIR) $(RELEASE_DIRS))

ifneq (,$(wildcard $(RELEASE_LHA))$(wildcard $(RELEASE_ZIP)))
release:
@echo $(RELEASE_LHA) or $(RELEASE_ZIP) already exists
else
release: all
@$(MAKE) do_release

do_release: populating $(RELEASE_TARGETS) $(RELEASE_LHA) $(RELEASE_ZIP)

$(RELEASE_LHA): all populating $(RELEASE_TARGETS)
@echo "* Building $@"
@rm -f $@
@lha -aq2 $@ $(RELEASE_DIR)

$(RELEASE_ZIP): all populating $(RELEASE_TARGETS)
@echo "* Building $@"
@rm -f $@
@zip -rq $@ $(RELEASE_DIR)

populating:
@echo "* Populating $(RELEASE_DIR)"

$(RELEASE_TARGETS): | $(RELEASE_DIRS)
cp -p $^ $@
endif
$(RELEASE_DIRS):
mkdir -p $@

.PHONY: build-sw build-fw build-amiga clean-sw clean-fw clean-amiga all clean release populating
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ and Amiga 4000 computer systems. Features include:
![Alt text](photos/2024_11_07_kicksmash32_rev5_profile_view_2.jpg?raw=true "Kicksmash32")

All hardware, firmware, and software is open source.

View files in the doc directory for complete documentation.
8 changes: 5 additions & 3 deletions amiga/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ $(error "No $(CC) in PATH: maybe do PATH=$$PATH:/opt/amiga13/bin")
endif

all: $(SMASH_PROG) $(FS_PROG) $(FTP_PROG) $(FSROM_PROG) $(FSROM_PROG_D)
@:

gdb:
m68k-amigaos-gdb $(SMASH_PROG)
Expand Down Expand Up @@ -149,14 +150,15 @@ zip:

lha:
@echo Building $(PROGVER).lha
$(QUIET)rm -rf $(SMASH_PROG).zip $(PROGVER)
$(QUIET)rm -rf $(SMASH_PROG).lha $(PROGVER)
$(QUIET)mkdir $(PROGVER)
$(QUIET)cp -p $(SMASH_PROG) $(PROGVER)/
$(QUIET)lha -aq2 $(PROGVER).lha $(PROGVER)
$(QUIET)rm -rf $(PROGVER)

clean:
rm -rf $(OBJS) $(OBJDIR) $(ROM_OBJDIR) $(ROM_OBJDIR_D)
clean clean-all:
@echo Cleaning
@rm -rf $(OBJS) $(OBJDIR) $(ROM_OBJDIR) $(ROM_OBJDIR_D)

FLINT_FILE=flexelint.lnt
flint:
Expand Down
2 changes: 1 addition & 1 deletion amiga/fs_hand.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#define DIRBUF_SIZE 2000

const char *version = "\0$VER: smashfs 0.1 ("__DATE__") � Chris Hooper";
const char *version = "\0$VER: smashfs 0.2 ("__DATE__") � Chris Hooper";

BOOL __check_abort_enabled = 0; // Disable gcc clib2 ^C break handling

Expand Down
2 changes: 1 addition & 1 deletion amiga/smash.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* THE AUTHOR ASSUMES NO LIABILITY FOR ANY DAMAGE ARISING OUT OF THE USE
* OR MISUSE OF THIS UTILITY OR INFORMATION REPORTED BY THIS UTILITY.
*/
const char *version = "\0$VER: smash 0.2 ("__DATE__") © Chris Hooper";
const char *version = "\0$VER: smash 1.0 ("__DATE__") © Chris Hooper";

#include <stdio.h>
#include <stdlib.h>
Expand Down
2 changes: 1 addition & 1 deletion amiga/smashftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* THE AUTHOR ASSUMES NO LIABILITY FOR ANY DAMAGE ARISING OUT OF THE USE
* OR MISUSE OF THIS UTILITY OR INFORMATION REPORTED BY THIS UTILITY.
*/
const char *version = "\0$VER: smashftp 0.4 ("__DATE__") © Chris Hooper";
const char *version = "\0$VER: smashftp 1.0 ("__DATE__") © Chris Hooper";

#include <stdio.h>
#include <stdint.h>
Expand Down
54 changes: 54 additions & 0 deletions doc/FAQ.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
* What problem does KickSmash32 solve?

If you need to occasionally change ROMs in your Amiga, this can be a
tedious process with most Amiga systems. It often involves opening the
case, removing the drives and drive tray, and may also include removing
the CPU or removing all expansion cards.

ROM images can be programmed by KickSmash32 in system by running a
program on the Amiga. Up to eight 512 KB ROM images may be stored and
switched between using either an Amiga command or by performing a long
(Control-Amiga-Amiga) reset.

In addition, the USB port on KickSmash32 maybe connected permanently
to an external host so that ROM images can be programmed even when the
Amiga is not able to boot. The Amiga must be held in reset in this case.

========================================================================

* Which Amiga models are supported by KickSmash32?

KickSmash32 is currently only tested in Amiga 3000 rev 9 and
Amiga 4000 rev B motherboards. It will likely work in Amiga 3000T and
Amiga 4000T systems, but has not been tested. It will not work in
Amiga 3000 rev 7 and below motherboards, as those require a ROM Tower.
An Amiga 3000 ROM tower replacement with spacing identical to the
rev 9 motherboard is in development, but is not available yet.

KickSmash32 might also work in the Amiga 1200, but this has not been
tested. With further software development, it can probably be made to
support the Amiga 500 and 2000. A lower cost version could be made
which supports those Amiga models.

========================================================================

* How do I install KickSmash32?

It's recommended to connect KickSmash by USB to your PC first before
installing it in the Amiga. This will allow you to update KickSmash
firmware, if necessary, and program an initial Kickstart ROM image.
See doc/sw_install.txt for instructions. Read doc/sw_hostsmash.txt for
further information on programming Kickstart images.

KickSmash requires a connection to the Amiga's KBRST signal. You will
need to attach a jumper from a spot on the board to the KBRST pin on
KickSmash. See doc/hw_install.txt for details on this.

Download the latest software release from the KickSmash github repository:
https://github.com/cdhooper/kicksmash32

Install files in the amiga directory on your Amiga. The sw directory
contains hostsmash executables for Linux, Windows, and MacOS. This
utility is used to program firmware images on KickSmash over USB.

========================================================================
2 changes: 1 addition & 1 deletion doc/hw_build.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
KickSmash Hardware Build
------------------------

Use files in the rev4 directory to have a fab house build a PCB.
Use files in the rev5 directory to have a fab house build a PCB.
HASL is fine. I use JLCPCB for most of my builds.

My general order for building these boards is:
Expand Down
6 changes: 4 additions & 2 deletions doc/hw_install.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ that system enough to confirm.
screwdriver, be very careful to not damage traces on your motherboard.

4. Install KickSmash in place of the ROMs
The USB connector of KickSmash should face the same side of the ROM
sockets as the notch of the ROMs you've removed.
In the Amiga 3000, KickSmash will be oriented with the USB-C
connector facing Gary.
In the Amiga 4000, KickSmash will be oriented with the USB-C
Expand All @@ -34,8 +36,8 @@ that system enough to confirm.
5. Attach your KBRST wire to the KBRST pin on KickSmash

6. Optionally attach your ST-Link
You can do this if you plan to do firmware programming. Ensure the
cable is oriented correctly.
It's not necessary unless you plan to do firmware programming. Ensure
the cable is oriented correctly.

7. Optionally attach a USB-C cable to your KickSmash
This cable would be routed out the back of your Amiga and then
Expand Down
14 changes: 13 additions & 1 deletion doc/hw_programming.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@ There are two ways to program firmware on your KickSmash.
I prefer using the ST-Link for rapid programming cycles because it's
fast and requires less manual intervention to get new firmware loaded.
An advantage of using USB DFU mode is that it does not require any
programmer hardware. You just need a computer which has a DFU downloader.
programmer hardware. You just need a computer which has a DFU updater.
On Linux, dfu-util is the recommended DFU updater. Depending on your
Linux distribution, you might use one of the following commands to
install it:
dnf install dfu-util
yum install dfu-util
apt-get install dfu-util
On MacOS, you can install dfu-util using brew:
brew install dfu-util

In either case, you will need a computer that you can connect by
USB-C to your KickSmash. You will also need to build firmware for
Expand Down Expand Up @@ -63,6 +71,10 @@ Get all the source code from here:
shows up on your computer, type:
make dfu

if you are on MacOS, you might need to first build the firmware and
then type:
make just-dfu

When programming in DFU mode, you should see output including the
following:
Erase [=========================] 100% 87036 bytes
Expand Down
18 changes: 11 additions & 7 deletions fw/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ LDSCRIPT = stm32f1.ld # Also works for STM32F4
BOARD_TYPE := STM32F107

ifeq ($(BOARD_TYPE), STM32F4)
$(info Building for STM32F4)
#$(info Building for STM32F4)
LIBNAME := opencm3_stm32f4
ARCH_FLAGS := -mthumb -mcpu=cortex-m4 -mhard-float
DEFS += -DSTM32F4 -DSTM32F407xx
else ifeq ($(BOARD_TYPE), STM32F103)
$(info Building for STM32F103)
#$(info Building for STM32F103)
LIBNAME := opencm3_stm32f1
ARCH_FLAGS := -mthumb -mcpu=cortex-m3 -msoft-float
DEFS += -DSTM32F1 -DSTM32F103xE
else
$(info Building for STM32F107)
#$(info Building for STM32F107)
LIBNAME := opencm3_stm32f1
ARCH_FLAGS := -mthumb -mcpu=cortex-m3 -msoft-float
DEFS += -DSTM32F1 -DSTM32F107xC
Expand Down Expand Up @@ -204,7 +204,7 @@ $(OPENCM3_LIB): | $(OPENCM3_DIR)
-x bmp_flash.scr \
$(OBJDIR)/$*.elf

clean:
clean clean-all:
@echo Cleaning
$(QUIET)$(RM) $(GENERATED_BINARIES) generated.* $(OBJS) $(OBJS:%.o=%.d)

Expand All @@ -214,12 +214,16 @@ clean:
UDEV_DIR := /etc/udev/rules.d
UDEV_FILENAMES := 70-st-link.rules 70-ttymxprog.rules
UDEV_FILE_PATHS := $(UDEV_FILENAMES:%=$(UDEV_DIR)/%)
ifneq (,$(wildcard $(UDEV_FILE_PATHS)))
$(UDEV_FILE_PATHS) &:
sudo cp -np udev/* $(UDEV_DIR)
sudo udevadm control --reload
else
$(UDEV_FILE_PATHS) &:
endif

# Write STM32 flash using DFU mode
just-dfu: $(UDEV_FILE_PATHS)
just-dfu:
$(DFU_UTIL) --device 0483:df11 --alt 0 --download $(BINARY).bin --dfuse-address 0x08000000:leave

dfu-unprotect: $(UDEV_FILE_PATHS)
Expand Down Expand Up @@ -260,7 +264,7 @@ just-protect: $(ST_TOOLS_PATH)/st-flash | $(UDEV_FILE_PATHS)
just-clobber: $(ST_TOOLS_PATH)/st-flash | $(UDEV_FILE_PATHS)
$(ST_TOOLS_PATH)/st-flash $(ST_ARGS) --reset write flash_clobber.bin 0x1ffff800

dfu: all just-dfu
dfu: all $(UDEV_FILE_PATHS) just-dfu
flash: all just-flash

# Connect to remote STM32 via ST-Link (follow with "make gdb")
Expand All @@ -282,4 +286,4 @@ $(ST_TOOLS_PATH)/st-flash build-stutils: | $(ST_BUILD_DIR)
gdb:
gdb -q -x .gdbinit $(BINARY).elf

.PHONY: images clean get-stutils build_stutils stlink dfu flash just-dfu just-flash just-unprotect just-dfu dfu-unprotect clean size elf bin hex srec list udev-files
.PHONY: images clean get-stutils build_stutils stlink dfu flash just-dfu just-flash just-unprotect just-dfu dfu-unprotect size elf bin hex srec list udev-files
Loading

0 comments on commit 1f8f01a

Please sign in to comment.