mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-06-17 13:38:46 +00:00
fix(core): unify Features.revision reporting with legacy
This commit is contained in:
parent
00d4b0a4a9
commit
23aa69caea
1
core/.changelog.d/1620.fixed
Normal file
1
core/.changelog.d/1620.fixed
Normal file
@ -0,0 +1 @@
|
|||||||
|
Unify Features.revision reporting with legacy
|
@ -42,8 +42,7 @@ FIRMWARE_P1_MAXSIZE = 786432
|
|||||||
FIRMWARE_P2_MAXSIZE = 917504
|
FIRMWARE_P2_MAXSIZE = 917504
|
||||||
FIRMWARE_MAXSIZE = 1703936
|
FIRMWARE_MAXSIZE = 1703936
|
||||||
|
|
||||||
GITREV=$(shell git describe --always --dirty | tr '-' '_')
|
CFLAGS += -DSCM_REVISION='\"$(shell git rev-parse HEAD | sed 's:\(..\):\\x\1:g')\"'
|
||||||
CFLAGS += -DGITREV=$(GITREV)
|
|
||||||
|
|
||||||
TESTPATH = $(CURDIR)/../tests
|
TESTPATH = $(CURDIR)/../tests
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "py/objstr.h"
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
@ -115,10 +116,13 @@ STATIC mp_obj_t mod_trezorutils_halt(size_t n_args, const mp_obj_t *args) {
|
|||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_trezorutils_halt_obj, 0, 1,
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_trezorutils_halt_obj, 0, 1,
|
||||||
mod_trezorutils_halt);
|
mod_trezorutils_halt);
|
||||||
|
|
||||||
|
STATIC mp_obj_str_t mod_trezorutils_revision_obj = {
|
||||||
|
{&mp_type_bytes}, 0, sizeof(SCM_REVISION) - 1, (const byte *)SCM_REVISION};
|
||||||
|
|
||||||
#define PASTER(s) MP_QSTR_##s
|
#define PASTER(s) MP_QSTR_##s
|
||||||
#define MP_QSTR(s) PASTER(s)
|
#define MP_QSTR(s) PASTER(s)
|
||||||
|
|
||||||
/// GITREV: str
|
/// SCM_REVISION: bytes
|
||||||
/// VERSION_MAJOR: int
|
/// VERSION_MAJOR: int
|
||||||
/// VERSION_MINOR: int
|
/// VERSION_MINOR: int
|
||||||
/// VERSION_PATCH: int
|
/// VERSION_PATCH: int
|
||||||
@ -132,7 +136,8 @@ STATIC const mp_rom_map_elem_t mp_module_trezorutils_globals_table[] = {
|
|||||||
{MP_ROM_QSTR(MP_QSTR_memcpy), MP_ROM_PTR(&mod_trezorutils_memcpy_obj)},
|
{MP_ROM_QSTR(MP_QSTR_memcpy), MP_ROM_PTR(&mod_trezorutils_memcpy_obj)},
|
||||||
{MP_ROM_QSTR(MP_QSTR_halt), MP_ROM_PTR(&mod_trezorutils_halt_obj)},
|
{MP_ROM_QSTR(MP_QSTR_halt), MP_ROM_PTR(&mod_trezorutils_halt_obj)},
|
||||||
// various built-in constants
|
// various built-in constants
|
||||||
{MP_ROM_QSTR(MP_QSTR_GITREV), MP_ROM_QSTR(MP_QSTR(GITREV))},
|
{MP_ROM_QSTR(MP_QSTR_SCM_REVISION),
|
||||||
|
MP_ROM_PTR(&mod_trezorutils_revision_obj)},
|
||||||
{MP_ROM_QSTR(MP_QSTR_VERSION_MAJOR), MP_ROM_INT(VERSION_MAJOR)},
|
{MP_ROM_QSTR(MP_QSTR_VERSION_MAJOR), MP_ROM_INT(VERSION_MAJOR)},
|
||||||
{MP_ROM_QSTR(MP_QSTR_VERSION_MINOR), MP_ROM_INT(VERSION_MINOR)},
|
{MP_ROM_QSTR(MP_QSTR_VERSION_MINOR), MP_ROM_INT(VERSION_MINOR)},
|
||||||
{MP_ROM_QSTR(MP_QSTR_VERSION_PATCH), MP_ROM_INT(VERSION_PATCH)},
|
{MP_ROM_QSTR(MP_QSTR_VERSION_PATCH), MP_ROM_INT(VERSION_PATCH)},
|
||||||
|
@ -52,8 +52,10 @@ __fatal_error(const char *expr, const char *msg, const char *file, int line,
|
|||||||
if (func) {
|
if (func) {
|
||||||
display_printf("func: %s\n", func);
|
display_printf("func: %s\n", func);
|
||||||
}
|
}
|
||||||
#ifdef GITREV
|
#ifdef SCM_REVISION
|
||||||
display_printf("rev : %s\n", XSTR(GITREV));
|
const uint8_t *rev = (const uint8_t *)SCM_REVISION;
|
||||||
|
display_printf("rev : %02x%02x%02x%02x%02x\n", rev[0], rev[1], rev[2], rev[3],
|
||||||
|
rev[4]);
|
||||||
#endif
|
#endif
|
||||||
display_printf("\nPlease contact Trezor support.\n");
|
display_printf("\nPlease contact Trezor support.\n");
|
||||||
shutdown();
|
shutdown();
|
||||||
|
@ -24,9 +24,6 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "secbool.h"
|
#include "secbool.h"
|
||||||
|
|
||||||
#define XSTR(s) STR(s)
|
|
||||||
#define STR(s) #s
|
|
||||||
|
|
||||||
#ifndef MIN_8bits
|
#ifndef MIN_8bits
|
||||||
#define MIN_8bits(a, b) \
|
#define MIN_8bits(a, b) \
|
||||||
({ \
|
({ \
|
||||||
|
@ -58,9 +58,12 @@ __fatal_error(const char *expr, const char *msg, const char *file, int line,
|
|||||||
display_printf("func: %s\n", func);
|
display_printf("func: %s\n", func);
|
||||||
printf("func: %s\n", func);
|
printf("func: %s\n", func);
|
||||||
}
|
}
|
||||||
#ifdef GITREV
|
#ifdef SCM_REVISION
|
||||||
display_printf("rev : %s\n", XSTR(GITREV));
|
const uint8_t *rev = (const uint8_t *)SCM_REVISION;
|
||||||
printf("rev : %s\n", XSTR(GITREV));
|
display_printf("rev : %02x%02x%02x%02x%02x\n", rev[0], rev[1], rev[2], rev[3],
|
||||||
|
rev[4]);
|
||||||
|
printf("rev : %02x%02x%02x%02x%02x\n", rev[0], rev[1], rev[2], rev[3],
|
||||||
|
rev[4]);
|
||||||
#endif
|
#endif
|
||||||
display_printf("\n\n\nHint:\nIsn't the emulator already running?\n");
|
display_printf("\n\n\nHint:\nIsn't the emulator already running?\n");
|
||||||
printf("Hint:\nIsn't the emulator already running?\n");
|
printf("Hint:\nIsn't the emulator already running?\n");
|
||||||
|
@ -23,9 +23,6 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "secbool.h"
|
#include "secbool.h"
|
||||||
|
|
||||||
#define XSTR(s) STR(s)
|
|
||||||
#define STR(s) #s
|
|
||||||
|
|
||||||
#ifndef MIN
|
#ifndef MIN
|
||||||
#define MIN(a, b) \
|
#define MIN(a, b) \
|
||||||
({ \
|
({ \
|
||||||
|
@ -32,7 +32,7 @@ def halt(msg: str | None = None) -> None:
|
|||||||
"""
|
"""
|
||||||
Halts execution.
|
Halts execution.
|
||||||
"""
|
"""
|
||||||
GITREV: str
|
SCM_REVISION: bytes
|
||||||
VERSION_MAJOR: int
|
VERSION_MAJOR: int
|
||||||
VERSION_MINOR: int
|
VERSION_MINOR: int
|
||||||
VERSION_PATCH: int
|
VERSION_PATCH: int
|
||||||
|
@ -36,7 +36,7 @@ def get_features() -> Features:
|
|||||||
major_version=utils.VERSION_MAJOR,
|
major_version=utils.VERSION_MAJOR,
|
||||||
minor_version=utils.VERSION_MINOR,
|
minor_version=utils.VERSION_MINOR,
|
||||||
patch_version=utils.VERSION_PATCH,
|
patch_version=utils.VERSION_PATCH,
|
||||||
revision=utils.GITREV.encode(),
|
revision=utils.SCM_REVISION,
|
||||||
model=utils.MODEL,
|
model=utils.MODEL,
|
||||||
device_id=storage.device.get_device_id(),
|
device_id=storage.device.get_device_id(),
|
||||||
label=storage.device.get_label(),
|
label=storage.device.get_label(),
|
||||||
|
@ -3,8 +3,8 @@ import sys
|
|||||||
from trezorutils import ( # noqa: F401
|
from trezorutils import ( # noqa: F401
|
||||||
BITCOIN_ONLY,
|
BITCOIN_ONLY,
|
||||||
EMULATOR,
|
EMULATOR,
|
||||||
GITREV,
|
|
||||||
MODEL,
|
MODEL,
|
||||||
|
SCM_REVISION,
|
||||||
VERSION_MAJOR,
|
VERSION_MAJOR,
|
||||||
VERSION_MINOR,
|
VERSION_MINOR,
|
||||||
VERSION_PATCH,
|
VERSION_PATCH,
|
||||||
|
Loading…
Reference in New Issue
Block a user