Tool/software: Code Composer Studio
Hey all,
I am trying to figure out the best way that I can reference in code the start address and length of a memory section defined in the linker file.
I have found a way to do this, but it seems a little hacky and I was wondering if there is a cleaner way to do it.
As an example, I would have the following in my linker file:
#define TEST_ADDRESS_LOC 0x15000
#define TEST_ADDRESS_LEN 0x1000
TEST_ADDRESS = TEST_ADDRESS_LOC;
MEMORY
{
TEST_SECTION: origin = TEST_ADDRESS_LOC, length = TEST_ADDRESS_LEN
}
SECTIONS
{
.testSection : {} > TEST_SECTION type=NOINIT
}
and then in code I would define
extern volatile unsigned long TEST_ADDRESS;
and use TEST_ADDRESS as my origin pointer (very similar to how the compiler maps the register addresses).
While this gets the job done, is there a cleaner way to do this where I don't have to use the variables (where i can just access the sections start address and length without having to define it in two places in the linker file), or is there a way I can assign the value of TEST_ADDRESS to the origin of TEST_SECTION?