-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Action for new SMC.BIN artifact (#20)
* Use Stefan's compact version of OneButton. * Enable Perixx keyboard; set numlock at power on * Remove activity LED debug code. * Move mouse and keyboard initialization state machine to START_RESET after reset. * Reset mouse PS2 state machine when powering off. * Pull x16community/main * Add firmware versioning * Update to origin main * Fix bootloader start address * Comment out community16 pins * Implementing Github action that makes SMC.BIN file --------- Co-authored-by: jburks <[email protected]>
- Loading branch information
1 parent
e24f696
commit 5a14287
Showing
3 changed files
with
77 additions
and
4 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
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,62 @@ | ||
import sys | ||
import os | ||
from intelhex import IntelHex | ||
|
||
# Table of compatible Kernal versions (negative value is pre-release) | ||
kernal_versions = {-44, -45, 45, -46} | ||
|
||
# Init header output buffer | ||
buf = [0] * 32 | ||
|
||
# Get SMC firmware version from C++ header file | ||
version_major = 0 | ||
version_minor = 0 | ||
version_patch = 0 | ||
|
||
smc_version = open("version.h", "r") | ||
|
||
lines = smc_version.readlines() | ||
for l in lines: | ||
parts = l.split() | ||
if parts[0] == "#define": | ||
if parts[1] == "version_major": | ||
version_major = int(parts[2]) | ||
buf[0] = version_major | ||
elif parts[1] == "version_minor": | ||
version_minor = int(parts[2]) | ||
buf[1] = version_minor | ||
elif parts[1] == "version_patch": | ||
version_patch = int(parts[2]) | ||
buf[2] = version_patch | ||
|
||
smc_version.close() | ||
|
||
# Add supported Kernal versions to output buffer | ||
i = 32 - len(kernal_versions) | ||
for v in kernal_versions: | ||
buf[i] = v | ||
i = i + 1 | ||
|
||
# Read firmware file | ||
ih = IntelHex() | ||
ih.loadfile(sys.argv[2], format="hex") | ||
firmware = ih.tobinarray() | ||
|
||
# Create output folder, if not exist | ||
try: | ||
os.mkdir(".build") | ||
except: | ||
pass | ||
|
||
# Create SMC.BIN file | ||
smc = open(".build/SMC-" + str(version_major) + "." + str(version_minor) + "." + str(version_patch) + ".BIN", "wb") | ||
i = 0 | ||
for v in buf: | ||
if i < 3: | ||
is_signed = False | ||
else: | ||
is_signed = True | ||
smc.write(v.to_bytes(1, byteorder=sys.byteorder, signed=is_signed)) | ||
i = i + 1 | ||
smc.write(firmware) | ||
smc.close() |
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 |
---|---|---|
|
@@ -16,9 +16,7 @@ include_dir = . | |
; common settings | ||
platform = [email protected] | ||
framework = arduino | ||
; libraries common to all | ||
lib_deps = | ||
mathertel/[email protected] | ||
|
||
; exclude source files in the tests folder meant for cx16 | ||
build_src_filter = +<*> -<tests/*> | ||
|
||
|