Forum: Compiler & IDEs MSPGCC: sprintf(), sscanf()


von Manfred Helzle (Gast)


Lesenswert?

hi
ich hab den MSPGCC installiert und meine Applikation von IAR auf MSPGCC
angepasst: MSP430F1232, Timer, Watchdog, ADC, UART, GPIO, alles über
IRQs

was nicht geht ist das sprintf() - wenn ich das kommentiere läuft der
Rest OK (ich vermute, dass diese Version viel mehr Speicher
benötigt!?)
gibt´s ´ne abgespeckte Version ohne float, die weniger Speicher
benötigt? oder ´ne Compiler-Option wie "NOFLOAT"?

was fehlt ist sscanf() - gibt´s das irgendwo?

danke für Tips
Manfred

von Paul (Gast)


Lesenswert?

Hi Manfred,

soweit ich weiss, kann das standard MSP430 sprintf() keine floats
verarbeiten und falls das Programm zu groß wird, linkt der gcc es nicht
und man bekommt folgende Fehlermeldung:

section .vectors overlaps section .text

Ich selber benutze uprintf() und kenne mich mit sprintf() nicht aus,
aber schau dir den Punkt 6 im Auszug aus sprintf.c an, ich vermute,
dass dir das weiterhelfen könnte (bin mir aber unsicher):

/*
 * Sprintf is taken from dip122 project.
 * I just adopted it that msp430-gcc can handle it
 * The code is about 1500 bytes (depends on -O options)
 *
 * (c) msp gcc team http://mspgcc.sourceforge.net
 */
/*********************************************************************** 
*******
This file is a patched version of printf called _printf_P
It is made to work with avr-gcc for Atmel AVR MCUs.
There are some differences from standard printf:
1. There is no floating point support (with fp the code is about 8K!)
2. Return type is void
3. Format string must be in program memory (by using macro printf this
is done automaticaly)
4. %n is not implemented (just remove the comment around it if you need
it)
5. If LIGHTPRINTF is defined, the code is about 550 bytes smaller and
the folowing specifiers are disabled: space # * . - + p s o O
6. A function void uart_sendchar(char c) is used for output. The UART
must be initialized before using printf.

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.