From cc6e922d1bf375eb51fc2e6d5b23a2cc6e024ab0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Sun, 23 Aug 2020 21:51:34 +0200 Subject: [PATCH] Move variables to CCM RAM --- stm-firmware/systick.c | 3 ++- stm-firmware/ui/lcd.c | 17 +++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/stm-firmware/systick.c b/stm-firmware/systick.c index 553d6ca..a949e25 100644 --- a/stm-firmware/systick.c +++ b/stm-firmware/systick.c @@ -112,7 +112,7 @@ bool __attribute__((optimize("O3"))) systick_ticks_have_passed(uint64_t start_ti */ void __attribute__((optimize("O3"))) SysTick_Handler() { - static uint32_t pre_tick = 0UL; + static uint32_t IN_SECTION(.ccm.bss) pre_tick = 0UL; pre_tick++; if (pre_tick == 10) { @@ -121,5 +121,6 @@ void __attribute__((optimize("O3"))) SysTick_Handler() wait_tick_ms++; global_tick_ms++; } + lcd_tick_100us++; } diff --git a/stm-firmware/ui/lcd.c b/stm-firmware/ui/lcd.c index 8bd995d..7ab3029 100644 --- a/stm-firmware/ui/lcd.c +++ b/stm-firmware/ui/lcd.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -149,7 +150,7 @@ static void lcd_command(uint8_t data) // Set DD RAM Address --------- 0b1xxxxxxx (Display Data RAM) #define LCD_SET_DDADR 0x80 -static char __attribute__((section(".ccm.bss"))) shadow_display[4][21]; +static char IN_SECTION(.ccm.bss) shadow_display[4][21]; void lcd_clear(void) { @@ -347,13 +348,13 @@ static void lcd_fsm_write_data(bool high, uint8_t data) enum lcd_fsm_ret lcd_fsm_write_buffer(const char (*display_buffer)[21]) { - static bool idle = true; - static uint8_t rows_to_handle = 0; - static uint32_t state_cnt; - static uint8_t row_cnt = 0; - static uint32_t char_cnt; - static uint32_t line_len; - static uint64_t timestamp = 0ULL; + static bool IN_SECTION(.ccm.data) idle = true; + static uint8_t IN_SECTION(.ccm.bss) rows_to_handle = 0; + static uint32_t IN_SECTION(.ccm.bss) state_cnt; + static uint8_t IN_SECTION(.ccm.bss) row_cnt = 0; + static uint32_t IN_SECTION(.ccm.bss) char_cnt; + static uint32_t IN_SECTION(.ccm.bss) line_len; + static uint64_t IN_SECTION(.ccm.bss) timestamp = 0ULL; enum lcd_fsm_ret ret; ret = LCD_FSM_NOP;