Skip to content

Commit

Permalink
linker: ensure all sections align to 4 bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
tridge committed Jul 27, 2024
1 parent 115709d commit c6b149e
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 6 deletions.
4 changes: 3 additions & 1 deletion Mcu/e230/GD32E230K8_FLASH.ld
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ _Min_Stack_Size = 0x400; /* required amount of stack */
MEMORY
{
FLASH (rx) : ORIGIN = 0x08001000, LENGTH = 27K
FLASH_VERSION (rx) : ORIGIN = 0x08007C00 - 48, LENGTH = 14
FLASH_VERSION (rx) : ORIGIN = 0x08007C00 - 48, LENGTH = 16
FILE_NAME (rx) : ORIGIN = 0x08007C00 - 32, LENGTH = 32
EEPROM (rx) : ORIGIN = 0x08007C00, LENGTH = 1K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 16K
Expand Down Expand Up @@ -88,13 +88,15 @@ SECTIONS
{
. = ALIGN(4);
KEEP (*(.firmware_info))
. = ALIGN(4);
} >FLASH_VERSION

/* The file name */
.file_name :
{
. = ALIGN(4);
KEEP (*(.file_name))
. = ALIGN(4);
} >FILE_NAME


Expand Down
4 changes: 3 additions & 1 deletion Mcu/f031/STM32F031C6TX_FLASH.ld
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ MEMORY
SRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 192
RAM (xrw) : ORIGIN = 0x200000C0, LENGTH = 4K - 192
FLASH_VECTAB (rx) : ORIGIN = 0x08001000, LENGTH = 192
FLASH_VERSION (rx) : ORIGIN = 0x080010C0, LENGTH = 14
FLASH_VERSION (rx) : ORIGIN = 0x080010C0, LENGTH = 16
FLASH (rx) : ORIGIN = ORIGIN(FLASH_VERSION) + LENGTH(FLASH_VERSION), LENGTH = 27K - 32 -(LENGTH(FLASH_VECTAB) + LENGTH(FLASH_VERSION))
FILE_NAME (rx) : ORIGIN = 0x08007C00 - 32, LENGTH = 32
EEPROM (rx) : ORIGIN = 0x080007C00, LENGTH = 1K
Expand All @@ -62,6 +62,7 @@ SECTIONS
{
. = ALIGN(4);
KEEP (*(.firmware_info))
. = ALIGN(4);
} >FLASH_VERSION


Expand Down Expand Up @@ -140,6 +141,7 @@ SECTIONS
{
. = ALIGN(4);
KEEP (*(.file_name))
. = ALIGN(4);
} >FILE_NAME

/* Used by the startup to initialize data */
Expand Down
4 changes: 3 additions & 1 deletion Mcu/f051/STM32F051K6TX_FLASH.ld
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ MEMORY
SRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 192
RAM (xrw) : ORIGIN = 0x200000C0, LENGTH = 8K - 192
FLASH_VECTAB (rx) : ORIGIN = 0x08001000, LENGTH = 192
FLASH_VERSION (rx) : ORIGIN = 0x080010C0, LENGTH = 14
FLASH_VERSION (rx) : ORIGIN = 0x080010C0, LENGTH = 16
FLASH (rx) : ORIGIN = ORIGIN(FLASH_VERSION) + LENGTH(FLASH_VERSION), LENGTH = 27K - 32 - (LENGTH(FLASH_VECTAB) + LENGTH(FLASH_VERSION))
FILE_NAME (rx) : ORIGIN = 0x08007C00 - 32, LENGTH = 32
EEPROM (rx) : ORIGIN = 0x08007C00, LENGTH = 1K
Expand All @@ -62,6 +62,7 @@ SECTIONS
{
. = ALIGN(4);
KEEP (*(.firmware_info))
. = ALIGN(4);
} >FLASH_VERSION

/* The program code and other data into "FLASH" Rom type memory */
Expand Down Expand Up @@ -136,6 +137,7 @@ SECTIONS
{
. = ALIGN(4);
KEEP (*(.file_name))
. = ALIGN(4);
} >FILE_NAME


Expand Down
4 changes: 3 additions & 1 deletion Mcu/f415/AT32F415x8_FLASH.ld
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ _Min_Stack_Size = 0x400; /* required amount of stack */
MEMORY
{
FLASH (rx) : ORIGIN = 0x08001000, LENGTH = 27K
FLASH_VERSION (rx) : ORIGIN = 0x08007C00 - 48, LENGTH = 14
FLASH_VERSION (rx) : ORIGIN = 0x08007C00 - 48, LENGTH = 16
FILE_NAME (rx) : ORIGIN = 0x08007C00 - 32, LENGTH = 32
EEPROM (rx) : ORIGIN = 0x08007C00, LENGTH = 1K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K
Expand Down Expand Up @@ -107,6 +107,7 @@ SECTIONS
{
. = ALIGN(4);
KEEP (*(.firmware_info))
. = ALIGN(4);
} >FLASH_VERSION


Expand All @@ -115,6 +116,7 @@ SECTIONS
{
. = ALIGN(4);
KEEP (*(.file_name))
. = ALIGN(4);
} >FILE_NAME

/* used by the startup to initialize data */
Expand Down
4 changes: 3 additions & 1 deletion Mcu/f421/AT32F421x6_FLASH.ld
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ _Min_Stack_Size = 0x400; /* required amount of stack */
MEMORY
{
FLASH (rx) : ORIGIN = 0x08001000, LENGTH = 27K
FLASH_VERSION (rx) : ORIGIN = 0x08007C00 - 48, LENGTH = 14
FLASH_VERSION (rx) : ORIGIN = 0x08007C00 - 48, LENGTH = 16
FILE_NAME (rx) : ORIGIN = 0x08007C00 - 32, LENGTH = 32
EEPROM (rx) : ORIGIN = 0x08007C00, LENGTH = 1K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 16K
Expand Down Expand Up @@ -107,13 +107,15 @@ SECTIONS
{
. = ALIGN(4);
KEEP (*(.firmware_info))
. = ALIGN(4);
} >FLASH_VERSION

/* The file name */
.file_name :
{
. = ALIGN(4);
KEEP (*(.file_name))
. = ALIGN(4);
} >FILE_NAME


Expand Down
4 changes: 3 additions & 1 deletion Mcu/g071/STM32G071GBUX_FLASH.ld
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 36K
FLASH_VECTAB (rx) : ORIGIN = 0x08001000, LENGTH = 192
FLASH_VERSION (rx) : ORIGIN = 0x080010C0, LENGTH = 14
FLASH_VERSION (rx) : ORIGIN = 0x080010C0, LENGTH = 16
FLASH (rx) : ORIGIN = ORIGIN(FLASH_VERSION) + LENGTH(FLASH_VERSION), LENGTH = 62K - 32 - (LENGTH(FLASH_VECTAB) + LENGTH(FLASH_VERSION))
FILE_NAME (rx) : ORIGIN = 0x0800F800 - 32, LENGTH = 32
EEPROM (rx) : ORIGIN = 0x0800F800, LENGTH = 2K
Expand All @@ -63,6 +63,7 @@ SECTIONS
{
. = ALIGN(4);
KEEP (*(.firmware_info))
. = ALIGN(4);
} >FLASH_VERSION

/* The program code and other data into "FLASH" Rom type memory */
Expand Down Expand Up @@ -139,6 +140,7 @@ SECTIONS
{
. = ALIGN(4);
KEEP (*(.file_name))
. = ALIGN(4);
} >FILE_NAME

/* Used by the startup to initialize data */
Expand Down

0 comments on commit c6b149e

Please sign in to comment.