Running a section of code from internal memory
Hi All,
I am porting a GW/router application to embedded Linux for a product based on SoC; following is the version information:
kernel: 2.6.10
uClibc: 0.9.27
gcc: 3.4.3
binutils: 2.15.94.0.2.2
A small part of the code needs to run from the on-chip "L2 scratch" for getting optimum performance. I would really appreciate if some could give me some pointers regarding the following questions:
1. Is #pragma section supported by gcc.
The compiler prints this warning "ignoring #pragma section" and the pragma is ignored indicating that it is not supported. Is there any way I can get the pragma working for gcc or any alternative?
2. Is there any patch available to modify the kernel thread creation so as to place the stack and tcb in the user configured addresses for kernel threads (similar to taskInit() in VxWorks)?
Thanks in advance,
Sanal
Sanal Kumar V K ha scritto:
Quoted 23 lines
Hi All,
I am porting a GW/router application to embedded Linux for a product based on SoC; following is the version information:
kernel: 2.6.10
uClibc: 0.9.27
gcc: 3.4.3
binutils: 2.15.94.0.2.2A small part of the code needs to run from the on-chip "L2 scratch" for getting optimum performance. I would really appreciate if some could give me some pointers regarding the following questions:
1. Is #pragma section supported by gcc.
The compiler prints this warning "ignoring #pragma section" and the pragma is ignored indicating that it is not supported. Is there any way I can get the pragma working for gcc or any alternative?2. Is there any patch available to modify the kernel thread creation so as to place the stack and tcb in the user configured addresses for kernel threads (similar to
taskInit()in VxWorks)?
Quoted 9 lines
Thanks in advance,
Sanal_______________________________________________
Linuxppc-embedded mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-embedded
I think at application level you can use the #pragma directive but I'm sure that you can't use this directive at kernel level.
Quoted 8 lines · Sanal Kumar V K
A small part of the code needs to run from the on-chip "L2 scratch" for getting optimum performance. I would really appreciate if some could give me some pointers regarding the following questions:
1. Is #pragma section supported by gcc.
The compiler prints this warning "ignoring #pragma section" and the pragma is ignored indicating that it is not supported. Is there any way I can get the pragma working for gcc or any alternative?
__attribute__((section("section name")))
-Scott
Thanks a lot Scott for replying.
The attribute section is working, but one problem: the compiler is automatically assigning address for the section and ld returns error is I try to assign the address for this section in a linker script:
Following is the disassembly when I don't specify an address for the same section name in the linker script:
Disassembly of section .l2_scratch:
004ae820 <.l2_scratch>:
4ae820: 3c1c0fb9 lui gp,0xfb9 4ae824: 279c1d90 addiu gp,gp,7568 4ae828: 0399e021 addu gp,gp,t9 4ae82c: 27bdffd0 addiu sp,sp,-48 4ae830: afbf0028 sw ra,40(sp) 4ae834: afbe0024 sw s8,36(sp) 4ae838: ---------- ---- ---------
And the section shows:
Idx Name Size VMA LMA File off Algn
0 .reginfo 00000018 00400094 00400094 00000094 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA, LINK_ONCE_SAME_SIZE 1 .init 00000088 004000ac 004000ac 000000ac 2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .text 000ae6e0 00400140 00400140 00000140 2**4 CONTENTS, ALLOC, LOAD, READONLY, CODE
3 .l2_scratch 000004f0 004ae820 004ae820 000ae820 2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE
4 ----- --------------------------------------------------------
Now if I make the following entry in the linker script, /* define L2 scratch here */
. = 0x9FC16800;
.l2_scratch : { *(.l2_scratch) }
it says "collect2: ld returned 1 exit status".
Is there any way I can assign address for the section used in attribute?
Thanks and regards,
Sanal
Scott Wood wrote: On Thu, May 08, 2008 at 05:06:46PM +0530, Sanal Kumar V K wrote: A small part of the code needs to run from the on-chip "L2 scratch" for getting optimum performance. I would really appreciate if some could give me some pointers regarding the following questions: 1. Is #pragma section supported by gcc. The compiler prints this warning "ignoring #pragma section" and the pragma is ignored indicating that it is not supported. Is there any way I can get the pragma working for gcc or any alternative?
Quoted 6 lines · Sanal Kumar V K
Now if I make the following entry in the linker script,
/* define L2 scratch here */
. =0x9FC16800;
.l2_scratch : { *(.l2_scratch) }it says "collect2: ld returned 1 exit status".
I'm guessing there was an earlier error message printed by ld?
You probably located the L2 section too far away from the main section, and it's trying to do short branches or other limited relocations.
-Scott