[tools] uf2ota: embed build date in extension tags
This commit is contained in:
@@ -72,6 +72,7 @@ typedef enum {
|
||||
UF2_TAG_OTA_VERSION = 0x5D57D0, // format version
|
||||
UF2_TAG_BOARD = 0xCA25C8, // board name (lowercase code)
|
||||
UF2_TAG_FIRMWARE = 0x00DE43, // firmware description / name
|
||||
UF2_TAG_BUILD_DATE = 0x822F30, // build date/time as Unix timestamp
|
||||
UF2_TAG_LT_VERSION = 0x59563D, // LT version (semver)
|
||||
UF2_TAG_PART_1 = 0x805946, // OTA1 partition name
|
||||
UF2_TAG_PART_2 = 0xA1E4D7, // OTA2 partition name
|
||||
|
||||
@@ -49,6 +49,7 @@ Name | ID | Type | Description
|
||||
`OTA_VERSION` | 0x5D57D0 | int 8-bit | format version (for simple compatibility checks)
|
||||
`BOARD` | 0xCA25C8 | string | board name / code (lowercase)
|
||||
`FIRMWARE` | 0x00DE43 | string | firmware description / name
|
||||
`BUILD_DATE` | 0x822F30 | int 32-bit | build date/time as Unix timestamp
|
||||
`LT_VERSION` | 0x59563D | semver | LT version
|
||||
`LT_PART_1` | 0x805946 | string | OTA1 partition name
|
||||
`LT_PART_2` | 0xA1E4D7 | string | OTA2 partition name
|
||||
|
||||
@@ -65,6 +65,7 @@ class Tag(IntEnum):
|
||||
OTA_VERSION = 0x5D57D0 # format version
|
||||
BOARD = 0xCA25C8 # board name (lowercase code)
|
||||
FIRMWARE = 0x00DE43 # firmware description / name
|
||||
BUILD_DATE = 0x822F30 # build date/time as Unix timestamp
|
||||
LT_VERSION = 0x59563D # LT version (semver)
|
||||
LT_PART_1 = 0x805946 # OTA1 partition name
|
||||
LT_PART_2 = 0xA1E4D7 # OTA2 partition name
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Copyright (c) Kuba Szczodrzyński 2022-05-27.
|
||||
|
||||
from argparse import ArgumentParser
|
||||
from datetime import datetime
|
||||
from zlib import crc32
|
||||
|
||||
from dump import uf2_dump
|
||||
@@ -21,6 +22,7 @@ def cli():
|
||||
parser.add_argument("--board", help="Board name/code", type=str)
|
||||
parser.add_argument("--version", help="LibreTuya core version", type=str)
|
||||
parser.add_argument("--fw", help="Firmware name:version", type=str)
|
||||
parser.add_argument("--date", help="Build date (Unix, default now)", type=int)
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.action == "info":
|
||||
@@ -70,6 +72,7 @@ def cli():
|
||||
|
||||
uf2.put_int8(Tag.OTA_VERSION, 1)
|
||||
uf2.put_str(Tag.DEVICE, "LibreTuya")
|
||||
uf2.put_int32le(Tag.BUILD_DATE, args.date or int(datetime.now().timestamp()))
|
||||
|
||||
any_ota1 = False
|
||||
any_ota2 = False
|
||||
|
||||
Reference in New Issue
Block a user