AT91 - sprintf - Fehlermeldung.undefined reference to end

OP #680215
Lesenswert?

Hallo,

ich u.a. diese drei Zeilen in meiner main:

char buffer[128];
sprintf (buffer,"Test Nr. %d", 1);
ks0108_textframe(buffer,&font5x7para,&textboxpara);

sobald ich diesen sprintf Befehl nutzen möchte bekomme ich folgende 
Fehlermeldung von meinem GCC Compiler:


GNU ld version 2.17
libc.a(syscalls.o): In function `_sbrk':
../../../../../../newlib-1.14.0/newlib/libc/sys/arm/syscalls.c:500: 
undefined reference to `end'

Hat jemand einen Tip?


Gruß


Tobias
OP #680239
Lesenswert?

Dort habe ich mich schonmal gemeldet, da ich nict so ganz verstehe wo 
ich genau in meiner makefile dieser Zusatz "end" hinsetzen soll:

Im Linkerscript muss ein "end" bereitgestellt werden, welche die
Startaddresse des Heaps festlegt (sbrk ist die "Verbindung" der libc zum
Heap-Speicher. Üblicherweise durch eine Zeile PROVIDE (end = .); je nach
Memory-Layout nach der Linker-Section für .bss oder die stacks.

Habe mal meine makefile angehängt.
Für Tips bin ich sehr dankbar.

Gruß

Tobi
Angehängte Dateien:
Gast #680279
Lesenswert?

>da ich nict so ganz verstehe wo
>ich genau in meiner makefile dieser Zusatz "end" hinsetzen soll:

Vom makefile ist ja auch nirgends die Rede !
Siehe unten.

>>Im Linkerscript muss ein "end" bereitgestellt werden,
     ^^^^^^^^^^^^

>in welcher include-Datei ist eigentlich sprintf deklariert?

Handbuch oder Dkumentation lesen, oder stdio ?
OP #682131
Lesenswert?

Also,


ich habe ein end am Ende meines Linker Scripts:

/* now define the output sections  */
SECTIONS
{
  . = 0;         /* set location counter to address zero  */

  .text : /* collect all sections that should go into FLASH after 
startup  */
  {
    *(.text)        /* all .text sections (code)  */
    *(.rodata)      /* all .rodata sections (constants, strings, etc.) 
*/
    *(.rodata*)     /* all .rodata* sections (constants, strings, etc.) 
*/
    *(.glue_7)      /* all .glue_7 sections  (no idea what these are) */
    *(.glue_7t)     /* all .glue_7t sections (no idea what these are) */
    _etext = .;     /* define a global symbol _etext just after the last 
code byte */
  } >flash          /* put all the above into FLASH */

  .data :           /* collect all initialized .data sections that go 
into RAM  */
  {
    _data = .;     /* create a global symbol marking the start of the 
.data section  */
    *(.data)       /* all .data sections  */
    _edata = .;    /* define a global symbol marking the end of the 
.data section  */
  } >ram AT >flash  /* put all the above into RAM (but load the LMA 
initializer copy into FLASH)  */

  .bss :            /* collect all uninitialized .bss sections that go 
into RAM  */
  {
    _bss_start = .; /* define a global symbol marking the start of the 
.bss section */
    *(.bss)          /* all .bss sections  */
  } >ram            /* put all the above in RAM (it will be cleared in 
the startup code */

  . = ALIGN(4);     /* advance location counter to the next 32-bit 
boundary */
  _bss_end = . ;    /* define a global symbol marking the end of the 
.bss section */
}
  _end = .;         /* define a global symbol marking the end of 
application RAM */

In meiner makefile sieht die passende Zeile dazu so aus:

main.out: $(OBJECTS) lcd.cmd
  @ echo "..linking"
  $(LD) $(LFLAGS) -o main.out $(OBJECTS) libc.a libm.a libgcc.a

wobei $LFFLAGS für

LFLAGS  =  -Map main.map -Tlcd.cmd

steht und $LD für

LD      = arm-elf-ld -v




Nun stehe ich am Anfang und weiß nicht ganz so weiter, jemand eine Idee?

Gruß

Tobias

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren