Updated build system with firmware hash and release info generator
This commit is contained in:
parent
bfab1e974d
commit
a686fd5577
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,3 +4,4 @@
|
||||
TODO
|
||||
Release/*.hex
|
||||
Release/*.zip
|
||||
Release/*.json
|
||||
|
10
Makefile
10
Makefile
@ -1,4 +1,6 @@
|
||||
prep:
|
||||
prep: prep-avr prep-esp32 prep-samd
|
||||
|
||||
prep-avr:
|
||||
arduino-cli core update-index --config-file arduino-cli.yaml
|
||||
arduino-cli core install arduino:avr
|
||||
arduino-cli core install unsignedio:avr
|
||||
@ -8,6 +10,7 @@ prep-esp32:
|
||||
arduino-cli core install esp32:esp32
|
||||
arduino-cli lib install "Adafruit SSD1306"
|
||||
arduino-cli lib install "AXP202X_Library"
|
||||
arduino-cli lib install "Crypto"
|
||||
|
||||
prep-samd:
|
||||
arduino-cli core update-index --config-file arduino-cli.yaml
|
||||
@ -86,7 +89,10 @@ upload-mega2560:
|
||||
|
||||
release: release-all
|
||||
|
||||
release-all: release-rnode release-mega2560 release-tbeam release-lora32_v20 release-lora32_v21 release-lora32_v20_extled release-lora32_v21_extled release-featheresp32 release-genericesp32 release-heltec32_v2 release-heltec32_v2_extled release-rnode_ng_20 release-rnode_ng_21
|
||||
release-all: release-rnode release-mega2560 release-tbeam release-lora32_v20 release-lora32_v21 release-lora32_v20_extled release-lora32_v21_extled release-featheresp32 release-genericesp32 release-heltec32_v2 release-heltec32_v2_extled release-rnode_ng_20 release-rnode_ng_21 release-hashes
|
||||
|
||||
release-hashes:
|
||||
python ./release_hashes.py > ./Release/release.json
|
||||
|
||||
release-rnode:
|
||||
arduino-cli compile --fqbn unsignedio:avr:rnode -e
|
||||
|
33
release_hashes.py
Normal file
33
release_hashes.py
Normal file
@ -0,0 +1,33 @@
|
||||
import os
|
||||
import json
|
||||
import hashlib
|
||||
|
||||
major_version = None
|
||||
minor_version = None
|
||||
target_version = None
|
||||
|
||||
file = open("Config.h", "rb")
|
||||
config_data = file.read().splitlines()
|
||||
for line in config_data:
|
||||
dline = line.decode("utf-8").strip()
|
||||
components = dline.split()
|
||||
if dline.startswith("#define MAJ_VERS"):
|
||||
major_version = "%01d" % ord(bytes.fromhex(dline.split()[2].split("x")[1]))
|
||||
if dline.startswith("#define MIN_VERS"):
|
||||
minor_version = "%02d" % ord(bytes.fromhex(dline.split()[2].split("x")[1]))
|
||||
|
||||
target_version = major_version+"."+minor_version
|
||||
|
||||
release_hashes = {}
|
||||
target_dir = "./Release"
|
||||
files = os.listdir(target_dir)
|
||||
for filename in files:
|
||||
if os.path.isfile(os.path.join(target_dir, filename)):
|
||||
if filename.startswith("rnode_firmware"):
|
||||
file = open(os.path.join(target_dir, filename), "rb")
|
||||
release_hashes[filename] = {
|
||||
"hash": hashlib.sha256(file.read()).hexdigest(),
|
||||
"version": target_version
|
||||
}
|
||||
|
||||
print(json.dumps(release_hashes))
|
Loading…
Reference in New Issue
Block a user