Mercurial > public > ostc4
comparison FontPack/base_upperRegion.c @ 123:a984d87a1ec0 FlipDisplay
Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
| author | Ideenmodellierer |
|---|---|
| date | Sun, 27 Jan 2019 22:01:07 +0100 |
| parents | 51e2734895a3 |
| children | 0172431fbad9 |
comparison
equal
deleted
inserted
replaced
| 122:871baf20776b | 123:a984d87a1ec0 |
|---|---|
| 47 /* Includes ------------------------------------------------------------------*/ | 47 /* Includes ------------------------------------------------------------------*/ |
| 48 | 48 |
| 49 // From Common/Inc: | 49 // From Common/Inc: |
| 50 #include "FirmwareData.h" | 50 #include "FirmwareData.h" |
| 51 | 51 |
| 52 // From Discovery/Inc | 52 |
| 53 #include "gfx_fonts.h" | 53 #ifdef DEBUG |
| 54 | |
| 55 // From AC6 support: | 54 // From AC6 support: |
| 56 #include <stdio.h> | 55 #include <stdio.h> |
| 57 #include <stdint.h> | 56 #include <stdint.h> |
| 57 #endif | |
| 58 | 58 |
| 59 ////////////////////////////////////////////////////////////////////////////// | 59 ////////////////////////////////////////////////////////////////////////////// |
| 60 | 60 |
| 61 const SFirmwareData font_FirmwareData __attribute__(( section(".font_firmware_data") )) = | 61 const SFirmwareData font_FirmwareData __attribute__(( section(".font_firmware_data") )) = |
| 62 { | 62 { |
| 83 .magic[3] = FIRMWARE_MAGIC_END | 83 .magic[3] = FIRMWARE_MAGIC_END |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 ////////////////////////////////////////////////////////////////////////////// | 86 ////////////////////////////////////////////////////////////////////////////// |
| 87 | 87 |
| 88 #ifdef BUILD_LIBRARY | |
| 88 /* Fonts fixed in upper region */ | 89 /* Fonts fixed in upper region */ |
| 89 #include "Fonts/font_awe48.h" | 90 #include "Fonts/font_awe48.h" |
| 90 #include "Fonts/font_T24.h" | 91 #include "Fonts/font_T24.h" |
| 91 #include "Fonts/font_T42.h" | 92 #include "Fonts/font_T42.h" |
| 92 #include "Fonts/font_T48_plus.h" | 93 #include "Fonts/font_T48_plus.h" |
| 93 #include "Fonts/font_T54.h" | 94 #include "Fonts/font_T54.h" |
| 94 #include "Fonts/font_T84.h" | 95 #include "Fonts/font_T84.h" |
| 95 #include "Fonts/font_T105.h" | 96 #include "Fonts/font_T105.h" |
| 96 #include "Fonts/font_T144_plus.h" | 97 #include "Fonts/font_T144_plus.h" |
| 97 | 98 |
| 99 #include "Fonts/image_ostc.h" | |
| 100 #else | |
| 101 #include "gfx_fonts.h" | |
| 102 #endif | |
| 98 | 103 |
| 99 /* Images fixed in upper region */ | 104 /* Images fixed in upper region */ |
| 100 #include "Fonts/image_battery.h" | 105 #include "Fonts/image_battery.h" |
| 101 #include "Fonts/image_heinrichs_weikamp.h" | 106 #include "Fonts/image_heinrichs_weikamp.h" |
| 102 #include "Fonts/image_ostc.h" | 107 |
| 103 | 108 ///////////////////////////////////////////////////////////////////////////// |
| 104 ////////////////////////////////////////////////////////////////////////////// | 109 |
| 110 | |
| 111 #ifdef DEBUG | |
| 112 | |
| 113 #define ASSERT(e) \ | |
| 114 do { if( ! (e) ) { ++errors; printf("FAIL at %3d: %s \n", __LINE__, #e); errorflag = 1;} } while(0) | |
| 115 | |
| 116 #define ASSERT_RANGE(e, min, max) ASSERT(min <= e); ASSERT( e <= max) | |
| 105 | 117 |
| 106 extern void initialise_monitor_handles(void); | 118 extern void initialise_monitor_handles(void); |
| 107 | 119 |
| 108 static int errors = 0; | 120 static int errors = 0; |
| 109 static uint8_t errorflag = 0; | 121 static uint8_t errorflag = 0; |
| 110 | 122 |
| 111 #define ASSERT(e) \ | |
| 112 do { if( ! (e) ) { ++errors; printf("FAIL at %3d: %s \n", __LINE__, #e); errorflag = 1;} } while(0) | |
| 113 | |
| 114 #define ASSERT_RANGE(e, min, max) ASSERT(min <= e); ASSERT( e <= max) | |
| 115 | |
| 116 | |
| 117 | |
| 118 int main(void) | 123 int main(void) |
| 119 { | 124 { |
| 120 #ifdef DEBUG_STLINK_V2 | 125 #if DEBUG_STLINK_V2 |
| 121 initialise_monitor_handles(); | 126 initialise_monitor_handles(); |
| 122 #endif | 127 #endif |
| 123 | |
| 124 //---- Check the linker puts the directory at the requested address ------ | 128 //---- Check the linker puts the directory at the requested address ------ |
| 125 ASSERT( & Awe48 == (tFont*)0x81DFE00 ); | 129 ASSERT( & Awe48 == (tFont*)0x81DFE00 ); |
| 126 ASSERT( & FontT24 == (tFont*)0x81DFE0c ); | 130 ASSERT( & FontT24 == (tFont*)0x81DFE0c ); |
| 127 ASSERT( & FontT42 == (tFont*)0x81DFE18 ); | 131 ASSERT( & FontT42 == (tFont*)0x81DFE18 ); |
| 128 ASSERT( & FontT48 == (tFont*)0x81DFE24 ); | 132 ASSERT( & FontT48 == (tFont*)0x81DFE24 ); |
| 129 ASSERT( & FontT54 == (tFont*)0x81DFE30 ); | 133 ASSERT( & FontT54 == (tFont*)0x81DFE30 ); |
| 130 ASSERT( & FontT84 == (tFont*)0x81DFE3c ); | 134 ASSERT( & FontT84 == (tFont*)0x81DFE3c ); |
| 131 ASSERT( & FontT105 == (tFont*)0x81DFE48 ); | 135 ASSERT( & FontT105 == (tFont*)0x81DFE48 ); |
| 132 ASSERT( & FontT144 == (tFont*)0x81DFE54 ); | 136 ASSERT( & FontT144 == (tFont*)0x81DFE54 ); |
| 133 | 137 |
| 134 | |
| 135 | |
| 136 //---- Check the linker puts the font data in the requested section ------ | 138 //---- Check the linker puts the font data in the requested section ------ |
| 137 extern tChar __upper_font_data; | 139 extern tChar __upper_font_data; |
| 138 extern tChar __upper_font_data_end; | 140 extern tChar __upper_font_data_end; |
| 139 ASSERT( &__upper_font_data == (tChar*)0x08132040 ); | 141 ASSERT( &__upper_font_data == (tChar*)0x08132040 ); |
| 140 ASSERT_RANGE( (int)&__upper_font_data_end, 0x08132040, 0x081E0000); | 142 ASSERT_RANGE( (int)&__upper_font_data_end, 0x08132040, 0x081E0000); |
| 142 //---- Walk through the directory data ----------------------------------- | 144 //---- Walk through the directory data ----------------------------------- |
| 143 extern const tFont __font_directory; | 145 extern const tFont __font_directory; |
| 144 extern const tFont __font_directory_end; | 146 extern const tFont __font_directory_end; |
| 145 | 147 |
| 146 ASSERT_RANGE(&ImgOSTC, (tImage*)&__upper_font_data, (tImage*)&__upper_font_data_end); | 148 ASSERT_RANGE(&ImgOSTC, (tImage*)&__upper_font_data, (tImage*)&__upper_font_data_end); |
| 147 | |
| 148 | |
| 149 | |
| 150 | 149 |
| 151 for(const tFont* font = & __font_directory; font < &__font_directory_end; ++font) | 150 for(const tFont* font = & __font_directory; font < &__font_directory_end; ++font) |
| 152 { | 151 { |
| 153 printf("Font: %x\n",font); | 152 printf("Font: %x\n",font); |
| 154 // Check END-OF-DIRECTORY magic marker | 153 // Check END-OF-DIRECTORY magic marker |
| 234 } | 233 } |
| 235 | 234 |
| 236 printf("Font Check: no errors.\n"); | 235 printf("Font Check: no errors.\n"); |
| 237 return 0; | 236 return 0; |
| 238 } | 237 } |
| 239 | 238 /*#endif*/ |
| 239 #else | |
| 240 #define ASSERT(e) \ | |
| 241 do { if( ! (e) ) { ++errors; errorflag = 1;} } while(0) | |
| 242 | |
| 243 #define ASSERT_RANGE(e, min, max) ASSERT(min <= e); ASSERT( e <= max) | |
| 244 | |
| 245 uint16_t errors = 1; | |
| 246 static uint8_t errorflag = 0; | |
| 247 uint16_t CheckFontPosition() | |
| 248 { | |
| 249 uint16_t retvalue; | |
| 250 ASSERT( & Awe48 == (tFont*)0x81DFE00 ); | |
| 251 ASSERT( & FontT24 == (tFont*)0x81DFE0c ); | |
| 252 ASSERT( & FontT42 == (tFont*)0x81DFE18 ); | |
| 253 ASSERT( & FontT48 == (tFont*)0x81DFE24 ); | |
| 254 ASSERT( & FontT54 == (tFont*)0x81DFE30 ); | |
| 255 ASSERT( & FontT84 == (tFont*)0x81DFE3c ); | |
| 256 ASSERT( & FontT105 == (tFont*)0x81DFE48 ); | |
| 257 ASSERT( & FontT144 == (tFont*)0x81DFE54 ); | |
| 258 retvalue = errors; | |
| 259 return retvalue; | |
| 260 } | |
| 261 #endif | |
| 240 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/ | 262 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/ |
