This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Linker file in gcc/eclipse how to find RAM size for new project

Hi i want to create a new project in Eclipse. I did this my following the complete code form git hub for devzone.nordicsemi.com/.../

*Nordic has provided sample code for this tutorial using SDK 13 in post as zip file but it is only for Keil not for gcc. It is missing Makefile and linker file.

I am not sure how i can create these files. For Makefile i have managed by looking in other projects.

But the linker file seems very hard and i do not know how to do it. As this is a new project which will have code taken from other multiple projects like uart, twi, timmers, blink etc.

How should i define: MEMORY and SECTIONS?

Also what is this SECTIONS for? Memory is for rom and ram. What does SECTIONS do?

MEMORY
{
  FLASH (rx) : ORIGIN = 0x1c000, LENGTH = 0x1A000
  RAM (rwx) :  ORIGIN = 0x20001FE8, LENGTH = 0x6018

  /** Location in UICR where bootloader start address is stored. */
  UICR_BOOTLOADER (r) : ORIGIN = 0x10001014, LENGTH = 0x04
}

SECTIONS
{
  /* Write the bootloader address in UICR. */
  .uicrBootStartAddress : 
  {
    KEEP(*(.uicrBootStartAddress))
  } > UICR_BOOTLOADER

  .fs_data :
  {
    . = ALIGN(4);
    PROVIDE(__start_fs_data = .);
    KEEP(*(.fs_data))
    PROVIDE(__stop_fs_data = .);
  } > RAM  
}
Related