Understanding the Linker Script in PSoC Creator Cypress Dock Project

Thread Starter

srihariraom

Joined Sep 27, 2021
14
Hi,

I am trying to understand the Linker Script in PSoC Creator for a Project. I am referring <Mod:link deleted.E> project. In this project, a custom linker script is used. I am confused by the reference made in the linker script.

Code:
MEMORY
{
    rom (rx) : ORIGIN = 0x0, LENGTH = `$CYDEV_FLS_SIZE`
    ram (rwx) : ORIGIN = 0x20000000, LENGTH = `$SRAM_BYTES`
}
From above we can see that ROM and RAM memories are set. I tried searching for `$CYDEV_FLS_SIZE` and `$SRAM_BYTES`. But I didn't find a single reference for these. Where do these values come from? Is this a standard way of defining something? Even in standard linker scripts out on the internet, I haven't seen anything referred to like this. Please shed some light on this. I want to know where these values are coming from and my end goal is to be able to modify them.

Regards,
Srihari Rao M
 
Last edited by a moderator:

Papabravo

Joined Feb 24, 2006
21,159
It is not uncommon for a linker to define symbolic values which may not have a statically defined value. This value is determined when the modules are loaded and is determined by the actual modules that are included in the link, and the total length of the statically allocated data from the linked modules.
 

Thread Starter

srihariraom

Joined Sep 27, 2021
14
Hi @Papabravo,

What kind of linked modules can it be? Be it any module it should somehow be fed to the linker script right? I have searched each and every file in the project but there is no such symbol name or variable. Do you mean it can happen internally without even being present on some file and it is directly passed to gcc as some argument?

Regards,
Srihari Rao M
 

Papabravo

Joined Feb 24, 2006
21,159
Hi @Papabravo,

What kind of linked modules can it be? Be it any module it should somehow be fed to the linker script right? I have searched each and every file in the project but there is no such symbol name or variable. Do you mean it can happen internally without even being present on some file and it is directly passed to gcc as some argument?

Regards,
Srihari Rao M
Yes, that is exactly what I mean. Think of it as a useful symbol definition that the linker is passing to the Loader. The loader is a program that will load your executable into memory, set the boundaries so that it knows what memory is left over for the STACK and the HEAP. None of the individual source files will have this knowledge -- how could they?
 
Last edited:
Top