summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDave Hylands <dhylands@gmail.com>2015-11-25 09:24:36 -0800
committerDamien George <damien.p.george@gmail.com>2015-11-26 00:04:34 +0000
commit364bb61df339c5012fb2d5c4f05af4c57347aa09 (patch)
tree2d9551cc2a5d163b3688582a0ebcd05311ec4d56
parent8844d031e4bc39cb6e6cd053b63a8cdaeb383221 (diff)
downloadmicropython-364bb61df339c5012fb2d5c4f05af4c57347aa09.tar.gz
micropython-364bb61df339c5012fb2d5c4f05af4c57347aa09.zip
stmhal: Allow make DEBUG=1 to build
-rw-r--r--stmhal/Makefile6
-rw-r--r--stmhal/uart.c2
2 files changed, 5 insertions, 3 deletions
diff --git a/stmhal/Makefile b/stmhal/Makefile
index 1e8af39876..8ee3f458f2 100644
--- a/stmhal/Makefile
+++ b/stmhal/Makefile
@@ -58,14 +58,16 @@ CFLAGS += -DSTM32_HAL_H='<stm32$(MCU_SERIES)xx_hal.h>'
LDFLAGS = -nostdlib -T $(LD_FILE) -Map=$(@:.elf=.map) --cref
LIBS =
+# Remove uncalled code from the final image.
+CFLAGS += -fdata-sections -ffunction-sections
+LDFLAGS += --gc-sections
+
# Debugging/Optimization
ifeq ($(DEBUG), 1)
CFLAGS += -g -DPENDSV_DEBUG
COPT = -O0
else
-CFLAGS += -fdata-sections -ffunction-sections
COPT += -Os -DNDEBUG
-LDFLAGS += --gc-sections
endif
# uncomment this if you want libgcc
diff --git a/stmhal/uart.c b/stmhal/uart.c
index b353f5d9e3..3745451636 100644
--- a/stmhal/uart.c
+++ b/stmhal/uart.c
@@ -115,7 +115,7 @@ void uart_deinit(void) {
STATIC bool uart_init2(pyb_uart_obj_t *uart_obj) {
USART_TypeDef *UARTx;
IRQn_Type irqn;
- uint32_t GPIO_Pin, GPIO_Pin2;
+ uint32_t GPIO_Pin, GPIO_Pin2 = 0;
uint8_t GPIO_AF_UARTx = 0;
GPIO_TypeDef* GPIO_Port = NULL;
GPIO_TypeDef* GPIO_Port2 = NULL;