-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from diegoparrilla/first
First commit
- Loading branch information
Showing
12 changed files
with
805 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Build | ||
|
||
# Trigger when a pull request is received | ||
on: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
python-version: [ "3.10" ] | ||
steps: | ||
- name: Checkout the code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install AtariST Toolkit Docker image | ||
run: curl -sL https://github.com/diegoparrilla/atarist-toolkit-docker/releases/download/latest/linux.sh | bash | ||
|
||
- name: Run - remove interactive | ||
run: sed -i 's/-it//' /usr/local/bin/stcmd | ||
|
||
- name: Run - Build executable and not publish | ||
run: ./build.sh ${GITHUB_WORKSPACE} all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
python-version: [ "3.10" ] | ||
include: | ||
- os: ubuntu-latest | ||
firmware_name: FIRMWARE.IMG | ||
boot_name: BOOT.BIN | ||
steps: | ||
- name: Checkout the code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install AtariST Toolkit Docker image | ||
run: curl -sL https://github.com/diegoparrilla/atarist-toolkit-docker/releases/download/latest/linux.sh | bash | ||
|
||
- name: Run - remove interactive | ||
run: sed -i 's/-it//' /usr/local/bin/stcmd | ||
|
||
- name: Run build and publish | ||
run: ./build.sh ${GITHUB_WORKSPACE} release | ||
|
||
- name: Upload the ROM image file | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: dist/${{ matrix.firmware_name }} | ||
asset_name: ${{ matrix.firmware_name }} | ||
tag: ${{ github.ref }} | ||
overwrite: true | ||
- name: Upload the ROM image file to latest | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: dist/${{ matrix.firmware_name }} | ||
asset_name: ${{ matrix.firmware_name }} | ||
tag: latest | ||
overwrite: true | ||
- name: Upload the trimmed ROM image file | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: dist/${{ matrix.boot_name }} | ||
asset_name: ${{ matrix.boot_name }} | ||
tag: ${{ github.ref }} | ||
overwrite: true | ||
- name: Upload the trimmed ROM image file to latest | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: dist/${{ matrix.boot_name }} | ||
asset_name: ${{ matrix.boot_name }} | ||
tag: latest | ||
overwrite: true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Version from file | ||
VERSION := $(shell cat version.txt) | ||
|
||
# Folder and file names | ||
ODIR = ./obj | ||
SOURCES_DIR = ./src | ||
BUILD_DIR = ./build | ||
DIST_DIR = ./dist | ||
BIN = BOOT.BIN | ||
|
||
# VASM PARAMETERS | ||
# _DEBUG: 1 to enable debug, 0 to disable them | ||
# To disable debug, make target DEBUG_MODE=0 | ||
DEBUG_MODE = 1 | ||
VASMFLAGS=-Faout -quiet -x -m68000 -spaces -showopt -devpac -D_DEBUG=$(DEBUG_MODE) | ||
VASM = vasm | ||
VLINK = vlink | ||
|
||
.PHONY: all | ||
all: prepare dist | ||
|
||
.PHONY: release | ||
release: prepare dist | ||
|
||
.PHONY: prepare | ||
prepare: clean | ||
mkdir -p $(BUILD_DIR) | ||
|
||
clean-compile : clean main.o | ||
|
||
main.o: prepare | ||
$(VASM) $(VASMFLAGS) $(SOURCES_DIR)/main.s -o $(BUILD_DIR)/main.o | ||
|
||
.PHONY: build | ||
build: main.o | ||
$(VLINK) $(BUILD_DIR)/$^ -brawbin1 -o $(BUILD_DIR)/$(BIN) | ||
|
||
|
||
.PHONY: dist | ||
dist: build | ||
mkdir -p $(DIST_DIR) | ||
cp $(BUILD_DIR)/$(BIN) $(DIST_DIR) | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf $(BUILD_DIR) | ||
rm -rf $(DIST_DIR) | ||
|
||
## Tag this version | ||
.PHONY: tag | ||
tag: | ||
git tag v$(VERSION) && git push origin v$(VERSION) && \ | ||
echo "Tagged: $(VERSION)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
|
||
# Ensure an argument is provided | ||
if [ -z "$1" ]; then | ||
echo "Usage: $0 <working_folder> all|release" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$2" ]; then | ||
echo "Usage: $0 <working_folder> all|release" | ||
exit 1 | ||
fi | ||
|
||
|
||
working_folder=$1 | ||
build_type=$2 | ||
|
||
ST_WORKING_FOLDER=$working_folder/romloader stcmd make $build_type | ||
ST_WORKING_FOLDER=$working_folder stcmd make $build_type | ||
|
||
filename="./dist/FIRMWARE.IMG" | ||
|
||
# Copy the BOOT.BIN file to a ROM size file for testing | ||
ST_WORKING_FOLDER=$working_folder stcmd cp ./dist/BOOT.BIN $filename | ||
|
||
# Determine the file size accordingly | ||
filesize=$(ST_WORKING_FOLDER=$working_folder stcmd stat -c %s "$filename") | ||
|
||
# Size for 64Kbytes in bytes | ||
targetsize=$((64 * 1024)) | ||
|
||
# Check if the file is larger than 64Kbytes | ||
if [ "$filesize" -gt "$targetsize" ]; then | ||
echo "The file is already larger than 64Kbytes." | ||
exit 2 | ||
fi | ||
|
||
# Resize the file to 64Kbytes | ||
ST_WORKING_FOLDER=$working_folder stcmd truncate -s $targetsize $filename | ||
|
||
if [ $? -ne 0 ]; then | ||
echo "Failed to resize the file." | ||
exit 3 | ||
fi | ||
|
||
echo "File has been resized to 64Kbytes." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# Version from file | ||
VERSION := $(shell cat version.txt) | ||
|
||
# Folder and file names | ||
ODIR = ./obj | ||
SOURCES_DIR = ./src | ||
BUILD_DIR = ./build | ||
DIST_DIR = ./dist | ||
EXE = ROMLOAD.TOS | ||
|
||
# VASM PARAMETERS | ||
# _DEBUG: 1 to enable debug, 0 to disable them | ||
# To disable debug, make target DEBUG_MODE=0 | ||
VASMFLAGS=-Faout -quiet -x -m68000 -spaces -showopt -devpac -D_DEBUG=$(DEBUG_MODE) | ||
VASM = vasm | ||
VLINK = vlink | ||
|
||
# LIBCMINI PARAMETERS | ||
# IMPORTANT! There is functional verson of the LIBCMINI library in the docker image | ||
# To reference the library, it must set the absolute path inside the container image | ||
# The library is stored in /freemint/libcmini | ||
# More info about the library: https://github.com/freemint/libcmini | ||
LIBCMINI = /freemint/libcmini | ||
|
||
# GCC PARAMETERS | ||
CC = m68k-atari-mint-gcc | ||
CFLAGS=-c -std=gnu99 -I$(LIBCMINI)/include -Os -DVERSION=\"$(VERSION)\" | ||
|
||
# Check if DEBUG_MODE is not empty | ||
ifneq ($(DEBUG_MODE),) | ||
CFLAGS += -D_DEBUG=$(DEBUG_MODE) | ||
endif | ||
|
||
# LINKER PARAMETERS | ||
# Add the -s option to strip the binary | ||
LINKFLAGS=-nostdlib -L$(LIBCMINI)/lib -lcmini -lgcc -Wl,--traditional-format -s | ||
|
||
_OBJS = | ||
|
||
OBJS = $(patsubst %,$(ODIR)/%,$(_OBJS)) | ||
|
||
.PHONY: all | ||
all: dist prepare | ||
|
||
.PHONY: release | ||
release: dist prepare | ||
|
||
.PHONY: prepare | ||
prepare: clean | ||
mkdir -p $(BUILD_DIR) | ||
|
||
clean-compile : clean main.o screen.o | ||
|
||
# All C files | ||
main.o: prepare | ||
$(CC) $(CFLAGS) $(SOURCES_DIR)/main.c -o $(BUILD_DIR)/main.o | ||
|
||
screen.o: prepare | ||
$(CC) $(CFLAGS) $(SOURCES_DIR)/screen.c -o $(BUILD_DIR)/screen.o | ||
|
||
main: main.o screen.o | ||
$(CC) $(LIBCMINI)/lib/crt0.o \ | ||
$(BUILD_DIR)/screen.o \ | ||
$(BUILD_DIR)/main.o \ | ||
-o $(BUILD_DIR)/$(EXE) $(LINKFLAGS); | ||
|
||
.PHONY: dist | ||
dist: main | ||
mkdir -p $(DIST_DIR) | ||
cp $(BUILD_DIR)/$(EXE) $(DIST_DIR) | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf $(BUILD_DIR) | ||
|
||
## Tag this version | ||
.PHONY: tag | ||
tag: | ||
git tag v$(VERSION) && git push origin v$(VERSION) && \ | ||
echo "Tagged: $(VERSION)" |
Oops, something went wrong.