1 #ifndef __BOOTLOADER_SHARED_H__ 2 #define __BOOTLOADER_SHARED_H__ 35 #define CONF_UART_BAUDRATE 921600 36 #define CONF_UART_BAUDRATE_RS232 230400 37 #define CONF_UART_BAUDRATE_SLOW 115200 40 #ifndef BOOTLOADER_FLASH_TOTAL_SIZE 41 #define BOOTLOADER_FLASH_TOTAL_SIZE ((uint32_t)1048576) 45 #ifndef BOOTLOADER_FLASH_START_ADDRESS 46 #define BOOTLOADER_FLASH_START_ADDRESS ((uint32_t)0x00400000) 50 #ifndef BOOTLOADER_FLASH_BOOTLOADER_SIZE 51 #define BOOTLOADER_FLASH_BOOTLOADER_SIZE ((uint32_t)16384) // 16K 55 #ifndef BOOTLOADER_FLASH_USER_APPLICATION_SIZE 56 #define BOOTLOADER_FLASH_USER_APPLICATION_SIZE ((uint32_t)966656) // 966656 = EC000, 1MB flash - 16K bootloader - 64K footer 60 #ifndef BOOTLOADER_FLASH_SECTOR_SIZE 61 #define BOOTLOADER_FLASH_SECTOR_SIZE ((uint32_t)131072) // 128 KB 65 #ifndef BOOTLOADER_FLASH_PAGE_SIZE 66 #define BOOTLOADER_FLASH_PAGE_SIZE ((uint32_t)512) 70 #ifndef BOOTLOADER_FLASH_BLOCK_SIZE 71 #define BOOTLOADER_FLASH_BLOCK_SIZE ((uint32_t)8192) // 8K 75 #ifndef BOOTLOADER_FLASH_BOOTLOADER_HEADER_SIZE 76 #define BOOTLOADER_FLASH_BOOTLOADER_HEADER_SIZE BOOTLOADER_FLASH_PAGE_SIZE 80 #ifndef BOOTLOADER_FLASH_BOOTLOADER_HEADER_ADDRESS 81 #define BOOTLOADER_FLASH_BOOTLOADER_HEADER_ADDRESS (BOOTLOADER_FLASH_START_ADDRESS + BOOTLOADER_FLASH_BOOTLOADER_SIZE - BOOTLOADER_FLASH_BOOTLOADER_HEADER_SIZE) 85 #ifndef BOOTLOADER_FLASH_CONFIG_MIRROR_BASE_ADDRESS 86 #define BOOTLOADER_FLASH_CONFIG_MIRROR_BASE_ADDRESS (BOOTLOADER_FLASH_START_ADDRESS + 0x000FA000) 90 #ifndef BOOTLOADER_FLASH_CALIB_BASE_ADDRESS 91 #define BOOTLOADER_FLASH_CALIB_BASE_ADDRESS (BOOTLOADER_FLASH_START_ADDRESS + 0x000FC000) 95 #ifndef BOOTLOADER_FLASH_CONFIG_BASE_ADDRESS 96 #define BOOTLOADER_FLASH_CONFIG_BASE_ADDRESS (BOOTLOADER_FLASH_START_ADDRESS + 0x000FE000) 100 #ifndef BOOTLOADER_FLASH_USER_APPLICATION_START_ADDRESS 101 #define BOOTLOADER_FLASH_USER_APPLICATION_START_ADDRESS (BOOTLOADER_FLASH_START_ADDRESS + BOOTLOADER_FLASH_BOOTLOADER_SIZE) 105 #ifndef BOOTLOADER_FLASH_USER_DATA_START_ADDRESS 106 #define BOOTLOADER_FLASH_USER_DATA_START_ADDRESS (BOOTLOADER_FLASH_START_ADDRESS + BOOTLOADER_FLASH_BOOTLOADER_SIZE + BOOTLOADER_FLASH_USER_APPLICATION_SIZE) 110 #ifndef BOOTLOADER_FLASH_USER_DATA_SIZE 111 #define BOOTLOADER_FLASH_USER_DATA_SIZE (BOOTLOADER_FLASH_TOTAL_SIZE - BOOTLOADER_FLASH_USER_APPLICATION_SIZE - BOOTLOADER_FLASH_BOOTLOADER_SIZE) 115 #ifndef BOOTLOADER_FLASH_USER_DATA_END_ADDRESS 116 #define BOOTLOADER_FLASH_USER_DATA_END_ADDRESS (BOOTLOADER_FLASH_USER_DATA_START_ADDRESS + BOOTLOADER_FLASH_USER_DATA_SIZE) 120 #define BOOTLOADER_FLASH_END_ADDRESS (BOOTLOADER_FLASH_START_ADDRESS + BOOTLOADER_FLASH_TOTAL_SIZE) 123 #define BOOTLOADER_HASH_CODE_START_VALUE ((uint32_t)435258227) 126 #define BOOTLOADER_JUMP_SIGNATURE_STAY_IN_BOOTLOADER "__StayInBootLoader12345__" 129 #define BOOTLOADER_JUMP_SIGNATURE_STAY_IN_USER_APPLICATION "__StayInUserApplication__" 132 #define BOOTLOADER_JUMP_SIGNATURE_SIZE ((uint32_t)32) 135 #define BOOTLOADER_SIGNATURE_SIZE ((uint32_t)16) 138 #define BOOTLOADER_SIGNATURE_REQUIRED_WITHIN_BYTE_COUNT ((uint32_t)16384) 141 #define BOOTLOADER_SIGNATURE_FOUND_MARKER ((uint32_t)1) 144 #define BOOTLOADER_LOGICAL_PAGE_SIZE ((uint32_t)65536) 147 #define BOOTLOADER_HEADER_INITIAL_FILL_BYTE ((uint8_t)0xFE) 150 #define BOOTLOADER_HEADER_INITIAL_FILL_UINT_32 ((uint32_t)0xFEFEFEFE) 153 #define PORT_SEL_KEY_SYS_GPBR_3 0x09ea4f06 154 #define PORT_SEL_KEY_SYS_GPBR_4 0x13d6007e 155 #define PORT_SEL_KEY_SYS_GPBR_5 0x93f035fe 156 #define PORT_SEL_KEY_SYS_GPBR_6 0xd096ae0f 158 #define PORT_SEL_SER0 0 159 #define PORT_SEL_SER1 1 160 #define PORT_SEL_USB 2 180 #endif // __BOOTLOADER_SHARED_H__
uint32_t calculateBootloaderHashCode(uint32_t hashCode, const uint32_t *start, const uint32_t *end)
#define BOOTLOADER_JUMP_SIGNATURE_SIZE
USBInterfaceDescriptor data
#define BOOTLOADER_FLASH_BOOTLOADER_HEADER_SIZE