mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-03 12:00:59 +00:00
build: use -Os for debug builds and use them by default
This commit is contained in:
parent
fe434beff0
commit
b30f3b0946
5
Makefile
5
Makefile
@ -7,7 +7,7 @@ BOOTLOADER_BUILD_DIR=micropython/bootloader/build
|
||||
LOADER_BUILD_DIR=micropython/loader/build
|
||||
FIRMWARE_BUILD_DIR=micropython/firmware/build
|
||||
|
||||
TREZORHAL_PORT_OPTS=FROZEN_MPY_DIR=src
|
||||
TREZORHAL_PORT_OPTS=FROZEN_MPY_DIR=src DEBUG=1
|
||||
UNIX_PORT_OPTS=MICROPY_FORCE_32BIT=1 MICROPY_PY_BTREE=0 MICROPY_PY_TERMIOS=0 MICROPY_PY_FFI=0 MICROPY_PY_USSL=0 MICROPY_SSL_AXTLS=0 DEBUG=1
|
||||
CROSS_PORT_OPTS=MICROPY_FORCE_32BIT=1
|
||||
|
||||
@ -47,9 +47,6 @@ build: build_firmware build_bootloader build_loader build_unix build_cross ## bu
|
||||
build_firmware: vendor res build_cross ## build firmware with frozen modules
|
||||
$(MAKE) -f Makefile.firmware $(TREZORHAL_PORT_OPTS)
|
||||
|
||||
build_firmware_debug: vendor res build_cross ## build firmware with frozen modules and debug symbols
|
||||
$(MAKE) -f Makefile.firmware $(TREZORHAL_PORT_OPTS) DEBUG=1
|
||||
|
||||
build_bootloader: vendor ## build bootloader
|
||||
$(MAKE) -f Makefile.bootloader $(TREZORHAL_PORT_OPTS)
|
||||
|
||||
|
@ -112,7 +112,7 @@ INC += -I$(SRCDIR_MP)/lib/cmsis/inc
|
||||
INC += -I$(BUILD)
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -O0 -ggdb
|
||||
CFLAGS += -Os -ggdb
|
||||
else
|
||||
CFLAGS += -Os -DNDEBUG
|
||||
endif
|
||||
|
@ -360,7 +360,7 @@ INC += -I$(SRCDIR_MP)/lib/cmsis/inc
|
||||
INC += -I$(BUILD)
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -O0 -ggdb
|
||||
CFLAGS += -Os -ggdb
|
||||
else
|
||||
CFLAGS += -Os -DNDEBUG
|
||||
endif
|
||||
|
@ -110,7 +110,7 @@ INC += -I$(SRCDIR_MP)/lib/cmsis/inc
|
||||
INC += -I$(BUILD)
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -O0 -ggdb
|
||||
CFLAGS += -Os -ggdb
|
||||
else
|
||||
CFLAGS += -Os -DNDEBUG
|
||||
endif
|
||||
|
@ -125,12 +125,12 @@ INC += -I$(BUILD)
|
||||
# compiler settings
|
||||
CWARN = -Wall -Werror
|
||||
CWARN += -Wpointer-arith -Wuninitialized
|
||||
CFLAGS = $(INC) $(CWARN) -ansi -std=gnu99 -DUNIX $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA)
|
||||
CFLAGS = $(INC) $(CWARN) -std=gnu99 -DUNIX $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA)
|
||||
|
||||
# Debugging/Optimization
|
||||
ifdef DEBUG
|
||||
CFLAGS += -g
|
||||
COPT = -O0
|
||||
COPT = -Os
|
||||
else
|
||||
COPT = -Os -fdata-sections -ffunction-sections #-DNDEBUG
|
||||
# _FORTIFY_SOURCE is a feature in gcc/glibc which is intended to provide extra
|
||||
|
Loading…
Reference in New Issue
Block a user