Remove legacy fonts and make the bootloader compile with LVGL

This commit is contained in:
Raphael Coeffic
2022-06-11 15:38:08 +02:00
committed by Raphael Coeffic
parent 0404919667
commit ee0c37157d
74 changed files with 2027 additions and 775 deletions
@@ -19,9 +19,11 @@
* GNU General Public License for more details.
*/
#include "opentx.h"
#include "board.h"
#include "boot.h"
#include "bin_files.h"
#include "dataconstants.h"
#include "lcd.h"
#if defined(PCBXLITE)
#define BOOTLOADER_KEYS 0x0F
@@ -47,16 +49,14 @@ typedef void (*voidFunction)(void);
jumpFn(); \
} while(0)
#if !defined(SIMU)
// Bootloader marker:
// -> used to detect valid bootloader files
const uint8_t bootloaderVersion[] __attribute__ ((section(".version"), used)) =
{'B', 'O', 'O', 'T', '1', '0'};
#if defined(ROTARY_ENCODER_NAVIGATION)
volatile rotenc_t rotencValue = 0;
#endif
#if defined(DEBUG)
#if defined(DEBUG) && !defined(SIMU)
volatile tmr10ms_t g_tmr10ms;
#endif
@@ -113,14 +113,17 @@ void init10msTimer()
NVIC_EnableIRQ(INTERRUPT_xMS_IRQn);
}
#if !defined(SIMU)
extern "C" void INTERRUPT_xMS_IRQHandler()
{
INTERRUPT_xMS_TIMER->SR &= ~TIM_SR_UIF;
interrupt10ms();
}
#endif
uint32_t isValidBufferStart(const uint8_t * buffer)
{
#if !defined(SIMU)
#if defined(EEPROM)
if (memoryType == MEM_FLASH)
return isFirmwareStart(buffer);
@@ -129,6 +132,9 @@ uint32_t isValidBufferStart(const uint8_t * buffer)
#else
return isFirmwareStart(buffer);
#endif
#else
return 1;
#endif
}
FlashCheckRes checkFlashFile(unsigned int index, FlashCheckRes res)
@@ -175,7 +181,9 @@ void flashWriteBlock()
{
uint32_t blockOffset = 0;
while (BlockCount) {
#if !defined(SIMU)
flashWrite((uint32_t *)firmwareAddress, (uint32_t *)&Block_buffer[blockOffset]);
#endif
blockOffset += FLASH_PAGESIZE;
firmwareAddress += FLASH_PAGESIZE;
if (BlockCount > FLASH_PAGESIZE) {
@@ -195,14 +203,9 @@ void writeEepromBlock()
}
#endif
int main()
#if !defined(SIMU)
void bootloaderInitApp()
{
BootloaderState state = ST_START;
uint32_t vpos = 0;
uint8_t index = 0;
FRESULT fr;
uint32_t nameCount = 0;
RCC_AHB1PeriphClockCmd(PWR_RCC_AHB1Periph | KEYS_RCC_AHB1Periph |
LCD_RCC_AHB1Periph | BACKLIGHT_RCC_AHB1Periph |
AUX_SERIAL_RCC_AHB1Periph | AUX2_SERIAL_RCC_AHB1Periph |
@@ -281,6 +284,22 @@ int main()
// SD card detect pin
sdInit();
usbInit();
}
int main()
#else // SIMU
void bootloaderInitApp() {}
int bootloaderMain()
#endif
{
BootloaderState state = ST_START;
uint32_t vpos = 0;
uint8_t index = 0;
FRESULT fr;
uint32_t nameCount = 0;
// init hardware (may jump to app)
bootloaderInitApp();
// init screen
bootloaderInitScreen();
@@ -305,15 +324,18 @@ int main()
unlocked = 1;
unlockFlash();
}
#if !defined(SIMU)
usbStart();
usbPluggedIn();
#endif
}
}
if (state == ST_USB) {
if (usbPlugged() == 0) {
vpos = 0;
#if !defined(SIMU)
usbStop();
#endif
if (unlocked) {
lockFlash();
unlocked = 0;
@@ -528,12 +550,16 @@ int main()
lcdRefresh();
lcdRefreshWait();
#if !defined(SIMU)
#if defined(RTC_BACKUP_RAM)
rtcInit();
RTC->BKP0R = SOFTRESET_REQUEST;
#endif
NVIC_SystemReset();
#else
exit(1);
#endif
}
}