rusefi-1/firmware/bootloader/bootloader_storage.c

24 lines
780 B
C
Raw Normal View History

2017-05-30 15:38:51 -07:00
2018-09-16 19:39:46 -07:00
#include "global.h"
2017-05-30 15:38:51 -07:00
#include "bootloader/bootloader.h"
#if defined(EFI_BOOTLOADER_INCLUDE_CODE) || defined(__DOXYGEN__)
#if defined __GNUC__
#define BOOTLOADER_SECTION __attribute__((section(".bl"))) /* todo: add 'used'? */
#else
#define BOOTLOADER_SECTION @ ".bl"
#endif
#include <bootloader_generated.hxx>
int initBootloader(void) {
// just make sure we use 'bootloader_code' array
2017-06-04 12:01:40 -07:00
// We're forcing the array to be included into the linked binary.
// The first 4 bytes contain a 32-bit address in RAM, which always starts from 0x20000000 for STM32.
// So the bootloader_code[3] is the most significant byte of the address which equals to 0x20.
2017-05-30 15:38:51 -07:00
return (bootloader_code[3] == 0x20) ? 0 : 1; /* todo: should always be 0x20? */
}
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */