AT91 - sprintf - Fehlermeldung.undefined reference to end

OP #680215
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
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
>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
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

Eine eigene Frage? Dieser Thread ist über 19 Jahre alt. Stell sie in einem eigenen Thread – dort lesen mehr Leute mit, und sie wird öfter und schneller beantwortet.

Neuen Thread starten

Eine Lösung, Ergänzung oder Rückmeldung zu diesem Thread? Dann antworte hier.

Formatierung
  • [c]C-Code[/c]
  • [code]Code in anderen Sprachen, ASCII-Zeichnungen[/code]
  • [math]Formel in LaTeX-Syntax[/math]
  • [[Titel]] – Link zu einem Artikel
  • Verweis auf einen anderen Beitrag: Rechtsklick auf dessen Beitrags-ID (#8078628), „Adresse kopieren“, in den Text einfügen

Mehr zur Formatierung

Längeren Sourcecode als Anhang, nicht in den Text. JPG nur für Fotos und Scans; Zeichnungen und Screenshots als PNG oder GIF. Siehe Bildformate.

Schon registriert? Anmelden

Wird nicht angezeigt. Wir schicken dir einen Link; sobald du damit bestätigst, erscheint dein Beitrag.

Mit dem Abschicken legst du einen kostenlosen Account an und erkennst die Nutzungsbedingungen und die Datenschutzerklärung an.