MICO32 UART printf mit variable geht nicht

Gast #2615444
Lesenswert?
• ▲
▼
Hallo

Ich versuche gerade in MSB die UART zum laufen zu bekommen  mein 
Programm:

#include<stdio.h>
#include <stddef.h>
#include "MicoUtils.h"
#include "system_conf.h"

int main(){

printf ("test1");
printf("test2 %d\n", 5);

return 0;


Wenn ich die zweite printf Anweisung auskomentiere funktioniert alles 
tip top sonst bekomm ich die Fehlermeldung:

make:***[Hallo.elf]Error1 line 0.

Hilfe wo liegt der Fehler, was mach ich falsch.
Gast #2615471
Lesenswert?
• ▲
▼
**** Build of configuration Debug for project Hello ****

make -k all

make[1]: Entering directory 
`/cygdrive/d/PROJECTS/lattice_developmend_board/cplusplus/Hello/Speed_GP 
X/Debug'
make[1]: Leaving directory 
`/cygdrive/d/PROJECTS/lattice_developmend_board/cplusplus/Hello/Speed_GP 
X/Debug'
lm32-elf-g++ -c -D__LM32_DEBUG_ROM_ENABLED__ -mmultiply-enabled 
-mbarrel-shift-enabled -mdivide-enabled -msign-extend-enabled 
-ffunction-sections -O0 -g2 -w -D_USE_LSCC_PRINTF_ -D__lm32__ 
-I./../Speed_GPX ../hello_world.c -o Debug/../hello_world.o
echo -n Debug/../ > Debug/../hello_world.d && \
  lm32-elf-g++ -D__LM32_DEBUG_ROM_ENABLED__ -mmultiply-enabled 
-mbarrel-shift-enabled -mdivide-enabled -msign-extend-enabled 
-ffunction-sections -O0 -g2 -w -D_USE_LSCC_PRINTF_ -D__lm32__ 
-I./../Speed_GPX -MM -MG -P -w ../hello_world.c >> 
Debug/../hello_world.d
building application...
lm32-elf-gcc -D__LM32_DEBUG_ROM_ENABLED__ -mmultiply-enabled 
-mbarrel-shift-enabled -mdivide-enabled -msign-extend-enabled  -T 
../Speed_GPX/Debug/linker.ld -oHello.elf Debug/../hello_world.o 
Debug/crt0ram.o  -lstdc++  ./Debug/libSpeed_GPX.a -lm -lc -lgcc 
./Debug/libSpeed_GPX.a -lnosys -Wl,--gc-sections
/cygdrive/X/diamond/1.4/micosystem/gtools/lm32/bin/../lib/gcc/lm32-elf/4 
.3.0/../../../../lm32-elf/bin/ld:  region ebr is full (Hello.elf section 
.text)
/cygdrive/X/diamond/1.4/micosystem/gtools/lm32/bin/../lib/gcc/lm32-elf/4 
.3.0/../../../../lm32-elf/bin/ld:  region ebr is full (Hello.elf section 
.text)
/cygdrive/X/diamond/1.4/micosystem/gtools/lm32/bin/../lib/gcc/lm32-elf/4 
.3.0/../../../../lm32-elf/bin/ld:  section .rodata [00004000 -> 
000045f7] overlaps section .boot [00004000 -> 00004273]
/cygdrive/X/diamond/1.4/micosystem/gtools/lm32/bin/../lib/gcc/lm32-elf/4 
.3.0/../../../../lm32-elf/bin/ld:  section .text [00004274 -> 0000f0ff] 
overlaps section .rodata [00004000 -> 000045f7]
/cygdrive/X/diamond/1.4/micosystem/gtools/lm32/bin/../lib/gcc/lm32-elf/4 
.3.0/../../../../lm32-elf/bin/ld:  section .data [000045f8 -> 00004e9f] 
overlaps section .text [00004274 -> 0000f0ff]
/cygdrive/X/diamond/1.4/micosystem/gtools/lm32/bin/../lib/gcc/lm32-elf/4 
.3.0/../../../../lm32-elf/bin/ld:  Hello.elf: section .rodata lma 0x4000 
overlaps previous sections
/cygdrive/X/diamond/1.4/micosystem/gtools/lm32/bin/../lib/gcc/lm32-elf/4 
.3.0/../../../../lm32-elf/bin/ld:  Hello.elf: section .text lma 0x4274 
overlaps previous sections
collect2: ld returned 1 exit status
make: *** [Hello.elf] Error 1
make: Target `all' not remade because of errors.
Build complete for project Hello
#2618036
Lesenswert?
• ▲
▼
Das Problem kommt öfters vor, nicht nur bei Lattice. printf ist eine 
insofern gefährliche Funktion, als bei ihrer Verwendung eigentlich die 
gesamte Fließkommabibliothek zur Applikation dazugebunden werden muss. 
Manche Entwicklungsumgebungen untersuchen dann noch das erste Argument, 
und wenn es "nur" ein konstanter Text ist, dann ersetzen sie heimlich, 
still und lese den printf durch einen puts. Aber sowie das erste 
Argument ein % enthält oder, schlimmer noch, ein string ist, dann kann 
man zur Kompilierungszeit nicht sagen, ob da später nicht mal eine 
float-Variable ausgegeben werden soll, oder gar ein float-Ausdruck. Und 
schon braucht die Applikation die gesamte Fließkommabibliothek, und die 
ist ein paar zig Kilobyte groß.

Grüße,
Harald

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