Skip to content

Commit 364bb61

Browse files
dhylandsdpgeorge
authored andcommitted
stmhal: Allow make DEBUG=1 to build
1 parent 8844d03 commit 364bb61

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

stmhal/Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,16 @@ CFLAGS += -DSTM32_HAL_H='<stm32$(MCU_SERIES)xx_hal.h>'
5858
LDFLAGS = -nostdlib -T $(LD_FILE) -Map=$(@:.elf=.map) --cref
5959
LIBS =
6060

61+
# Remove uncalled code from the final image.
62+
CFLAGS += -fdata-sections -ffunction-sections
63+
LDFLAGS += --gc-sections
64+
6165
# Debugging/Optimization
6266
ifeq ($(DEBUG), 1)
6367
CFLAGS += -g -DPENDSV_DEBUG
6468
COPT = -O0
6569
else
66-
CFLAGS += -fdata-sections -ffunction-sections
6770
COPT += -Os -DNDEBUG
68-
LDFLAGS += --gc-sections
6971
endif
7072

7173
# uncomment this if you want libgcc

stmhal/uart.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ void uart_deinit(void) {
115115
STATIC bool uart_init2(pyb_uart_obj_t *uart_obj) {
116116
USART_TypeDef *UARTx;
117117
IRQn_Type irqn;
118-
uint32_t GPIO_Pin, GPIO_Pin2;
118+
uint32_t GPIO_Pin, GPIO_Pin2 = 0;
119119
uint8_t GPIO_AF_UARTx = 0;
120120
GPIO_TypeDef* GPIO_Port = NULL;
121121
GPIO_TypeDef* GPIO_Port2 = NULL;

0 commit comments

Comments
 (0)