Added firmware packs

This commit is contained in:
jjwbruijn
2023-05-06 18:33:40 +02:00
parent 5a1488c986
commit 25cfe44784
6 changed files with 107 additions and 0 deletions

BIN
binaries/AP_FW_Pack.bin Normal file

Binary file not shown.

BIN
binaries/Tag_FW_Pack.bin Normal file

Binary file not shown.

View File

@@ -16,3 +16,5 @@ echo -e "\n\nBuilding 1.54 version..."
make BUILD=zbs154v033 CPU=8051 SOC=zbs243 > /dev/null
mv main.bin ../binaries/AP_FW_1.54.bin -v
make clean > /dev/null
php packagebinaries.php

View File

@@ -0,0 +1,50 @@
<?php
$types[0x00] = "AP_FW_1.54.bin";
$types[0x01] = "AP_FW_2.9.bin";
$types[0xF0] = "AP_FW_Segmented_UK.bin";
$types[0xFF] = "AP_FW_Nodisplay.bin";
$binpath = "../binaries/";
$tocmaxsize = 512;
$toc = array();
$output = '';
$output = str_pad($output,$tocmaxsize,"\0");
$version = exec("cat main.c | grep version | grep uint16_t");
list($blaat, $version) = explode("= 0x",$version);
if(strlen($version)<4)die("Couldn't read version from main.c, please check. I got $version");
$version = hexdec($version);
exec("ls -1 $binpath | grep 'AP_FW' | grep -v Pack", $binaries);
foreach($binaries as $file){
$file = trim($file);
$type = -1;
foreach($types as $typeid => $typefile){
if($typefile == $file){
$type = $typeid;
}
}
if($type==-1)die("We don't recognize filetype <$file>, sorry...\n");
$binary = file_get_contents($binpath.$file);
$length = strlen($binary);
$offset = strlen($output);
$subarr['type']=$type;
$subarr['version']=$version;
$subarr['name']=$file;
$subarr['offset']=$offset;
$subarr['length']=$length;
$toc[] = $subarr;
$output.=$binary;
}
$jtoc = json_encode($toc);
$tocsize = strlen($jtoc);
if($tocsize>$tocmaxsize)die("TOC is too big! adjust size and try again\n");
$output = substr_replace($output,$jtoc,0,strlen($jtoc));
file_put_contents($binpath."AP_FW_Pack.bin", $output);
print_r($toc);
echo "All done.\n";

View File

@@ -20,3 +20,5 @@ echo -e "\n\nBuilding 2.9 (UC8151) version..."
make BUILD=zbs29_uc8151 CPU=8051 SOC=zbs243 > /dev/null
mv main.bin ../binaries/Tag_FW_2.9-uc8151.bin -v
make clean > /dev/null
php packagebinaries.php

View File

@@ -0,0 +1,53 @@
<?php
$types[0x00] = "Tag_FW_1.54.bin";
$types[0x01] = "Tag_FW_2.9.bin";
$types[0xF0] = "Tag_FW_Segmented_UK.bin";
$types[0x02] = "Tag_FW_4.2.bin";
$types[0x11] = "Tag_FW_2.9-uc8151.bin";
$binpath = "../binaries/";
$tocmaxsize = 512;
$toc = array();
$output = '';
$output = str_pad($output,$tocmaxsize,"\0");
/*
$version = exec("cat main.c | grep version | grep uint16_t");
list($blaat, $version) = explode("= 0x",$version);
if(strlen($version)<4)die("Couldn't read version from main.c, please check. I got $version");
$version = hexdec($version);
*/
$version = 0;
exec("ls -1 $binpath | grep 'Tag_FW' | grep -v battery | grep -v Pack", $binaries);
foreach($binaries as $file){
$file = trim($file);
$type = -1;
foreach($types as $typeid => $typefile){
if($typefile == $file){
$type = $typeid;
}
}
if($type==-1)die("We don't recognize filetype <$file>, sorry...\n");
$binary = file_get_contents($binpath.$file);
$length = strlen($binary);
$offset = strlen($output);
$subarr['type']=$type;
$subarr['version']=$version;
$subarr['name']=$file;
$subarr['offset']=$offset;
$subarr['length']=$length;
$toc[]=$subarr;
$output.=$binary;
}
$jtoc = json_encode($toc);
$tocsize = strlen($jtoc);
if($tocsize>$tocmaxsize)die("TOC is too big! adjust size and try again\n");
$output = substr_replace($output,$jtoc,0,strlen($jtoc));
file_put_contents($binpath."Tag_FW_Pack.bin", $output);
print_r($toc);
echo "All done.\n";