From 7fceed4f5fbe00a7a20e8588de90b26e53810215 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Sat, 20 Feb 2016 19:42:55 +0100 Subject: [PATCH] [Horus] Another 64K saved for Lua --- radio/src/CMakeLists.txt | 2 +- radio/src/fonts.h | 50 ++++++++++++------------ radio/src/gui/horus/fonts.cpp | 44 ++++++++++----------- radio/src/gui/horus/widgets.cpp | 2 +- radio/src/targets/horus/stm32f4_flash.ld | 22 ++++++++--- 5 files changed, 66 insertions(+), 54 deletions(-) diff --git a/radio/src/CMakeLists.txt b/radio/src/CMakeLists.txt index ca2fd8d74..8c232421a 100644 --- a/radio/src/CMakeLists.txt +++ b/radio/src/CMakeLists.txt @@ -257,7 +257,7 @@ if(CPU_TYPE STREQUAL STM32F4) include_directories(${STM32LIB_DIR}/STM32F4xx_StdPeriph_Driver/inc) include_directories(${STM32LIB_DIR}/CMSIS/Device/ST/STM32F4xx/Include) include_directories(${STM32LIB_DIR}/CMSIS/include) - # add_definitions(-DSTM32F4) + add_definitions(-DSTM32F4) set(STM32LIB_SRC ${STM32LIB_SRC} CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc_ride7/startup_stm32f40_41xxx.s diff --git a/radio/src/fonts.h b/radio/src/fonts.h index 9899bbbd8..d8b05c65e 100644 --- a/radio/src/fonts.h +++ b/radio/src/fonts.h @@ -1,30 +1,30 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#ifndef _FONTS_H_ -#define _FONTS_H_ +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef _FONTS_H_ +#define _FONTS_H_ #if defined(COLORLCD) -extern const uint16_t *fontspecsTable[16]; -extern const pm_uchar *fontsTable[16]; +extern const uint16_t * const fontspecsTable[16]; +extern const pm_uchar * const fontsTable[16]; #else @@ -48,4 +48,4 @@ extern const pm_uchar font_4x6_extra[]; #endif -#endif // _FONTS_H_ +#endif // _FONTS_H_ diff --git a/radio/src/gui/horus/fonts.cpp b/radio/src/gui/horus/fonts.cpp index 3e7ecf29f..a2ad4a5a9 100644 --- a/radio/src/gui/horus/fonts.cpp +++ b/radio/src/gui/horus/fonts.cpp @@ -1,23 +1,23 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + #include "../../opentx.h" const uint16_t font_tinsize_specs[] PROGMEM = @@ -68,5 +68,5 @@ const pm_uchar font_xxlsize[] PROGMEM = { #include "font_xxlsize.lbm" }; -const uint16_t *fontspecsTable[16] = { font_stdsize_specs, font_tinsize_specs, font_smlsize_specs, font_midsize_specs, font_dblsize_specs, font_xxlsize_specs }; -const pm_uchar *fontsTable[16] = { font_stdsize, font_tinsize, font_smlsize, font_midsize, font_dblsize, font_xxlsize }; +const uint16_t * const fontspecsTable[16] = { font_stdsize_specs, font_tinsize_specs, font_smlsize_specs, font_midsize_specs, font_dblsize_specs, font_xxlsize_specs }; +const pm_uchar * const fontsTable[16] = { font_stdsize, font_tinsize, font_smlsize, font_midsize, font_dblsize, font_xxlsize }; diff --git a/radio/src/gui/horus/widgets.cpp b/radio/src/gui/horus/widgets.cpp index c83ac5635..94e2c0d3a 100644 --- a/radio/src/gui/horus/widgets.cpp +++ b/radio/src/gui/horus/widgets.cpp @@ -26,7 +26,7 @@ void drawColumnHeader(const char * const * headers, uint8_t index) // TODO ? displayHeader(headers[index]); } -const char * STR_MONTHS[] = { "Jan", "Fev", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; +const char * const STR_MONTHS[] = { "Jan", "Fev", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; #define DATETIME_SEPARATOR_X 425 #define DATETIME_LINE1 9 diff --git a/radio/src/targets/horus/stm32f4_flash.ld b/radio/src/targets/horus/stm32f4_flash.ld index f127d3f0a..a4d8f4e28 100644 --- a/radio/src/targets/horus/stm32f4_flash.ld +++ b/radio/src/targets/horus/stm32f4_flash.ld @@ -110,7 +110,7 @@ SECTIONS . = ALIGN(4); _edata = .; /* define a global symbol at data end */ - } >RAM + } >CCM /* Uninitialized data section */ . = ALIGN(4); @@ -118,18 +118,30 @@ SECTIONS { /* This is used by the startup in order to initialize the .bss secion */ _sbss = .; /* define a global symbol at bss start */ - __bss_start__ = _sbss; + /* __bss_start__ = _sbss; */ *(.bss) *(.bss*) *(COMMON) . = ALIGN(4); _ebss = .; /* define a global symbol at bss end */ - __bss_end__ = _ebss; + /* __bss_end__ = _ebss; */ + } >CCM + + /* collect all uninitialized .ccm sections */ + .ram (NOLOAD) : + { + . = ALIGN(4); + _sram = .; + /* __ccm_start__ = _sccm; */ + *(.ram) + . = ALIGN(4); + _eram = .; + /* __ccm_end__ = _eccm; */ } >RAM - PROVIDE ( end = _ebss ); - PROVIDE ( _end = _ebss ); + PROVIDE ( end = _eram ); + PROVIDE ( _end = _eram ); /* User_heap_stack section, used to check that there is enough RAM left */ ._user_heap_stack :