Mercurial > public > ostc4
comparison BootLoader/Src/base_bootlader.c @ 991:39b25be11009 BootloaderOstc5
Jump to Bootloader:
In the previous version it was hard to get into the bootloader at startup. Rootcause was a change in the timing of the loop operations which detect a key press. The countdown values have been increased to allow an easier jump to the bootloader
| author | Ideenmodellierer |
|---|---|
| date | Tue, 15 Apr 2025 17:36:19 +0200 |
| parents | 45a2bd04b156 |
| children | 39f28cd9dc46 |
comparison
equal
deleted
inserted
replaced
| 987:45a2bd04b156 | 991:39b25be11009 |
|---|---|
| 415 HAL_Delay(10); | 415 HAL_Delay(10); |
| 416 } | 416 } |
| 417 } | 417 } |
| 418 | 418 |
| 419 | 419 |
| 420 int main(void) | 420 int __attribute__((optimize("O0"))) main(void) |
| 421 { | 421 { |
| 422 | 422 |
| 423 /* | 423 /* |
| 424 HAL_Init(); | 424 HAL_Init(); |
| 425 SystemClock_Config(); | 425 SystemClock_Config(); |
| 445 MX_GPIO_Init(); | 445 MX_GPIO_Init(); |
| 446 | 446 |
| 447 /* button press is only 40 to 50 us low */ | 447 /* button press is only 40 to 50 us low */ |
| 448 MX_GPIO_One_Button_only_Init(); | 448 MX_GPIO_One_Button_only_Init(); |
| 449 | 449 |
| 450 uint32_t i = 500000; | 450 uint32_t i = 4000000; |
| 451 | 451 |
| 452 callForUpdate = __HAL_RCC_GET_FLAG(RCC_FLAG_SFTRST); | 452 callForUpdate = __HAL_RCC_GET_FLAG(RCC_FLAG_SFTRST); |
| 453 | 453 |
| 454 if(callForUpdate) | 454 if(callForUpdate) |
| 455 { | 455 { |
| 469 i--; | 469 i--; |
| 470 __NOP(); | 470 __NOP(); |
| 471 } | 471 } |
| 472 if(i) | 472 if(i) |
| 473 { | 473 { |
| 474 i = 200000; | 474 i = 4000000; |
| 475 while(!MX_GPIO_Read_The_One_Button() && i) | 475 while(!MX_GPIO_Read_The_One_Button() && i) |
| 476 { | 476 { |
| 477 i--; | 477 i--; |
| 478 __NOP(); | 478 __NOP(); |
| 479 } | 479 } |
| 480 if(i) | 480 if(i) |
| 481 { | 481 { |
| 482 i = 200000; | 482 i = 4000000; |
| 483 while(MX_GPIO_Read_The_One_Button() && i) | 483 while(MX_GPIO_Read_The_One_Button() && i) |
| 484 { | 484 { |
| 485 i--; | 485 i--; |
| 486 __NOP(); | 486 __NOP(); |
| 487 } | |
| 488 if(i) | |
| 489 { | |
| 490 i = 200000; | |
| 491 while(!MX_GPIO_Read_The_One_Button() && i) | |
| 492 { | |
| 493 i--; | |
| 494 __NOP(); | |
| 495 } | |
| 496 if(i) | |
| 497 { | |
| 498 i = 200000; | |
| 499 while(MX_GPIO_Read_The_One_Button() && i) | |
| 500 { | |
| 501 i--; | |
| 502 __NOP(); | |
| 503 } | |
| 504 } | |
| 505 } | 487 } |
| 506 } | 488 } |
| 507 } | 489 } |
| 508 } | 490 } |
| 509 | 491 |
