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
|
LOADER_BUILD_DIR=micropython/loader/build
|
||||||
FIRMWARE_BUILD_DIR=micropython/firmware/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
|
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
|
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
|
build_firmware: vendor res build_cross ## build firmware with frozen modules
|
||||||
$(MAKE) -f Makefile.firmware $(TREZORHAL_PORT_OPTS)
|
$(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
|
build_bootloader: vendor ## build bootloader
|
||||||
$(MAKE) -f Makefile.bootloader $(TREZORHAL_PORT_OPTS)
|
$(MAKE) -f Makefile.bootloader $(TREZORHAL_PORT_OPTS)
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ INC += -I$(SRCDIR_MP)/lib/cmsis/inc
|
|||||||
INC += -I$(BUILD)
|
INC += -I$(BUILD)
|
||||||
|
|
||||||
ifeq ($(DEBUG), 1)
|
ifeq ($(DEBUG), 1)
|
||||||
CFLAGS += -O0 -ggdb
|
CFLAGS += -Os -ggdb
|
||||||
else
|
else
|
||||||
CFLAGS += -Os -DNDEBUG
|
CFLAGS += -Os -DNDEBUG
|
||||||
endif
|
endif
|
||||||
|
@ -360,7 +360,7 @@ INC += -I$(SRCDIR_MP)/lib/cmsis/inc
|
|||||||
INC += -I$(BUILD)
|
INC += -I$(BUILD)
|
||||||
|
|
||||||
ifeq ($(DEBUG), 1)
|
ifeq ($(DEBUG), 1)
|
||||||
CFLAGS += -O0 -ggdb
|
CFLAGS += -Os -ggdb
|
||||||
else
|
else
|
||||||
CFLAGS += -Os -DNDEBUG
|
CFLAGS += -Os -DNDEBUG
|
||||||
endif
|
endif
|
||||||
|
@ -110,7 +110,7 @@ INC += -I$(SRCDIR_MP)/lib/cmsis/inc
|
|||||||
INC += -I$(BUILD)
|
INC += -I$(BUILD)
|
||||||
|
|
||||||
ifeq ($(DEBUG), 1)
|
ifeq ($(DEBUG), 1)
|
||||||
CFLAGS += -O0 -ggdb
|
CFLAGS += -Os -ggdb
|
||||||
else
|
else
|
||||||
CFLAGS += -Os -DNDEBUG
|
CFLAGS += -Os -DNDEBUG
|
||||||
endif
|
endif
|
||||||
|
@ -125,12 +125,12 @@ INC += -I$(BUILD)
|
|||||||
# compiler settings
|
# compiler settings
|
||||||
CWARN = -Wall -Werror
|
CWARN = -Wall -Werror
|
||||||
CWARN += -Wpointer-arith -Wuninitialized
|
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
|
# Debugging/Optimization
|
||||||
ifdef DEBUG
|
ifdef DEBUG
|
||||||
CFLAGS += -g
|
CFLAGS += -g
|
||||||
COPT = -O0
|
COPT = -Os
|
||||||
else
|
else
|
||||||
COPT = -Os -fdata-sections -ffunction-sections #-DNDEBUG
|
COPT = -Os -fdata-sections -ffunction-sections #-DNDEBUG
|
||||||
# _FORTIFY_SOURCE is a feature in gcc/glibc which is intended to provide extra
|
# _FORTIFY_SOURCE is a feature in gcc/glibc which is intended to provide extra
|
||||||
|
Loading…
Reference in New Issue
Block a user