From 7cbc44b8d3bb13bb32b8d9069e262483578cf82f Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Thu, 4 Oct 2018 11:31:36 -0400 Subject: [PATCH] stm32f1: Use -O2 optimization and inline timer_read_time() As long as timer_read_time() is inlined, I get better performance with gcc -O2 optimization. The binary is also dramatically smaller and O2 better matches the other platforms. Signed-off-by: Kevin O'Connor --- src/stm32f1/Makefile | 1 - src/stm32f1/timer.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/stm32f1/Makefile b/src/stm32f1/Makefile index 66a677db..44643e5e 100644 --- a/src/stm32f1/Makefile +++ b/src/stm32f1/Makefile @@ -11,7 +11,6 @@ CFLAGS += -mthumb -mcpu=cortex-m3 CFLAGS += -Ilib/cmsis-core CFLAGS += -Ilib/cmsis-stm32f1/include -Ilib/hal-stm32f1/include CFLAGS += -DSTM32F103xB -CFLAGS += -O3 CFLAGS_klipper.elf += -T $(OUT)stm32f1.ld CFLAGS_klipper.elf += --specs=nano.specs --specs=nosys.specs diff --git a/src/stm32f1/timer.c b/src/stm32f1/timer.c index e9b96b0a..99eb751f 100644 --- a/src/stm32f1/timer.c +++ b/src/stm32f1/timer.c @@ -50,7 +50,7 @@ timer_kick(void) static uint32_t timer_high; // Return the current time (in absolute clock ticks). -uint32_t +inline uint32_t timer_read_time(void) { uint32_t th = readl(&timer_high);