UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
1,184 Views
Registered: ‎04-23-2018

how to use user defined sections from linker script in application code

Jump to solution

hi,

I generated a memory segment 'data_ddr0' using add memory option in linker script. I created  a section inside that as below

 

.lrr_data : {
. = ALIGN(64);
__lrr_data_start = .;


__lrr_data_end = .;
} > data_ddr0

 

 

i want to know how to create a section inside this so that i can use that section inside application code.

 

i want to define an array inside the section what we create as above ? what is syntax for using this section in c code?

 

Regards,

sarath

0 Kudos
1 Solution

Accepted Solutions
Contributor
Contributor
1,504 Views
Registered: ‎04-04-2018

Re: how to use user defined sections from linker script in application code

Jump to solution

> i want to define an array inside the section

 

E.g. - Put an array of char in your .llr_data section:

 

#define BUFSZ   0x1000 /* For example */

char __attribute__((__section__(".lrr_data"))) buf[BUFSZ];

 

The use 'buf' as you always would.

 

5 Replies
Contributor
Contributor
1,505 Views
Registered: ‎04-04-2018

Re: how to use user defined sections from linker script in application code

Jump to solution

> i want to define an array inside the section

 

E.g. - Put an array of char in your .llr_data section:

 

#define BUFSZ   0x1000 /* For example */

char __attribute__((__section__(".lrr_data"))) buf[BUFSZ];

 

The use 'buf' as you always would.

 

1,139 Views
Registered: ‎04-23-2018

Re: how to use user defined sections from linker script in application code

Jump to solution

thank you thanks a lot.

 

can you kindly tell me do i need to add anything inside below code, which i wrote inside linker file (.ld)?

 

.lrr_data : {
. = ALIGN(64);
__lrr_data_start = .;


__lrr_data_end = .;
} > LRR_data_ddr0

 

Regards,

sarath

 

 

0 Kudos
Contributor
Contributor
1,126 Views
Registered: ‎04-04-2018

Re: how to use user defined sections from linker script in application code

Jump to solution

 

> can you kindly tell me do i need to add anything

> inside below code, which i wrote inside linker file (.ld)?

 

Normally, yes. In your case you'll want to specify the input sections.

 

.lrr_data : {
    . = ALIGN(64);
    __lrr_data_start = .;
    *(.lrr_data)
    __lrr_data_end = .;
} > LRR_data_ddr0

All of the details can be found in the gnu ld docs.

 

 

Highlighted
1,103 Views
Registered: ‎04-23-2018

Re: how to use user defined sections from linker script in application code

Jump to solution

Thank you.

 

i had another issue now. Basically i am trying to put my buffers in different sections . i am getting some error like this .can you help me to resolve this? Error statement i am mentioning down.

 

Description Resource Path Location Type
relocation truncated to fit: R_AARCH64_ADR_PREL_PG_HI21 against symbol `peak' defined in .lrr_data section in ./src/src/main.o LRR_StandAloneCore3 line 0, external location: D:\NIDEC_LRR_2018\Working_Directory\vivado\LRR_StandAlone\sdkCore3\src\main.c:44 C/C++ Problem

 

 

Regards,

Sarath

0 Kudos
Contributor
Contributor
1,051 Views
Registered: ‎04-04-2018

Re: how to use user defined sections from linker script in application code

Jump to solution

I know the error/warning messages can be overly cryptic. And sometimes they appear almost completely useless to the rank and file, but you have to read them carefully & do your best to figure out what they are trying to tell you:

 

relocation truncated to fit: R_AARCH64_ADR_PREL_PG_HI21 against symbol `peak' defined in .lrr_data section in ./src/src/main.o LRR_StandAloneCore3 line 0, external location: D:\NIDEC_LRR_2018\Working_Directory\vivado\LRR_StandAlone\sdkCore3\src\main.c:44 C/C++

 

I would guess you have a symbol (table, array, etc.)  'peak' that is too big to fit into the .lrr_data section, so it was truncated.

 

It's probably time for you to dig into the ld manual -- there's a lot of really interesting and useful stuff in there.