different versioning

This commit is contained in:
Mateusz Faderewski 2023-03-10 16:37:08 +01:00
parent 1fa1240dad
commit 70d287c855
10 changed files with 41 additions and 37 deletions

View File

@ -25,7 +25,7 @@ jobs:
id: version id: version
with: with:
pattern: '\/' pattern: '\/'
string: '-${{ github.ref_name }}' string: '${{ github.ref_name }}'
replace-with: '-' replace-with: '-'
- name: Build firmware - name: Build firmware
@ -36,18 +36,18 @@ jobs:
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: sc64-pkg${{ steps.version.outputs.replaced }} name: sc64-pkg-${{ steps.version.outputs.replaced }}
path: | path: |
sc64-extra${{ steps.version.outputs.replaced }}.zip sc64-extra-${{ steps.version.outputs.replaced }}.zip
sc64-firmware${{ steps.version.outputs.replaced }}.bin sc64-firmware-${{ steps.version.outputs.replaced }}.bin
- name: Upload release assets - name: Upload release assets
if: github.event_name == 'release' && github.event.action == 'created' if: github.event_name == 'release' && github.event.action == 'created'
uses: softprops/action-gh-release@v0.1.15 uses: softprops/action-gh-release@v0.1.15
with: with:
files: | files: |
sc64-extra${{ steps.version.outputs.replaced }}.zip sc64-extra-${{ steps.version.outputs.replaced }}.zip
sc64-firmware${{ steps.version.outputs.replaced }}.bin sc64-firmware-${{ steps.version.outputs.replaced }}.bin
build-deployer: build-deployer:
strategy: strategy:
@ -84,7 +84,7 @@ jobs:
id: version id: version
with: with:
pattern: '\/' pattern: '\/'
string: '-${{ github.ref_name }}' string: '${{ github.ref_name }}'
replace-with: '-' replace-with: '-'
- name: Install linux packages - name: Install linux packages
@ -101,18 +101,18 @@ jobs:
run: | run: |
mkdir package mkdir package
cd target/release cd target/release
tar ${{ matrix.options }} ../../package/${{ matrix.name }}${{ steps.version.outputs.replaced }}.${{ matrix.extension }} ${{ matrix.executable }} tar ${{ matrix.options }} ../../package/${{ matrix.name }}-${{ steps.version.outputs.replaced }}.${{ matrix.extension }} ${{ matrix.executable }}
working-directory: sw/deployer working-directory: sw/deployer
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: ${{ matrix.name }}${{ steps.version.outputs.replaced }} name: ${{ matrix.name }}-${{ steps.version.outputs.replaced }}
path: sw/deployer/package/${{ matrix.name }}${{ steps.version.outputs.replaced }}.${{ matrix.extension }} path: sw/deployer/package/${{ matrix.name }}-${{ steps.version.outputs.replaced }}.${{ matrix.extension }}
- name: Upload release assets - name: Upload release assets
if: github.event_name == 'release' && github.event.action == 'created' if: github.event_name == 'release' && github.event.action == 'created'
uses: softprops/action-gh-release@v0.1.15 uses: softprops/action-gh-release@v0.1.15
with: with:
files: | files: |
sw/deployer/package/${{ matrix.name }}${{ steps.version.outputs.replaced }}.${{ matrix.extension }} sw/deployer/package/${{ matrix.name }}-${{ steps.version.outputs.replaced }}.${{ matrix.extension }}

View File

