1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 23:08:14 +00:00

build: pass gitrev, use it in fatal_error

This commit is contained in:
Pavol Rusnak 2017-10-12 16:02:40 +02:00
parent 0c1f609675
commit 8cc8272fb3
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
4 changed files with 16 additions and 3 deletions

View File

@ -38,6 +38,9 @@ BOARDLOADER_MAXSIZE = 49152
BOOTLOADER_MAXSIZE = 131072
FIRMWARE_MAXSIZE = 786432
GITREV=$(shell git rev-parse --short HEAD)
CFLAGS += -DGITREV=$(GITREV)
## help commands:
help: ## show this help
@ -87,10 +90,10 @@ build_firmware: res build_cross ## build firmware with frozen modules
$(SCONS) CFLAGS="$(CFLAGS)" build/firmware/firmware.bin
build_unix: ## build unix port
$(SCONS) build/unix/micropython $(UNIX_PORT_OPTS)
$(SCONS) CFLAGS="$(CFLAGS)" build/unix/micropython $(UNIX_PORT_OPTS)
build_unix_noui: ## build unix port without UI support
$(SCONS) build/unix/micropython $(UNIX_PORT_OPTS) TREZOR_NOUI=1
$(SCONS) CFLAGS="$(CFLAGS)" build/unix/micropython $(UNIX_PORT_OPTS) TREZOR_NOUI=1
build_cross: ## build mpy-cross port
$(MAKE) -C vendor/micropython/mpy-cross $(CROSS_PORT_OPTS)

View File

@ -221,7 +221,7 @@ SOURCE_EMIT_NATIVE = ['vendor/micropython/py/emitnative.c']
SOURCE_QSTR = SOURCE_MOD + SOURCE_MICROPYTHON + SOURCE_UNIX + SOURCE_EMIT_NATIVE
env = Environment(ENV=os.environ)
env = Environment(ENV=os.environ, CFLAGS=ARGUMENTS.get('CFLAGS', ''))
env.Tool('micropython')

View File

@ -22,6 +22,11 @@ void __attribute__((noreturn)) __fatal_error(const char *expr, const char *msg,
if (func) {
display_printf("func: %s\n", func);
}
#ifdef GITREV
#define XSTR(s) STR(s)
#define STR(s) #s
display_printf("rev : %s\n", XSTR(GITREV));
#endif
for (;;);
}

View File

@ -18,5 +18,10 @@ void __attribute__((noreturn)) __fatal_error(const char *expr, const char *msg,
if (func) {
printf("func: %s\n", func);
}
#ifdef GITREV
#define XSTR(s) STR(s)
#define STR(s) #s
printf("rev : %s\n", XSTR(GITREV));
#endif
exit(1);
}