diff --git a/records/board/stm32h743xx_udb_bl.yaml b/records/board/stm32h743xx_udb_bl.yaml index c7f0f29d29..f52bc312be 100644 --- a/records/board/stm32h743xx_udb_bl.yaml +++ b/records/board/stm32h743xx_udb_bl.yaml @@ -1,4 +1,6 @@ common: + macros: + - UDB includes: - source/board/udb/include/udb_version.h sources: diff --git a/source/board/udb/include/udb.ld b/source/board/udb/include/udb.ld index d2940bad8a..0ce26ccdff 100644 --- a/source/board/udb/include/udb.ld +++ b/source/board/udb/include/udb.ld @@ -2,20 +2,20 @@ MEMORY { - m_cfgrom_bl (RW) : ORIGIN = DAPLINK_ROM_CONFIG_ADMIN_START, LENGTH = DAPLINK_ROM_CONFIG_ADMIN_SIZE + m_udb_bl_version_rom (RW) : ORIGIN = DAPLINK_ROM_UDB_BL_VERSION_START, LENGTH = DAPLINK_ROM_UDB_BL_VERSION_SIZE } SECTIONS { - .cfgrom_bl : + .udb_bl_version_rom : { - KEEP(*(cfgrom_bl)) + KEEP(*(udb_bl_version_rom)) FILL(0xffffffff) - . = ORIGIN(m_cfgrom_bl) + LENGTH(m_cfgrom_bl) - 4; + . = ORIGIN(m_udb_bl_version_rom) + LENGTH(m_udb_bl_version_rom) - 4; /* Need some contents in this section or it won't be copied to bin or hex. The CRC will * be placed here by post_build_script.py. */ LONG(0x55555555) - } > m_cfgrom_bl + } > m_udb_bl_version_rom } #include "stm32h743xx.ld" diff --git a/source/board/udb/source/udb_version.c b/source/board/udb/source/udb_version.c index 398f7e2e92..413ba66b00 100644 --- a/source/board/udb/source/udb_version.c +++ b/source/board/udb/source/udb_version.c @@ -31,7 +31,7 @@ #endif // defined(UDB_VERSION_BASE) && defined(UDB_BUILD_NUMBER) #define UDB_BOOTLOADER_VERSION UDB_BUILD_VERSION -#define UDB_BOOTLOADER_VERSION_SECTION_ADDR DAPLINK_ROM_CONFIG_ADMIN_START +#define UDB_BOOTLOADER_VERSION_SECTION_ADDR DAPLINK_ROM_UDB_BL_VERSION_START #define BOOTLOADER_CFG_MAGIC_KEY (0x5a5a5a5a) #define BOOTLOADER_MAX_VERSION_LENGTH UDB_VERSION_MAX_LENGTH @@ -63,7 +63,7 @@ COMPILER_ASSERT(sizeof(UDB_BOOTLOADER_VERSION) < BOOTLOADER_MAX_VERSION_LENGTH); COMPILER_ASSERT(sizeof(bootloader_version_t) < DAPLINK_SECTOR_SIZE); #ifdef DAPLINK_BL -static volatile bootloader_version_t config_rom_bl __attribute__((section("cfgrom_bl"))) = +static volatile bootloader_version_t udb_bl_version __attribute__((section("udb_bl_version_rom"))) = { .magic_key = BOOTLOADER_CFG_MAGIC_KEY, .version = UDB_BOOTLOADER_VERSION, diff --git a/source/hic_hal/stm32/stm32h743xx/daplink_addr.h b/source/hic_hal/stm32/stm32h743xx/daplink_addr.h index 78753bd85a..f414e6d6d0 100644 --- a/source/hic_hal/stm32/stm32h743xx/daplink_addr.h +++ b/source/hic_hal/stm32/stm32h743xx/daplink_addr.h @@ -24,8 +24,6 @@ /* Device sizes */ -#define DAPLINK_ROM_START 0x08000000 -#define DAPLINK_ROM_SIZE 0x000A0000 // has to be a multiple of the sector size, only bank 1 is used, the datasheet says under table 7 in the notes section that the memory boundary is limited to this on each bank #define DAPLINK_STM32H743_DTCM_START 0x20000000 #define DAPLINK_STM32H743_DTCM_SIZE 0x00020000 @@ -45,17 +43,30 @@ /* ROM sizes */ +#define DAPLINK_ROM_START 0x08000000 #define DAPLINK_ROM_BL_START 0x08000000 #define DAPLINK_ROM_BL_SIZE 0x00020000 // 128 kB bootloader -- 1 sector -#define DAPLINK_ROM_CONFIG_ADMIN_START 0x08020000 -#define DAPLINK_ROM_CONFIG_ADMIN_SIZE 0x00020000 // 1 sector +#ifdef UDB +#define DAPLINK_ROM_SIZE 0x000A0000 // has to be a multiple of the sector size, only bank 1 is used + +#define DAPLINK_ROM_UDB_BL_VERSION_START 0x08020000 +#define DAPLINK_ROM_UDB_BL_VERSION_SIZE 0x00020000 // 1 sector to keep everything else sector aligned #define DAPLINK_ROM_IF_START 0x08040000 #define DAPLINK_ROM_IF_SIZE 0x00040000 // 2 sectors #define DAPLINK_ROM_CONFIG_USER_START 0x08080000 #define DAPLINK_ROM_CONFIG_USER_SIZE 0x00020000 // 1 sector +#else +#define DAPLINK_ROM_SIZE 0x00080000 // has to be a multiple of the sector size, only bank 1 is used + +#define DAPLINK_ROM_IF_START 0x08020000 +#define DAPLINK_ROM_IF_SIZE 0x00040000 // 2 sectors + +#define DAPLINK_ROM_CONFIG_USER_START 0x08060000 +#define DAPLINK_ROM_CONFIG_USER_SIZE 0x00020000 // 1 sector +#endif /* RAM sizes */ @@ -79,7 +90,7 @@ #define DAPLINK_ROM_APP_START DAPLINK_ROM_IF_START #define DAPLINK_ROM_APP_SIZE DAPLINK_ROM_IF_SIZE #define DAPLINK_ROM_UPDATE_START DAPLINK_ROM_BL_START -#define DAPLINK_ROM_UPDATE_SIZE (DAPLINK_ROM_BL_SIZE + DAPLINK_ROM_CONFIG_ADMIN_SIZE) +#define DAPLINK_ROM_UPDATE_SIZE (DAPLINK_ROM_BL_SIZE + DAPLINK_ROM_UDB_BL_VERSION_SIZE) #else