mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
Revert "bu: remove LED support from bootloader updaters"
This reverts commit 7f03a77492
.
This commit is contained in:
parent
400e529703
commit
ac75dd7be1
@ -34,7 +34,7 @@
|
|||||||
/* Prototype of PIOS_Board_Init() function */
|
/* Prototype of PIOS_Board_Init() function */
|
||||||
extern void PIOS_Board_Init(void);
|
extern void PIOS_Board_Init(void);
|
||||||
extern void FLASH_Download();
|
extern void FLASH_Download();
|
||||||
void error(void);
|
void error(int);
|
||||||
|
|
||||||
/* The ADDRESSES of the _binary_* symbols are the important
|
/* The ADDRESSES of the _binary_* symbols are the important
|
||||||
* data. This is non-intuitive for _binary_size where you
|
* data. This is non-intuitive for _binary_size where you
|
||||||
@ -51,11 +51,14 @@ int main() {
|
|||||||
|
|
||||||
PIOS_SYS_Init();
|
PIOS_SYS_Init();
|
||||||
PIOS_Board_Init();
|
PIOS_Board_Init();
|
||||||
|
PIOS_LED_On(PIOS_LED_HEARTBEAT);
|
||||||
|
PIOS_DELAY_WaitmS(3000);
|
||||||
|
PIOS_LED_Off(PIOS_LED_HEARTBEAT);
|
||||||
|
|
||||||
/// Self overwrite check
|
/// Self overwrite check
|
||||||
uint32_t base_address = SCB->VTOR;
|
uint32_t base_address = SCB->VTOR;
|
||||||
if ((0x08000000 + embedded_image_size) > base_address)
|
if ((0x08000000 + embedded_image_size) > base_address)
|
||||||
error();
|
error(PIOS_LED_HEARTBEAT);
|
||||||
///
|
///
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -77,7 +80,7 @@ int main() {
|
|||||||
if ((pios_board_info_blob.magic != new_board_info_blob->magic) ||
|
if ((pios_board_info_blob.magic != new_board_info_blob->magic) ||
|
||||||
(pios_board_info_blob.board_type != new_board_info_blob->board_type) ||
|
(pios_board_info_blob.board_type != new_board_info_blob->board_type) ||
|
||||||
(pios_board_info_blob.board_rev != new_board_info_blob->board_rev)) {
|
(pios_board_info_blob.board_rev != new_board_info_blob->board_rev)) {
|
||||||
error();
|
error(PIOS_LED_HEARTBEAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Embedded bootloader looks like it's the right one for this HW, proceed... */
|
/* Embedded bootloader looks like it's the right one for this HW, proceed... */
|
||||||
@ -105,7 +108,7 @@ int main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fail == true)
|
if (fail == true)
|
||||||
error();
|
error(PIOS_LED_HEARTBEAT);
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -113,6 +116,7 @@ int main() {
|
|||||||
/// Bootloader programing
|
/// Bootloader programing
|
||||||
for (uint32_t offset = 0; offset < embedded_image_size/sizeof(uint32_t); ++offset) {
|
for (uint32_t offset = 0; offset < embedded_image_size/sizeof(uint32_t); ++offset) {
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
PIOS_LED_Toggle(PIOS_LED_HEARTBEAT);
|
||||||
for (uint8_t retry = 0; retry < MAX_WRI_RETRYS; ++retry) {
|
for (uint8_t retry = 0; retry < MAX_WRI_RETRYS; ++retry) {
|
||||||
if (result == false) {
|
if (result == false) {
|
||||||
result = (FLASH_ProgramWord(0x08000000 + (offset * 4), embedded_image_start[offset])
|
result = (FLASH_ProgramWord(0x08000000 + (offset * 4), embedded_image_start[offset])
|
||||||
@ -120,9 +124,15 @@ int main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (result == false)
|
if (result == false)
|
||||||
error();
|
error(PIOS_LED_HEARTBEAT);
|
||||||
}
|
}
|
||||||
///
|
///
|
||||||
|
for (uint8_t x = 0; x < 3; ++x) {
|
||||||
|
PIOS_LED_On(PIOS_LED_HEARTBEAT);
|
||||||
|
PIOS_DELAY_WaitmS(1000);
|
||||||
|
PIOS_LED_Off(PIOS_LED_HEARTBEAT);
|
||||||
|
PIOS_DELAY_WaitmS(1000);
|
||||||
|
}
|
||||||
|
|
||||||
/// Invalidate the bootloader updater so we won't run
|
/// Invalidate the bootloader updater so we won't run
|
||||||
/// the update again on the next power cycle.
|
/// the update again on the next power cycle.
|
||||||
@ -135,7 +145,11 @@ int main() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void error(void) {
|
void error(int led) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
PIOS_LED_On(led);
|
||||||
|
PIOS_DELAY_WaitmS(500);
|
||||||
|
PIOS_LED_Off(led);
|
||||||
|
PIOS_DELAY_WaitmS(500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user