Skip to content

Instantly share code, notes, and snippets.

@csrohit
Last active December 2, 2022 13:24
Show Gist options
  • Save csrohit/b5971965cb9e7909b8ff0de6dcd24e68 to your computer and use it in GitHub Desktop.
Save csrohit/b5971965cb9e7909b8ff0de6dcd24e68 to your computer and use it in GitHub Desktop.
Supporting code for article on linker script
/* continued */
.bss :
{
_sbss = .;
__bss_start__ = _sbss;
*(.bss)
*(.bss.*)
. = ALIGN(4);
_ebss = .;
__bss_end__ = _ebss;
. = ALIGN(4);
end = .;
__end__ = .;
}> SRAM
}
/* END */
/* continued */
_la_data = LOADADDR(.data);
.data :
{
_sdata = .;
*(.data)
*(.data.*)
. = ALIGN(4);
_edata = .;
}> SRAM AT> FLASH
/* continued */
ENTRY(Reset_Handler)
.
.
.
SECTIONS
{
.isr_vector :
{
KEEP(*(.isr_vector));
. = ALIGN(4);
}> FLASH
/* continued */
MEMORY
{
rom (rx) : ORIGIN = 0, LENGTH = 256K
ram (!rx) : org = 0x40000000, l = 4M
}
SECTIONS
{
. = 0x10000;
.text : { *(.text) }
. = 0x8000000;
.data : { *(.data) }
.bss : { *(.bss) }
}
MEMORY
{
FLASH(rx):ORIGIN =0x08000000,LENGTH =64K
SRAM(rwx):ORIGIN =0x20000000,LENGTH =20K
}
floating_point = 0;
SECTIONS
{
.text :
{
*(.text)
_etext = .;
}
_bdata = (. + 3) & ~ 3;
.data : { *(.data) }
}
/* continued */
.text :
{
*(.text)
*(.text.*)
*(.rodata)
*(.rodata.*)
. = ALIGN(4);
_etext = .;
}> FLASH
/* continued */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment