EmbDev.net

Forum: ARM programming with GCC/GNU tools Build Nut/OS application httpd `.ramfunc' error


von C k L. (bcck)


Rate this post
useful
not useful
Can anyone know how to fix the error?

Hi there,

I tried to build Nut/OS application httpd with Yagarto and got the build
error below. Does anyone know how to fix it?

Thanks.

**** Build of configuration Default for project httpd ****

make all
arm-elf-gcc -c -mcpu=arm7tdmi -O0 -gdwarf-2 -mthumb-interwork
-fomit-frame-pointer -Wall -Wstrict-prototypes -fverbose-asm
-Wa,-ahlms=src/httpserv.lst -DETHERNUT3   -MD -MP -MF .dep/httpserv.o.d
-I . -ID:/Project/ethernut-4.6.4/nutbld-arm-gccdbg/include
-ID:/Project/ethernut-4.6.4/nut/include -I./inc src/httpserv.c -o
src/httpserv.o
arm-elf-gcc -c -mcpu=arm7tdmi -O0 -gdwarf-2 -mthumb-interwork
-fomit-frame-pointer -Wall -Wstrict-prototypes -fverbose-asm
-Wa,-ahlms=src/urom.lst -DETHERNUT3   -MD -MP -MF .dep/urom.o.d -I .
-ID:/Project/ethernut-4.6.4/nutbld-arm-gccdbg/include
-ID:/Project/ethernut-4.6.4/nut/include -I./inc src/urom.c -o src/urom.o
arm-elf-gcc  ./src/httpserv.o ./src/urom.o -mcpu=arm7tdmi -nostartfiles
-TD:/Project/ethernut-4.6.4/nut/arch/arm/ldscripts/at91_ram.ld
-Wl,-Map=httpserv.map,--cref,--no-warn-mismatch
-LD:/Project/ethernut-4.6.4/nutbld-arm-gccdbg/lib
D:/Project/ethernut-4.6.4/nutbld-arm-gccdbg/lib/nutinit.o
-Wl,--start-group -lnutpro -lnutos -lnutarch -lnutdev -lnutnet -lnutfs
-lnutcrt -Wl,--end-group  -o httpserv.elf
c:/program
files/yagarto/bin/../lib/gcc/arm-elf/4.3.2/../../../../arm-elf/bin/ld.ex 
e:
error: no memory region specified for loadable section `.ramfunc'
collect2: ld returned 1 exit status
make: *** [httpserv.elf] Error 1

von Martin T. (mthomas) (Moderator)


Rate this post
useful
not useful
C K Lui wrote:
> error: no memory region specified for loadable section `.ramfunc'
Are there entries for .ramfunc c-sections in the linker-script?

von C k L. (bcck)


Rate this post
useful
not useful
Martin Thomas wrote:
> C K Lui wrote:
>> error: no memory region specified for loadable section `.ramfunc'
> Are there entries for .ramfunc c-sections in the linker-script?

I cannot find any .ramfunc in the linker-script. How do I add it into
the script?

von Martin T. (mthomas) (Moderator)


Rate this post
useful
not useful
C K Lui wrote:
> Martin Thomas wrote:
>> C K Lui wrote:
>>> error: no memory region specified for loadable section `.ramfunc'
>> Are there entries for .ramfunc c-sections in the linker-script?
>
> I cannot find any .ramfunc in the linker-script. How do I add it into
> the script?

Add a line *(.ramfunc*) near *(.data)

von C k L. (bcck)


Rate this post
useful
not useful
Martin Thomas wrote:
> C K Lui wrote:
>> Martin Thomas wrote:
>>> C K Lui wrote:
>>>> error: no memory region specified for loadable section `.ramfunc'
>>> Are there entries for .ramfunc c-sections in the linker-script?
>>
>> I cannot find any .ramfunc in the linker-script. How do I add it into
>> the script?
>
> Add a line *(.ramfunc*) near *(.data)

I made the change as below and the linker works. Thanks.

  .data :
  {
    PROVIDE (__data_start = .);
    *(.data)
  *(.data.*)
    *(.gnu.linkonce.d*)
  SORT(CONSTRUCTORS) /* this entry is in the Anglia example */
    /* CONSTRUCTORS */ /* this entry is in the devkitarm script but not
in the Anglia example */
    . = ALIGN(4);
  *(.ramfunc*)

von snip (Guest)


Rate this post
useful
not useful
looks like you are adding the ramfunc to data!
You should create a separate section for it and locate it in the RAM, 
otherwise there is no point in using that attribute.

Also, you placed it before the .ALIGN part. This means that your data 
section is no longer aligned on a 32bit boundary. This can be dangerous. 
At least add a ". = ALIGN(4);" afterwards as well.

von Martin T. (mthomas) (Moderator)


Rate this post
useful
not useful
snip wrote:

Please note that this thread is rather old and somehow closed by the OP 
with "works".

> looks like you are adding the ramfunc to data!

You seem to confuse input-section(s) for data and the output-section 
data.

> You should create a separate section for it and locate it in the RAM,

The output-section .data gets located in RAM (there is not much sense in 
locating data in a RO-memory).

This method saves an additional copy-loop since the initial values of 
the data-input-sections get copied anyway in the startup. The 
machine-code of the RAM-functions can be copied in the same loop from 
the non-volatile memory into RAM.

> otherwise there is no point in using that attribute.

So far it's a little difficult to find the point in the remark.

> Also, you placed it before the .ALIGN part.

In the above code-snippet the line for ramfunc input-section(s) is after 
the align-instruction.

> This means that your data
> section is no longer aligned on a 32bit boundary. This can be dangerous.
> At least add a ". = ALIGN(4);" afterwards as well.

Yes, alignment can be critical but the linker and compiler "know" some 
restictions (AFAIK, I have done just a few tests). Since the lines above 
do not show a complete linker-script it's impossible to tell if an 
alignment instruction follows. Maybe it's in the next line not shown or 
maybe the defintion of output-section .bss with an extra aligment 
follows.

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.