build: pass gitrev, use it in fatal_error

pull/25/head
Pavol Rusnak 7 years ago
parent 0c1f609675
commit 8cc8272fb3
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

@ -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)

@ -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')

@ -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 (;;);
}

@ -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);
}

Loading…
Cancel
Save