Mar 01, 2016
02:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mar 01, 2016
02:18 AM
Hello,
how can I tell the compiler / linker that a variable (here int16_t iAverageValues [16]) is always at the same address? I need it for the XCP-Protocol. I don't want to update the addressmapping after building a new softwareversion.
I've tried following thinks, but with no success:
int16_t iAverageValues [16] __attribute__((at(0x2000FFC0)));
or
int16_t iAverageValues [16] __attribute__ ((section (XCP_DATA)));
an modify the linker script with something like this
XCP_Data(!RX) : ORIGIN = 0x200FFC0, LENGTH = 0x20
Thanks
Markus
how can I tell the compiler / linker that a variable (here int16_t iAverageValues [16]) is always at the same address? I need it for the XCP-Protocol. I don't want to update the addressmapping after building a new softwareversion.
I've tried following thinks, but with no success:
int16_t iAverageValues [16] __attribute__((at(0x2000FFC0)));
or
int16_t iAverageValues [16] __attribute__ ((section (XCP_DATA)));
an modify the linker script with something like this
XCP_Data(!RX) : ORIGIN = 0x200FFC0, LENGTH = 0x20
Thanks
Markus
- Tags:
- IFX
2 Replies
Mar 01, 2016
11:04 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mar 01, 2016
11:04 PM
Hello Markus,
From the linker script file, the address 0x2000FFC0 is reserved:
In any case, it should be possible to define a dedicated data section on the available DSRAM area.
For example, I added the following "my_data" section before the "bss" section in the linker script file:
And I added the "attribute" keyword accordingly to the variable in the main.c file,
This appears to work fine.
Regards,
Min Wei
From the linker script file, the address 0x2000FFC0 is reserved:
/* .no_init section */
.no_init 0x2000FFC0 (NOLOAD) :
{
Heap_Bank1_End = .;
* (.no_init);
} > DSRAM_1_system
In any case, it should be possible to define a dedicated data section on the available DSRAM area.
For example, I added the following "my_data" section before the "bss" section in the linker script file:
/* Dedicated data section */
.my_data 0x20000100 :
{
KEEP(*(.my_data))
} > DSRAM_1_system
And I added the "attribute" keyword accordingly to the variable in the main.c file,
int16_t iAverageValues[16] __attribute__ ((section (".my_data")));
This appears to work fine.
Regards,
Min Wei
Jul 06, 2017
02:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 06, 2017
02:33 AM
Hello Min Wei,
I have tested your suggestion and it works as far as I am in debug mode. If I switch to Release it doesn’t work any more. I found out the reason: Debug Setting -> Optimization Level: None, Release Setting -> Optimization Level: Optimize for size. If I change this in Release mode it works well again. But I have bigger code-size. I thought the KEEP instruction in the linker script would prevent this? Or am I doing something wrong?
Regards, Dirk
I have tested your suggestion and it works as far as I am in debug mode. If I switch to Release it doesn’t work any more. I found out the reason: Debug Setting -> Optimization Level: None, Release Setting -> Optimization Level: Optimize for size. If I change this in Release mode it works well again. But I have bigger code-size. I thought the KEEP instruction in the linker script would prevent this? Or am I doing something wrong?
Regards, Dirk