aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-10-04 11:31:36 -0400
committerKevin O'Connor <kevin@koconnor.net>2018-10-11 10:50:51 -0400
commit7cbc44b8d3bb13bb32b8d9069e262483578cf82f (patch)
treeaa8e551bf16795bc20291c7487456c63e4f546f7
parent102ec4938d1d79e840889e3c0a726c11e9245d4b (diff)
downloadkutter-7cbc44b8d3bb13bb32b8d9069e262483578cf82f.tar.gz
kutter-7cbc44b8d3bb13bb32b8d9069e262483578cf82f.tar.xz
kutter-7cbc44b8d3bb13bb32b8d9069e262483578cf82f.zip
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 <kevin@koconnor.net>
-rw-r--r--src/stm32f1/Makefile1
-rw-r--r--src/stm32f1/timer.c2
2 files changed, 1 insertions, 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);