1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2026-02-11 07:03:07 +01:00

add buildname to cibuild, use the firmware name for file names

This commit is contained in:
wellenvogel
2025-09-30 15:27:50 +02:00
parent 034a338a81
commit 5493c9695c
6 changed files with 54 additions and 8 deletions

View File

@@ -62,5 +62,5 @@ jobs:
with: with:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.version.outputs.version}} tag: ${{ steps.version.outputs.version}}
file: ./.pio/build/*/*-{all,update}.bin file: ./.pio/build/*/*${{ steps.version.outputs.version }}*-{all,update}.bin
file_glob: true file_glob: true

View File

@@ -14,6 +14,9 @@
#define LOGLEVEL GwLog::DEBUG #define LOGLEVEL GwLog::DEBUG
#endif #endif
#endif #endif
#ifdef GWBUILD_NAME
#define FIRMWARE_TYPE GWSTRINGIFY(GWBUILD_NAME)
#else
#define FIRMWARE_TYPE GWSTRINGIFY(PIO_ENV_BUILD) #define FIRMWARE_TYPE GWSTRINGIFY(PIO_ENV_BUILD)
#endif
#define IDF_VERSION GWSTRINGIFY(ESP_IDF_VERSION_MAJOR) "." GWSTRINGIFY(ESP_IDF_VERSION_MINOR) "." GWSTRINGIFY(ESP_IDF_VERSION_PATCH) #define IDF_VERSION GWSTRINGIFY(ESP_IDF_VERSION_MAJOR) "." GWSTRINGIFY(ESP_IDF_VERSION_MINOR) "." GWSTRINGIFY(ESP_IDF_VERSION_PATCH)

View File

