Mercurial > public > ostc4
comparison BootLoader/Src/base_bootlader.c @ 960:a8c0e6d07b8e Evo_2_23
Minor: fix some typos in the bootloader code
| author | heinrichsweikamp |
|---|---|
| date | Sat, 11 Jan 2025 17:12:39 +0100 |
| parents | f012fcd7f465 |
| children | 2130d771c8db c19c8f17a9f3 |
comparison
equal
deleted
inserted
replaced
| 959:5d5fa0a3b409 | 960:a8c0e6d07b8e |
|---|---|
| 37 ============================================================================== | 37 ============================================================================== |
| 38 ##### bootloader specific ##### | 38 ##### bootloader specific ##### |
| 39 ============================================================================== | 39 ============================================================================== |
| 40 | 40 |
| 41 151130 hw sleep on button3 | 41 151130 hw sleep on button3 |
| 42 (MX_tell_reset_logik_alles_ok() + DataEX_call() in endlos loop) | 42 (MX_tell_reset_logik_alles_ok() + DataEX_call() in endless loop) |
| 43 | 43 |
| 44 ============================================================================== | 44 ============================================================================== |
| 45 ##### bootloader specific ##### | 45 ##### bootloader specific ##### |
| 46 ============================================================================== | 46 ============================================================================== |
| 47 | 47 |
| 87 with the NVIC_PRIORITYGROUP_2 setting. | 87 with the NVIC_PRIORITYGROUP_2 setting. |
| 88 | 88 |
| 89 ============================================================================== | 89 ============================================================================== |
| 90 ##### MainTask ##### | 90 ##### MainTask ##### |
| 91 ============================================================================== | 91 ============================================================================== |
| 92 [..] For everthing slow without importance to be 'in time'. | 92 [..] For everything slow without importance to be 'in time'. |
| 93 Like VPM and Buehlmann. | 93 Like VPM and Buehlmann. |
| 94 No sprintf and probably no GFX_SetFramesTopBottom() stuff neither. | 94 No sprintf and probably no GFX_SetFramesTopBottom() stuff neither. |
| 95 If sprintf is called while sprintf is executed it blows up everything. | 95 If sprintf is called while sprintf is executed it blows up everything. |
| 96 | 96 |
| 97 ============================================================================== | 97 ============================================================================== |
| 98 ##### Frames / the external SDRAM ##### | 98 ##### Frames / the external SDRAM ##### |
| 99 ============================================================================== | 99 ============================================================================== |
| 100 [..] The SDRAM is handled by getFrame() and releaseFrame(). | 100 [..] The SDRAM is handled by getFrame() and releaseFrame(). |
| 101 Each frame with 800*480*2 Bytes. | 101 Each frame with 800*480*2 Bytes. |
| 102 Be carefull to release every frame | 102 Be careful to release every frame |
| 103 otherwise there will be a memory leakage over time. | 103 otherwise there will be a memory leakage over time. |
| 104 housekeepingFrame() in the MainTask takes care of cleaning the frames. | 104 housekeepingFrame() in the MainTask takes care of cleaning the frames. |
| 105 All frames are filled with 0x00. This will be transparent with color of | 105 All frames are filled with 0x00. This will be transparent with color of |
| 106 CLUT_Font020 (is CLUT 0) if the alpha is set for a 16bit pair. | 106 CLUT_Font020 (is CLUT 0) if the alpha is set for a 16bit pair. |
| 107 housekeepingFrame() delays the cleaning of frames still used as screen | 107 housekeepingFrame() delays the cleaning of frames still used as screen |
| 125 | 125 |
| 126 (#) GFX_SetFramesTopBottom() and the subset | 126 (#) GFX_SetFramesTopBottom() and the subset |
| 127 GFX_SetFrameTop() + GFX_SetFrameBottom() | 127 GFX_SetFrameTop() + GFX_SetFrameBottom() |
| 128 Those do not change anything on the display but give commands to.. | 128 Those do not change anything on the display but give commands to.. |
| 129 (#) GFX_change_LTDC() The only place that changes the pointer. | 129 (#) GFX_change_LTDC() The only place that changes the pointer. |
| 130 This prevents erratic behaviour if several changes | 130 This prevents erratic behavior if several changes |
| 131 are made within one refresh rate of the screen. | 131 are made within one refresh rate of the screen. |
| 132 Is called in IRQ by PD4 and HAL_GPIO_EXTI_IRQHandler | 132 Is called in IRQ by PD4 and HAL_GPIO_EXTI_IRQHandler |
| 133 from VSYNC signal. | 133 from VSYNC signal. |
| 134 | 134 |
| 135 [..] Content | 135 [..] Content |
| 140 (#) Text by text_multilinguage.h/.c with one char | 140 (#) Text by text_multilinguage.h/.c with one char |
| 141 necessary only starting from '\x80' | 141 necessary only starting from '\x80' |
| 142 with automatic language switch by | 142 with automatic language switch by |
| 143 selected_language in SSettings | 143 selected_language in SSettings |
| 144 see openEdit_Language() in tMenuEditSystem.c | 144 see openEdit_Language() in tMenuEditSystem.c |
| 145 Therefore there are differnent functions | 145 Therefore there are different functions |
| 146 for example: | 146 for example: |
| 147 write_label_fix() for single char multilanguage | 147 write_label_fix() for single char multilanguage |
| 148 write_label_var() for strings that could include | 148 write_label_var() for strings that could include |
| 149 multilanguage as well | 149 multilanguage as well |
| 150 see GFX_write_string() to get an overview of the controls | 150 see GFX_write_string() to get an overview of the controls |
| 263 .versionSecond = 0, | 263 .versionSecond = 0, |
| 264 .versionThird = 1, | 264 .versionThird = 1, |
| 265 .versionBeta = 1, | 265 .versionBeta = 1, |
| 266 | 266 |
| 267 /* 4 bytes with trailing 0 */ | 267 /* 4 bytes with trailing 0 */ |
| 268 .signature = "cw", | 268 .signature = "mh", |
| 269 | 269 |
| 270 .release_year = 16, | 270 .release_year = 25, |
| 271 .release_month = 4, | 271 .release_month = 1, |
| 272 .release_day = 8, | 272 .release_day = 11, |
| 273 .release_sub = 0, | 273 .release_sub = 0, |
| 274 | 274 |
| 275 /* max 48 with trailing 0 */ | 275 /* max 48 with trailing 0 */ |
| 276 .release_info ="tComm with all", | 276 .release_info ="tComm with all", |
| 277 | 277 |
| 438 HAL_Init(); | 438 HAL_Init(); |
| 439 HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_2); | 439 HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_2); |
| 440 SystemClock_Config(); | 440 SystemClock_Config(); |
| 441 | 441 |
| 442 MX_GPIO_Init(); | 442 MX_GPIO_Init(); |
| 443 | |
| 444 /* feedback for the user | |
| 445 * aber sehr unsch�n beim Warmstart | |
| 446 * da das letzte Bild noch lange nachleuchtet */ | |
| 447 // MX_GPIO_Backlight_max_static_only_Init(); | |
| 448 | |
| 449 | 443 |
| 450 /* button press is only 40 to 50 us low */ | 444 /* button press is only 40 to 50 us low */ |
| 451 MX_GPIO_One_Button_only_Init(); | 445 MX_GPIO_One_Button_only_Init(); |
| 452 | 446 |
| 453 uint32_t i = 500000; | 447 uint32_t i = 500000; |
| 586 } | 580 } |
| 587 | 581 |
| 588 /* here comes the variable upper firmware loader */ | 582 /* here comes the variable upper firmware loader */ |
| 589 if((i == 0) && (status == HAL_OK)) | 583 if((i == 0) && (status == HAL_OK)) |
| 590 { | 584 { |
| 591 tInfo_newpage("load firmware2 data"); | 585 tInfo_newpage("load fontpack data"); |
| 592 uint8_t* pBuffer = (uint8_t*)((uint32_t)0xD0000000); /* blocked via GFX_init1_no_DMA */ | 586 uint8_t* pBuffer = (uint8_t*)((uint32_t)0xD0000000); /* blocked via GFX_init1_no_DMA */ |
| 593 firmware_load_result = ext_flash_read_firmware2(&pOffset, pBuffer,768000*2,0,0); | 587 firmware_load_result = ext_flash_read_firmware2(&pOffset, pBuffer,768000*2,0,0); |
| 594 | 588 |
| 595 if((firmware_load_result > 0) && (firmware_load_result + pOffset <= 1024000)) | 589 if((firmware_load_result > 0) && (firmware_load_result + pOffset <= 1024000)) |
| 596 { | 590 { |
| 658 } | 652 } |
| 659 } | 653 } |
| 660 | 654 |
| 661 if((i == 0) && (status == HAL_OK)) | 655 if((i == 0) && (status == HAL_OK)) |
| 662 { | 656 { |
| 663 tInfo_newpage("Done."); | 657 tInfo_newpage("done."); |
| 664 tInfo_write("Cleaning."); | 658 tInfo_write("cleaning."); |
| 665 ext_flash_erase_firmware_if_not_empty(); | 659 ext_flash_erase_firmware_if_not_empty(); |
| 666 ext_flash_erase_firmware2_if_not_empty(); | 660 ext_flash_erase_firmware2_if_not_empty(); |
| 667 tInfo_write("Reset device."); | 661 tInfo_write("reset device."); |
| 668 reset_to_firmware_using_Watchdog(); | 662 reset_to_firmware_using_Watchdog(); |
| 669 } | 663 } |
| 670 | 664 |
| 671 ptr = 0; | 665 ptr = 0; |
| 672 textVersion[ptr++] = '\020'; | 666 textVersion[ptr++] = '\020'; |
| 707 TIM_init(); | 701 TIM_init(); |
| 708 MX_UART_Init(); | 702 MX_UART_Init(); |
| 709 MX_Bluetooth_PowerOn(); | 703 MX_Bluetooth_PowerOn(); |
| 710 tComm_init(); | 704 tComm_init(); |
| 711 | 705 |
| 712 tInfo_button_text("Exit","","Sleep"); | 706 tInfo_button_text("exit","","sleep"); |
| 713 tInfo_newpage("Bootloader 240812"); | 707 tInfo_newpage("bootloader 250111"); |
| 714 tInfo_write("start bluetooth"); | 708 tInfo_write("start bluetooth"); |
| 715 tInfo_write(""); | 709 tInfo_write(""); |
| 716 tInfo_write(textVersion); | 710 tInfo_write(textVersion); |
| 717 if(tComm_Set_Bluetooth_Name(0) == 0xFF) | 711 if(tComm_Set_Bluetooth_Name(0) == 0xFF) |
| 718 { | 712 { |
| 719 tInfo_write("Init bluetooth"); | 713 tInfo_write("init bluetooth"); |
| 720 tComm_StartBlueModBaseInit(); | 714 tComm_StartBlueModBaseInit(); |
| 721 } | 715 } |
| 722 else | 716 else |
| 723 { | 717 { |
| 724 tInfo_write("Bluetooth set"); | 718 tInfo_write("bluetooth set"); |
| 725 tComm_StartBlueModConfig(); | 719 tComm_StartBlueModConfig(); |
| 726 } | 720 } |
| 727 | 721 |
| 728 set_globalState_Base(); | 722 set_globalState_Base(); |
| 729 | 723 |
| 773 if(returnFromCommCleanUpRequest) | 767 if(returnFromCommCleanUpRequest) |
| 774 { | 768 { |
| 775 tComm_exit(); | 769 tComm_exit(); |
| 776 returnFromCommCleanUpRequest = 0; | 770 returnFromCommCleanUpRequest = 0; |
| 777 GFX_hwBackgroundOn(); | 771 GFX_hwBackgroundOn(); |
| 778 tInfo_button_text("Exit","","Sleep"); | 772 tInfo_button_text("exit","","sleep"); |
| 779 tInfo_newpage("bluetooth disonnected"); | 773 tInfo_newpage("bluetooth disonnected"); |
| 780 tInfo_write(""); | 774 tInfo_write(""); |
| 781 tInfo_write(""); | 775 tInfo_write(""); |
| 782 tInfo_write(""); | 776 tInfo_write(""); |
| 783 tInfo_write(""); | 777 tInfo_write(""); |
| 819 time_without_button_pressed_deciseconds = 0; | 813 time_without_button_pressed_deciseconds = 0; |
| 820 | 814 |
| 821 if(GFX_logoStatus() != 0) | 815 if(GFX_logoStatus() != 0) |
| 822 return; | 816 return; |
| 823 | 817 |
| 824 if(GPIO_Pin == BUTTON_BACK_PIN) // links | 818 if(GPIO_Pin == BUTTON_BACK_PIN) // left |
| 825 action = ACTION_BUTTON_BACK; | 819 action = ACTION_BUTTON_BACK; |
| 826 else | 820 else |
| 827 if(GPIO_Pin == BUTTON_ENTER_PIN) // mitte | 821 if(GPIO_Pin == BUTTON_ENTER_PIN) // center |
| 828 action = ACTION_BUTTON_ENTER; | 822 action = ACTION_BUTTON_ENTER; |
| 829 else | 823 else |
| 830 if(GPIO_Pin == BUTTON_NEXT_PIN) // rechts | 824 if(GPIO_Pin == BUTTON_NEXT_PIN) // right |
| 831 action = ACTION_BUTTON_NEXT; | 825 action = ACTION_BUTTON_NEXT; |
| 832 #ifdef BUTTON_CUSTOM_PIN | 826 #ifdef BUTTON_CUSTOM_PIN |
| 833 else | 827 else |
| 834 if(GPIO_Pin == BUTTON_CUSTOM_PIN) // extra | 828 if(GPIO_Pin == BUTTON_CUSTOM_PIN) // extra |
| 835 action = ACTION_BUTTON_CUSTOM; | 829 action = ACTION_BUTTON_CUSTOM; |
| 1250 { | 1244 { |
| 1251 } | 1245 } |
| 1252 } | 1246 } |
| 1253 | 1247 |
| 1254 /** | 1248 /** |
| 1255 * @brief Perform the SDRAM exernal memory inialization sequence | 1249 * @brief Perform the SDRAM external memory initialization sequence |
| 1256 * @param hsdram: SDRAM handle | 1250 * @param hsdram: SDRAM handle |
| 1257 * @param Command: Pointer to SDRAM command structure | 1251 * @param Command: Pointer to SDRAM command structure |
| 1258 * @retval None | 1252 * @retval None |
| 1259 */ | 1253 */ |
| 1260 static void SDRAM_Initialization_Sequence(SDRAM_HandleTypeDef *hsdram, FMC_SDRAM_CommandTypeDef *Command) | 1254 static void SDRAM_Initialization_Sequence(SDRAM_HandleTypeDef *hsdram, FMC_SDRAM_CommandTypeDef *Command) |
| 1314 | 1308 |
| 1315 /* | 1309 /* |
| 1316 static void DualBoot(void) | 1310 static void DualBoot(void) |
| 1317 { | 1311 { |
| 1318 // Set BFB2 bit to enable boot from Flash Bank2 | 1312 // Set BFB2 bit to enable boot from Flash Bank2 |
| 1319 // Allow Access to Flash control registers and user Falsh | 1313 // Allow Access to Flash control registers and user Flash |
| 1320 HAL_FLASH_Unlock(); | 1314 HAL_FLASH_Unlock(); |
| 1321 | 1315 |
| 1322 // Allow Access to option bytes sector | 1316 // Allow Access to option bytes sector |
| 1323 HAL_FLASH_OB_Unlock(); | 1317 HAL_FLASH_OB_Unlock(); |
| 1324 | 1318 |
| 1364 */ | 1358 */ |
| 1365 | 1359 |
| 1366 | 1360 |
| 1367 /** | 1361 /** |
| 1368 * @brief DMA2D configuration. | 1362 * @brief DMA2D configuration. |
| 1369 * @note This function Configure tha DMA2D peripheral : | 1363 * @note This function Configure the DMA2D peripheral : |
| 1370 * 1) Configure the transfer mode : memory to memory W/ pixel format conversion | 1364 * 1) Configure the transfer mode : memory to memory W/ pixel format conversion |
| 1371 * 2) Configure the output color mode as ARGB4444 | 1365 * 2) Configure the output color mode as ARGB4444 |
| 1372 * 3) Configure the output memory address at SRAM memory | 1366 * 3) Configure the output memory address at SRAM memory |
| 1373 * 4) Configure the data size : 320x120 (pixels) | 1367 * 4) Configure the data size : 320x120 (pixels) |
| 1374 * 5) Configure the input color mode as ARGB8888 | 1368 * 5) Configure the input color mode as ARGB8888 |
