diff --git a/Tools/AP_Bootloader/AP_Bootloader.cpp b/Tools/AP_Bootloader/AP_Bootloader.cpp index 4f3edcfe69..f422712080 100644 --- a/Tools/AP_Bootloader/AP_Bootloader.cpp +++ b/Tools/AP_Bootloader/AP_Bootloader.cpp @@ -63,6 +63,8 @@ AP_FlashIface_JEDEC ext_flash; int main(void) { + custom_startup(); + #ifdef STM32F427xx if (BOARD_FLASH_SIZE > 1024 && check_limit_flash_1M()) { board_info.fw_size = (1024 - (FLASH_BOOTLOADER_LOAD_KB + APP_START_OFFSET_KB))*1024; diff --git a/Tools/AP_Bootloader/custom.cpp b/Tools/AP_Bootloader/custom.cpp new file mode 100644 index 0000000000..ef5f7ef434 --- /dev/null +++ b/Tools/AP_Bootloader/custom.cpp @@ -0,0 +1,52 @@ +/* + custom code for specific boards + */ +#include +#include "ch.h" +#include "hal.h" +#include "support.h" + +#ifdef AP_BOOTLOADER_CUSTOM_HERE4 +/* + reset here4 LEDs +*/ +static void bootloader_custom_Here4(void) +{ + for (uint8_t n=0; n<10; n++) { + const uint8_t num_leds = 4; + const uint32_t min_bits = num_leds*25+50; + const uint8_t num_leading_zeros = 8-min_bits%8 + 50; + const uint32_t output_stream_byte_length = (min_bits+7)/8; + palSetLineMode(HAL_GPIO_PIN_LED_DI, PAL_MODE_OUTPUT_PUSHPULL); + palSetLineMode(HAL_GPIO_PIN_LED_SCK, PAL_MODE_OUTPUT_PUSHPULL); + int l = 100; + while (l--) { + for (uint32_t i=0; i