mirror of
https://github.com/Polprzewodnikowy/SummerCart64.git
synced 2024-11-22 05:59:15 +01:00
different versioning
This commit is contained in:
parent
1fa1240dad
commit
70d287c855
22
.github/workflows/build.yml
vendored
22
.github/workflows/build.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
||||
id: version
|
||||
with:
|
||||
pattern: '\/'
|
||||
string: '-${{ github.ref_name }}'
|
||||
string: '${{ github.ref_name }}'
|
||||
replace-with: '-'
|
||||
|
||||
- name: Build firmware
|
||||
@ -36,18 +36,18 @@ jobs:
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: sc64-pkg${{ steps.version.outputs.replaced }}
|
||||
name: sc64-pkg-${{ steps.version.outputs.replaced }}
|
||||
path: |
|
||||
sc64-extra${{ steps.version.outputs.replaced }}.zip
|
||||
sc64-firmware${{ steps.version.outputs.replaced }}.bin
|
||||
sc64-extra-${{ steps.version.outputs.replaced }}.zip
|
||||
sc64-firmware-${{ steps.version.outputs.replaced }}.bin
|
||||
|
||||
- name: Upload release assets
|
||||
if: github.event_name == 'release' && github.event.action == 'created'
|
||||
uses: softprops/action-gh-release@v0.1.15
|
||||
with:
|
||||
files: |
|
||||
sc64-extra${{ steps.version.outputs.replaced }}.zip
|
||||
sc64-firmware${{ steps.version.outputs.replaced }}.bin
|
||||
sc64-extra-${{ steps.version.outputs.replaced }}.zip
|
||||
sc64-firmware-${{ steps.version.outputs.replaced }}.bin
|
||||
|
||||
build-deployer:
|
||||
strategy:
|
||||
@ -84,7 +84,7 @@ jobs:
|
||||
id: version
|
||||
with:
|
||||
pattern: '\/'
|
||||
string: '-${{ github.ref_name }}'
|
||||
string: '${{ github.ref_name }}'
|
||||
replace-with: '-'
|
||||
|
||||
- name: Install linux packages
|
||||
@ -101,18 +101,18 @@ jobs:
|
||||
run: |
|
||||
mkdir package
|
||||
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
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.name }}${{ steps.version.outputs.replaced }}
|
||||
path: sw/deployer/package/${{ matrix.name }}${{ steps.version.outputs.replaced }}.${{ matrix.extension }}
|
||||
name: ${{ matrix.name }}-${{ steps.version.outputs.replaced }}
|
||||
path: sw/deployer/package/${{ matrix.name }}-${{ steps.version.outputs.replaced }}.${{ matrix.extension }}
|
||||
|
||||
- name: Upload release assets
|
||||
if: github.event_name == 'release' && github.event.action == 'created'
|
||||
uses: softprops/action-gh-release@v0.1.15
|
||||
with:
|
||||
files: |
|
||||
sw/deployer/package/${{ matrix.name }}${{ steps.version.outputs.replaced }}.${{ matrix.extension }}
|
||||
sw/deployer/package/${{ matrix.name }}-${{ steps.version.outputs.replaced }}.${{ matrix.extension }}
|
||||
|
17
build.sh
17
build.sh
@ -2,13 +2,15 @@
|
||||
|
||||
set -e
|
||||
|
||||
SC64_VERSION=${SC64_VERSION:-"none"}
|
||||
|
||||
PACKAGE_FILE_NAME="sc64-extra"
|
||||
|
||||
TOP_FILES=(
|
||||
"./fw/ftdi/ft232h_config.xml"
|
||||
"./sw/tools/primer.py"
|
||||
"./sw/tools/requirements.txt"
|
||||
"./sw/tools/sc64-firmware.bin"
|
||||
"./sc64-firmware-${SC64_VERSION}.bin"
|
||||
)
|
||||
|
||||
FILES=(
|
||||
@ -85,9 +87,10 @@ build_update () {
|
||||
|
||||
pushd sw/tools > /dev/null
|
||||
if [ "$FORCE_CLEAN" = true ]; then
|
||||
rm -f ./sc64-firmware.bin
|
||||
rm -f ../../sc64-firmware-*.bin
|
||||
fi
|
||||
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_TAG}" ]; then GIT_INFO+=$'\n'"tag: $GIT_TAG"; 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 \
|
||||
--boot ../bootloader/build/bootloader.bin \
|
||||
--primer ../controller/build/primer/primer.bin \
|
||||
sc64-firmware.bin
|
||||
../../sc64-firmware-${SC64_VERSION}.bin
|
||||
popd > /dev/null
|
||||
|
||||
BUILT_UPDATE=true
|
||||
@ -109,15 +112,13 @@ build_release () {
|
||||
|
||||
build_update
|
||||
|
||||
if [ -e "./${PACKAGE_FILE_NAME}.zip" ]; then
|
||||
rm -f "./${PACKAGE_FILE_NAME}.zip"
|
||||
if [ -e "./${PACKAGE_FILE_NAME}-${SC64_VERSION}.zip" ]; then
|
||||
rm -f ./${PACKAGE_FILE_NAME}-${SC64_VERSION}.zip
|
||||
fi
|
||||
PACKAGE="./${PACKAGE_FILE_NAME}${SC64_VERSION}.zip"
|
||||
PACKAGE="./${PACKAGE_FILE_NAME}-${SC64_VERSION}.zip"
|
||||
zip -j -r $PACKAGE ${TOP_FILES[@]}
|
||||
zip -r $PACKAGE ${FILES[@]}
|
||||
|
||||
cp sw/tools/sc64-firmware.bin ./sc64-firmware${SC64_VERSION}.bin
|
||||
|
||||
BUILT_RELEASE=true
|
||||
}
|
||||
|
||||
|
@ -470,7 +470,7 @@ void cfg_process (void) {
|
||||
break;
|
||||
|
||||
case 'V':
|
||||
args[0] = version_firmware();
|
||||
version_firmware(&args[0], &args[1]);
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
|
@ -191,8 +191,8 @@ static void usb_rx_process (void) {
|
||||
case 'V':
|
||||
p.rx_state = RX_STATE_IDLE;
|
||||
p.response_pending = true;
|
||||
p.response_info.data_length = 4;
|
||||
p.response_info.data[0] = version_firmware();
|
||||
p.response_info.data_length = 8;
|
||||
version_firmware(&p.response_info.data[0], &p.response_info.data[1]);
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
|
@ -3,8 +3,10 @@
|
||||
|
||||
#define VERSION_MAJOR (2)
|
||||
#define VERSION_MINOR (12)
|
||||
#define VERSION_REVISION (1)
|
||||
|
||||
|
||||
uint32_t version_firmware (void) {
|
||||
return ((VERSION_MAJOR << 16) | (VERSION_MINOR));
|
||||
void version_firmware (uint32_t *version, uint32_t *revision) {
|
||||
*version = ((VERSION_MAJOR << 16) | (VERSION_MINOR));
|
||||
*revision = VERSION_REVISION;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
uint32_t version_firmware (void);
|
||||
void version_firmware (uint32_t *version, uint32_t *revision);
|
||||
|
||||
|
||||
#endif
|
||||
|
2
sw/deployer/Cargo.lock
generated
2
sw/deployer/Cargo.lock
generated
@ -1002,7 +1002,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "sc64deployer"
|
||||
version = "2.12.2"
|
||||
version = "2.12.1"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"clap",
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "sc64deployer"
|
||||
version = "2.12.2"
|
||||
version = "2.12.1"
|
||||
edition = "2021"
|
||||
authors = ["Polprzewodnikowy"]
|
||||
description = "SC64 loader and control software"
|
||||
|
@ -460,12 +460,12 @@ fn handle_dump_command(connection: Connection, args: &DumpArgs) -> Result<(), sc
|
||||
fn handle_info_command(connection: Connection) -> Result<(), sc64::Error> {
|
||||
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 datetime = state.datetime.format("%Y-%m-%d %H:%M:%S %Z");
|
||||
|
||||
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!(" Boot mode: {}", state.boot_mode);
|
||||
println!(" Save type: {}", state.save_type);
|
||||
|
@ -109,20 +109,21 @@ impl SC64 {
|
||||
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 {
|
||||
id: b'V',
|
||||
args: [0, 0],
|
||||
data: &[],
|
||||
})?;
|
||||
if data.len() != 4 {
|
||||
if data.len() != 8 {
|
||||
return Err(Error::new(
|
||||
"Invalid data length received for version get command",
|
||||
));
|
||||
}
|
||||
let major = u16::from_be_bytes(data[0..2].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> {
|
||||
@ -613,8 +614,8 @@ impl SC64 {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn check_firmware_version(&mut self) -> Result<(u16, u16), Error> {
|
||||
let (major, minor) = self
|
||||
pub fn check_firmware_version(&mut self) -> Result<(u16, u16, u32), Error> {
|
||||
let (major, minor, revision) = self
|
||||
.command_version_get()
|
||||
.map_err(|_| Error::new("Outdated SC64 firmware version, please update firmware"))?;
|
||||
if major != SUPPORTED_MAJOR_VERSION || minor < SUPPORTED_MINOR_VERSION {
|
||||
@ -622,7 +623,7 @@ impl SC64 {
|
||||
"Unsupported SC64 firmware version, please update firmware",
|
||||
));
|
||||
}
|
||||
Ok((major, minor))
|
||||
Ok((major, minor, revision))
|
||||
}
|
||||
|
||||
pub fn reset_state(&mut self) -> Result<(), Error> {
|
||||
|
Loading…
Reference in New Issue
Block a user