Build Nut/OS application httpd `.ramfunc' error

OP #1174571
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
OP
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?
Moderator
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)
OP
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*)
Guest
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.
Moderator
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.

Reply

A question of your own? This thread is over 17 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.