@@ -2,6 +2,7 @@ Import("env", "projenv")
import os import os
import glob import glob
import shutil import shutil
import re
print("##post script running") print("##post script running")
HDROFFSET=288 HDROFFSET=288
@@ -39,6 +40,7 @@ def post(source,target,env):
appoffset=env.subst("$ESP32_APP_OFFSET") appoffset=env.subst("$ESP32_APP_OFFSET")
firmware=env.subst("$BUILD_DIR/${PROGNAME}.bin") firmware=env.subst("$BUILD_DIR/${PROGNAME}.bin")
(fwname,version)=getFirmwareInfo(firmware) (fwname,version)=getFirmwareInfo(firmware)
fwname=re.sub(r"[^0-9A-Za-z_.-]*","",fwname)
print("found fwname=%s, fwversion=%s"%(fwname,version)) print("found fwname=%s, fwversion=%s"%(fwname,version))
python=env.subst("$PYTHONEXE") python=env.subst("$PYTHONEXE")
print("base=%s,esptool=%s,appoffset=%s,uploaderflags=%s"%(base,esptool,appoffset,uploaderflags)) print("base=%s,esptool=%s,appoffset=%s,uploaderflags=%s"%(base,esptool,appoffset,uploaderflags))
@@ -70,10 +72,12 @@ def post(source,target,env):
print("running %s"%" ".join(cmd)) print("running %s"%" ".join(cmd))
env.Execute(" ".join(cmd),"#testpost") env.Execute(" ".join(cmd),"#testpost")
ofversion="-"+version ofversion="-"+version
versionedFile=os.path.join(outdir,"%s%s-update.bin"%(base,ofversion)) versionedFile=os.path.join(outdir,"%s%s-update.bin"%(fwname,ofversion))
shutil.copyfile(firmware,versionedFile) shutil.copyfile(firmware,versionedFile)
versioneOutFile=os.path.join(outdir,"%s%s-all.bin"%(base,ofversion)) print(f"wrote {versionedFile}")
versioneOutFile=os.path.join(outdir,"%s%s-all.bin"%(fwname,ofversion))
shutil.copyfile(outfile,versioneOutFile) shutil.copyfile(outfile,versioneOutFile)
print(f"wrote {versioneOutFile}")
env.AddPostAction( env.AddPostAction(
"$BUILD_DIR/${PROGNAME}.bin", "$BUILD_DIR/${PROGNAME}.bin",
post post

View File

@@ -72,9 +72,9 @@ const unsigned long HEAP_REPORT_TIME=2000; //set to 0 to disable heap reporting
#define MAX_NMEA2000_MESSAGE_SEASMART_SIZE 500 #define MAX_NMEA2000_MESSAGE_SEASMART_SIZE 500
#define MAX_NMEA0183_MESSAGE_SIZE MAX_NMEA2000_MESSAGE_SEASMART_SIZE #define MAX_NMEA0183_MESSAGE_SIZE MAX_NMEA2000_MESSAGE_SEASMART_SIZE
//assert length of firmware name and version //assert length of firmware name and version
CASSERT(strlen(FIRMWARE_TYPE) <= 32, "environment name (FIRMWARE_TYPE) must not exceed 32 chars"); CASSERT(strlen(FIRMWARE_TYPE) <= 31, "environment name (FIRMWARE_TYPE) must not exceed 32 chars");
CASSERT(strlen(VERSION) <= 32, "VERSION must not exceed 32 chars"); CASSERT(strlen(VERSION) <= 31, "VERSION must not exceed 32 chars");
CASSERT(strlen(IDF_VERSION) <= 32,"IDF_VERSION must not exceed 32 chars"); CASSERT(strlen(IDF_VERSION) <= 31,"IDF_VERSION must not exceed 32 chars");
//https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/app_image_format.html //https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/app_image_format.html
//and removed the bugs in the doc... //and removed the bugs in the doc...
__attribute__((section(".rodata_custom_desc"))) esp_app_desc_t custom_app_desc = { __attribute__((section(".rodata_custom_desc"))) esp_app_desc_t custom_app_desc = {

View File

@@ -803,6 +803,13 @@ resources:
config: config:
children: children:
- type: string
label: 'Build Name'
key: buildname
target: "define:GWBUILD_NAME"
help: "Set a name to identify your build. Will also become the name for the generated files and the firmware type in the image. Max 31 characters."
max: 31
allowed: "0-9A-Za-z_-"
- type: select - type: select
target: environment target: environment
label: 'Board' label: 'Board'

View File

@@ -234,7 +234,11 @@ class PipelineInfo{
} }
const downloadConfig=()=>{ const downloadConfig=()=>{
let name=configName; let name=configName;
if (isModified) name=name.replace(/[0-9]*$/,'')+formatDate(undefined,true); const buildname=config["root:buildname"]
if (buildname && name != buildname){
name+="-"+buildname+"-";
}
name=name.replace(/[0-9]*$/,'')+formatDate(undefined,true);
name+=".json"; name+=".json";
fileDownload(JSON.stringify(config),name); fileDownload(JSON.stringify(config),name);
} }
@@ -521,6 +525,34 @@ class PipelineInfo{
addDescription(config,inputFrame); addDescription(config,inputFrame);
initialConfig=expandedValues[0]; initialConfig=expandedValues[0];
} }
if (config.type === 'string'){
let ip=addEl('input','t'+config.type,inputFrame);
addDescription(config,inputFrame);
ip.value=current?current:"";
ip.addEventListener('change',(ev)=>{
let value=ev.target.value;
let modified=false;
if (config.max){
if (value && value.length > config.max){
modified=true;
value=value.substring(0,config.max);
}
}
if (config.allowed){
let check=new RegExp("[^"+config.allowed+"]","g");
let nv=value.replace(check,"");
if (nv != value){
modified=true;
value=nv;
}
}
if (modified){
ev.target.value=value;
}
callback(Object.assign({},config,{key: value,value:value}),false);
});
}
let childFrame=addEl('div','childFrame',frame); let childFrame=addEl('div','childFrame',frame);
if (initialConfig !== undefined){ if (initialConfig !== undefined){
callback(initialConfig,true,childFrame); callback(initialConfig,true,childFrame);