How to enable SEGGER Linker in your Embedded Studio project

From SEGGER Wiki
Revision as of 12:38, 6 August 2020 by Nino (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This article will explain how the SEGGER Linker can be enabled in a Embedded Studio project.

Prerequisites

This article assumes that SEGGER Embedded Studio V5.10 or later is used. For older SEGGER Linker versions some options might be different.

How to

Generally when creating a new project with the Embedded Studio project wizard the resulting project will have the SEGGER Linker set as default. But if you want to move your project from GNU Linker to SEGGER Linker or just want to make sure that all settings are correctly set up the following steps are necessary.

  • Open project settings
  • Set the project option Linker to SEGGER.
  • As project option Linker Script File select a linker script for your project.
    • Default for Cortex-M Flash builds: $(StudioDir)/samples/SEGGER_Flash.icf
    • Default for Cortex-M RAM builds: $(StudioDir)/samples/SEGGER_RAM.icf
    • Default for Cortex-A Flash builds: $(StudioDir)/samples/SEGGER_Flash_ARM.icf
    • Default for Cortex-A RAM builds: $(StudioDir)/samples/SEGGER_RAM_ARM.icf
  • Set the project option Supply Memory Segments To Linker to Yes.
    • This option makes the memory segments from Memory Map File or Memory Segments available in the linker script file.
  • Set the project option Exclude From Build on the thumb_crt0.s file in your project (if GNU linker project was used).
  • Add the runtime init startup code to your project.
    • For Cortex-M targets that is: $(StudioDir)/samples/SEGGER_THUMB_Startup.s
    • For Cortex-A targets that is: $(StudioDir)/samples/SEGGER_ARM_Startup.s

Now your project is set to use SEGGER Linker. For more information about the usage of the SEGGER Linker see the user manual UM20005_Linker.

Additional project options

There are some additional SEGGER Linker project options that are explained here in more detail. The options in question are marked with a [segger-ld] tag in the project settings menu.

  • Generate Log File: Enables or disables the creation of a SEGGER Linker log file. The log file will be saved in the output folder as <ProjectName.log>
  • Supply Memory Segments To Linker: This specifies if Memory Segment names are provided externally or within the linker script itself.
  • Map File Format: Sets the format of the .map file created during the linking process. Supported formats are text or html.