From cb1bb7592e18a50f33d22f84614c5ee9f45ce21e Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 7 Dec 2020 17:11:49 +1100 Subject: [PATCH] stm32/Makefile: Change -O0 to -Og for DEBUG=1 builds. The -Og optimisation level produces a more realistic build, gives a better debugging experience, and generates smaller code than -O0, allowing debug builds to fit in flash. This commit also assigns variables in can.c to prevent warnings when -Og is used, and builds a board in CI with DEBUG=1 enabled. Signed-off-by: Damien George --- ports/stm32/Makefile | 2 +- ports/stm32/can.c | 4 ++-- tools/ci.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ports/stm32/Makefile b/ports/stm32/Makefile index c3b7bbba98..a9dac03d2c 100644 --- a/ports/stm32/Makefile +++ b/ports/stm32/Makefile @@ -133,7 +133,7 @@ LDFLAGS += --gc-sections # Debugging/Optimization ifeq ($(DEBUG), 1) CFLAGS += -g -DPENDSV_DEBUG -COPT = -O0 +COPT = -Og # Disable text compression in debug builds MICROPY_ROM_TEXT_COMPRESSION = 0 else diff --git a/ports/stm32/can.c b/ports/stm32/can.c index e5fc55e409..bcc6983594 100644 --- a/ports/stm32/can.c +++ b/ports/stm32/can.c @@ -226,8 +226,8 @@ int can_receive(CAN_HandleTypeDef *can, int fifo, CanRxMsgTypeDef *msg, uint8_t HAL_StatusTypeDef CAN_Transmit(CAN_HandleTypeDef *hcan, uint32_t Timeout) { uint32_t transmitmailbox; uint32_t tickstart; - uint32_t rqcpflag; - uint32_t txokflag; + uint32_t rqcpflag = 0; + uint32_t txokflag = 0; // Check the parameters assert_param(IS_CAN_IDTYPE(hcan->pTxMsg->IDE)); diff --git a/tools/ci.sh b/tools/ci.sh index 3b906b449c..ded9fab922 100755 --- a/tools/ci.sh +++ b/tools/ci.sh @@ -200,7 +200,7 @@ function ci_stm32_nucleo_build { make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_F091RC make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_H743ZI CFLAGS_EXTRA='-DMICROPY_PY_THREAD=1' make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_L073RZ - make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_L476RG + make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_L476RG DEBUG=1 make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_WB55 make ${MAKEOPTS} -C ports/stm32/mboot BOARD=NUCLEO_WB55 }