@ -2,13 +2,15 @@
set -e set -e
SC64_VERSION=${SC64_VERSION:-"none"}
PACKAGE_FILE_NAME="sc64-extra" PACKAGE_FILE_NAME="sc64-extra"
TOP_FILES=( TOP_FILES=(
"./fw/ftdi/ft232h_config.xml" "./fw/ftdi/ft232h_config.xml"
"./sw/tools/primer.py" "./sw/tools/primer.py"
"./sw/tools/requirements.txt" "./sw/tools/requirements.txt"
"./sw/tools/sc64-firmware.bin" "./sc64-firmware-${SC64_VERSION}.bin"
) )
FILES=( FILES=(
@ -85,9 +87,10 @@ build_update () {
pushd sw/tools > /dev/null pushd sw/tools > /dev/null
if [ "$FORCE_CLEAN" = true ]; then if [ "$FORCE_CLEAN" = true ]; then
rm -f ./sc64-firmware.bin rm -f ../../sc64-firmware-*.bin
fi fi
GIT_INFO="" GIT_INFO=""
if [ ! -z "${SC64_VERSION}" ]; then GIT_INFO+=$'\n'"ver: $SC64_VERSION"; fi
if [ ! -z "${GIT_BRANCH}" ]; then GIT_INFO+=$'\n'"branch: $GIT_BRANCH"; fi if [ ! -z "${GIT_BRANCH}" ]; then GIT_INFO+=$'\n'"branch: $GIT_BRANCH"; fi
if [ ! -z "${GIT_TAG}" ]; then GIT_INFO+=$'\n'"tag: $GIT_TAG"; fi if [ ! -z "${GIT_TAG}" ]; then GIT_INFO+=$'\n'"tag: $GIT_TAG"; fi
if [ ! -z "${GIT_SHA}" ]; then GIT_INFO+=$'\n'"sha: $GIT_SHA"; fi if [ ! -z "${GIT_SHA}" ]; then GIT_INFO+=$'\n'"sha: $GIT_SHA"; fi
@ -98,7 +101,7 @@ build_update () {
--fpga ../../fw/project/lcmxo2/impl1/sc64_impl1.jed \ --fpga ../../fw/project/lcmxo2/impl1/sc64_impl1.jed \
--boot ../bootloader/build/bootloader.bin \ --boot ../bootloader/build/bootloader.bin \
--primer ../controller/build/primer/primer.bin \ --primer ../controller/build/primer/primer.bin \
sc64-firmware.bin ../../sc64-firmware-${SC64_VERSION}.bin
popd > /dev/null popd > /dev/null
BUILT_UPDATE=true BUILT_UPDATE=true
@ -109,15 +112,13 @@ build_release () {
build_update build_update
if [ -e "./${PACKAGE_FILE_NAME}.zip" ]; then if [ -e "./${PACKAGE_FILE_NAME}-${SC64_VERSION}.zip" ]; then
rm -f "./${PACKAGE_FILE_NAME}.zip" rm -f ./${PACKAGE_FILE_NAME}-${SC64_VERSION}.zip
fi fi
PACKAGE="./${PACKAGE_FILE_NAME}${SC64_VERSION}.zip" PACKAGE="./${PACKAGE_FILE_NAME}-${SC64_VERSION}.zip"
zip -j -r $PACKAGE ${TOP_FILES[@]} zip -j -r $PACKAGE ${TOP_FILES[@]}
zip -r $PACKAGE ${FILES[@]} zip -r $PACKAGE ${FILES[@]}
cp sw/tools/sc64-firmware.bin ./sc64-firmware${SC64_VERSION}.bin
BUILT_RELEASE=true BUILT_RELEASE=true
} }

View File

@ -470,7 +470,7 @@ void cfg_process (void) {
break; break;
case 'V': case 'V':
args[0] = version_firmware(); version_firmware(&args[0], &args[1]);
break; break;
case 'c': case 'c':

View File

@ -191,8 +191,8 @@ static void usb_rx_process (void) {
case 'V': case 'V':
p.rx_state = RX_STATE_IDLE; p.rx_state = RX_STATE_IDLE;
p.response_pending = true; p.response_pending = true;
p.response_info.data_length = 4; p.response_info.data_length = 8;
p.response_info.data[0] = version_firmware(); version_firmware(&p.response_info.data[0], &p.response_info.data[1]);
break; break;
case 'R': case 'R':

View File

@ -3,8 +3,10 @@
#define VERSION_MAJOR (2) #define VERSION_MAJOR (2)
#define VERSION_MINOR (12) #define VERSION_MINOR (12)
#define VERSION_REVISION (1)
uint32_t version_firmware (void) { void version_firmware (uint32_t *version, uint32_t *revision) {
return ((VERSION_MAJOR << 16) | (VERSION_MINOR)); *version = ((VERSION_MAJOR << 16) | (VERSION_MINOR));
*revision = VERSION_REVISION;
} }

View File

@ -5,7 +5,7 @@
#include <stdint.h> #include <stdint.h>
uint32_t version_firmware (void); void version_firmware (uint32_t *version, uint32_t *revision);
#endif #endif

View File

@ -1002,7 +1002,7 @@ dependencies = [
[[package]] [[package]]
name = "sc64deployer" name = "sc64deployer"
version = "2.12.2" version = "2.12.1"
dependencies = [ dependencies = [
"chrono", "chrono",
"clap", "clap",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "sc64deployer" name = "sc64deployer"
version = "2.12.2" version = "2.12.1"
edition = "2021" edition = "2021"
authors = ["Polprzewodnikowy"] authors = ["Polprzewodnikowy"]
description = "SC64 loader and control software" description = "SC64 loader and control software"

View File

@ -460,12 +460,12 @@ fn handle_dump_command(connection: Connection, args: &DumpArgs) -> Result<(), sc
fn handle_info_command(connection: Connection) -> Result<(), sc64::Error> { fn handle_info_command(connection: Connection) -> Result<(), sc64::Error> {
let mut sc64 = init_sc64(connection, true)?; let mut sc64 = init_sc64(connection, true)?;
let (major, minor) = sc64.check_firmware_version()?; let (major, minor, revision) = sc64.check_firmware_version()?;
let state = sc64.get_device_state()?; let state = sc64.get_device_state()?;
let datetime = state.datetime.format("%Y-%m-%d %H:%M:%S %Z"); let datetime = state.datetime.format("%Y-%m-%d %H:%M:%S %Z");
println!("{}", "SC64 information and current state:".bold()); println!("{}", "SC64 information and current state:".bold());
println!(" Firmware version: v{}.{}", major, minor); println!(" Firmware version: v{}.{}.{}", major, minor, revision);
println!(" RTC datetime: {}", datetime); println!(" RTC datetime: {}", datetime);
println!(" Boot mode: {}", state.boot_mode); println!(" Boot mode: {}", state.boot_mode);
println!(" Save type: {}", state.save_type); println!(" Save type: {}", state.save_type);

View File

@ -109,20 +109,21 @@ impl SC64 {
Ok(data[0..4].try_into().unwrap()) Ok(data[0..4].try_into().unwrap())
} }
fn command_version_get(&mut self) -> Result<(u16, u16), Error> { fn command_version_get(&mut self) -> Result<(u16, u16, u32), Error> {
let data = self.link.execute_command(&Command { let data = self.link.execute_command(&Command {
id: b'V', id: b'V',
args: [0, 0], args: [0, 0],
data: &[], data: &[],
})?; })?;
if data.len() != 4 { if data.len() != 8 {
return Err(Error::new( return Err(Error::new(
"Invalid data length received for version get command", "Invalid data length received for version get command",
)); ));
} }
let major = u16::from_be_bytes(data[0..2].try_into().unwrap()); let major = u16::from_be_bytes(data[0..2].try_into().unwrap());
let minor = u16::from_be_bytes(data[2..4].try_into().unwrap()); let minor = u16::from_be_bytes(data[2..4].try_into().unwrap());
Ok((major, minor)) let revision = u32::from_be_bytes(data[4..8].try_into().unwrap());
Ok((major, minor, revision))
} }
fn command_state_reset(&mut self) -> Result<(), Error> { fn command_state_reset(&mut self) -> Result<(), Error> {
@ -613,8 +614,8 @@ impl SC64 {
Ok(()) Ok(())
} }
pub fn check_firmware_version(&mut self) -> Result<(u16, u16), Error> { pub fn check_firmware_version(&mut self) -> Result<(u16, u16, u32), Error> {
let (major, minor) = self let (major, minor, revision) = self
.command_version_get() .command_version_get()
.map_err(|_| Error::new("Outdated SC64 firmware version, please update firmware"))?; .map_err(|_| Error::new("Outdated SC64 firmware version, please update firmware"))?;
if major != SUPPORTED_MAJOR_VERSION || minor < SUPPORTED_MINOR_VERSION { if major != SUPPORTED_MAJOR_VERSION || minor < SUPPORTED_MINOR_VERSION {
@ -622,7 +623,7 @@ impl SC64 {
"Unsupported SC64 firmware version, please update firmware", "Unsupported SC64 firmware version, please update firmware",
)); ));
} }
Ok((major, minor)) Ok((major, minor, revision))
} }
pub fn reset_state(&mut self) -> Result<(), Error> { pub fn reset_state(&mut self) -> Result<(), Error> {