PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : LCD Anzeige in FemtoOS (P. Fleury)



Jacob2
21.08.2011, 09:31
Hi!
Ich habe mich ein bisschen mit FemtoOS beschäftigt, d.h. ich habe es immerhin schonmal geschafft ein Beispielprogramm (LED Flash) auf einem ATmega48 zum Laufen zu bringen.

Jetzt wollte ich gerne ein LCD steuern, was ich bisher immer mit P. Fleury's Bibliothek gemacht habe, aber nun bekomme ich 31 Warnungen und das LCD bleibt leer (der schwarze Balken ist aber weg -> vielleicht hat lcd_init() zumindest funktioniert...).


Build started 21.8.2011 at 10:24:05

[...]

../lcdlibrary/lcd.c: In function 'lcd_waitbusy':
../lcdlibrary/lcd.c:294: warning: integer constant is too large for 'long' type
../lcdlibrary/lcd.c: In function 'lcd_init':
../lcdlibrary/lcd.c:556: warning: integer constant is too large for 'long' type
../lcdlibrary/lcd.c:556: warning: large integer implicitly truncated to unsigned type
../lcdlibrary/lcd.c:562: warning: integer constant is too large for 'long' type
../lcdlibrary/lcd.c:562: warning: large integer implicitly truncated to unsigned type
../lcdlibrary/lcd.c:566: warning: integer constant is too large for 'long' type
../lcdlibrary/lcd.c:570: warning: integer constant is too large for 'long' type
../lcdlibrary/lcd.c:575: warning: integer constant is too large for 'long' type
../lcdlibrary/lcd.c:596:5: warning: "KS0073_4LINES_MODE" is not defined
../lcdlibrary/lcd.c: In function 'lcd_waitbusy':
../lcdlibrary/lcd.c:96: warning: inlining failed in call to '_delayFourCycles': optimizing for size and code size would grow
../lcdlibrary/lcd.c:294: warning: called from here
../lcdlibrary/lcd.c: In function 'lcd_init':
../lcdlibrary/lcd.c:96: warning: inlining failed in call to '_delayFourCycles': optimizing for size and code size would grow
../lcdlibrary/lcd.c:556: warning: called from here
../lcdlibrary/lcd.c:96: warning: inlining failed in call to '_delayFourCycles': optimizing for size and code size would grow
../lcdlibrary/lcd.c:562: warning: called from here
../lcdlibrary/lcd.c:96: warning: inlining failed in call to '_delayFourCycles': optimizing for size and code size would grow
../lcdlibrary/lcd.c:566: warning: called from here
../lcdlibrary/lcd.c:96: warning: inlining failed in call to '_delayFourCycles': optimizing for size and code size would grow
../lcdlibrary/lcd.c:570: warning: called from here
../lcdlibrary/lcd.c:96: warning: inlining failed in call to '_delayFourCycles': optimizing for size and code size would grow
../lcdlibrary/lcd.c:575: warning: called from here
avr-gcc -mmcu=atmega48 -mint8 -Wl,--defsym=__stack=xOS+xOSstackShift --param inline-call-cost=2 -ffunction-sections -Wl,--gc-sections -Wl,--relax -Wno-main -Winline -Wundef -fomit-frame-pointer -Wl,-Map=FemtoOS_FlashLeds.map femtoos_startup.o femt
oos_port.o femtoos_shared.o femtoos_core.o code_TestFlashLeds.o lcd.o -o FemtoOS_FlashLeds.elf

avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature FemtoOS_FlashLeds.elf FemtoOS_FlashLeds.hex
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O ihex FemtoOS_FlashLeds.elf FemtoOS_FlashLeds.eep || exit 0
avr-objdump -h -S FemtoOS_FlashLeds.elf > FemtoOS_FlashLeds.lss

AVR Memory Usage
----------------
Device: atmega48

Program: 2266 bytes (55.3% Full)
(.text + .data + .bootloader)

Data: 104 bytes (20.3% Full)
(.data + .bss + .noinit)

Build succeeded with 21 Warnings...


Irgendwie scheint er Probleme mit den Integer-Konstanten zu haben, in solchen Zeilen:

294: delay(2);
556: delay(16000);
usw.

Verändert FemtoOS da irgendwelche Einstellungen (kann mir aber keine Vorstellen), weil außerhalb von FemtoOS funktioniert die LCD-Library einwandfrei (ohne Warnungen)...

sternst
21.08.2011, 10:55
Verändert FemtoOS da irgendwelche Einstellungen (kann mir aber keine Vorstellen)

avr-gcc ... -mint8 ...

Jacob2
21.08.2011, 13:15
Vielen Dank sternst!
Der Link hier (http://www.mikrocontroller.net/articles/AVR-GCC-Codeoptimierung#Compileroption_-mint8_f.C3.BCr_8-Bit_Arithmetik_als_Default) erklärt einiges, muss ich jetzt einfach an den gegebenen Stellen mit einem Postfix 'L' arbeiten? Die Warnung heißt ja aber eigentlich, dass die Werte selbst für long zu groß sind... Oder?

sternst
21.08.2011, 14:09
Das beste wäre es, das -mint8 komplett rauszuschmeißen. Dieser Schalter ist sehr problematisch, und wird von neueren GCC-Versionen auch gar nicht mehr unterstützt. Ob und welche Auswirkungen das dann allerdings auf FemtoOS hat, kann ich dir nicht sagen.

Jacob2
21.08.2011, 14:35
Wo würde ich denn sowas abschalten im AVR Studio? Einfach mal sehen ob FemtoOS dann noch funktioniert...

Jacob2
27.08.2011, 10:39
Ich habe es mittlerweile geschafft, -mint8 auszuschalten, was die Warnungsanzahl etwas reduziert hat:

[...]

avr-gcc -I"W:\Ich\Roboter\FemtoOS_0.92\IDE\studioprojects\Fem toOS_Staubsaugerroboter\..\..\..\MainCode\femtoos_ headers" -I"W:\Ich\Roboter\FemtoOS_0.92\IDE\studioprojects\Fem toOS_Staubsaugerroboter\..\..\..\MainCode\femtoos_ devices" -I"W:\Ich\Roboter\FemtoO
S_0.92\IDE\studioprojects\FemtoOS_Staubsaugerrobot er\." -mmcu=atmega48 -Wall -gdwarf-2 -Wl,--defsym=__stack=xOS+xOSstackShift --param inline-call-cost=2 -ffunction-sections -Wl,--gc-sections -Wl,--relax -Wno-main -Winline -Wundef -fomit-frame-pointer -DF_
CPU=8000000UL -Os -funsigned-char -fpack-struct -fshort-enums -MD -MP -MT lcd.o -MF dep/lcd.o.d -c ../lcdlibrary/lcd.c

../lcdlibrary/lcd.c:596:5: warning: "KS0073_4LINES_MODE" is not defined
../lcdlibrary/lcd.c: In function 'lcd_waitbusy':
../lcdlibrary/lcd.c:96: warning: inlining failed in call to '_delayFourCycles': optimizing for size and code size would grow
../lcdlibrary/lcd.c:294: warning: called from here
../lcdlibrary/lcd.c: In function 'lcd_init':
../lcdlibrary/lcd.c:96: warning: inlining failed in call to '_delayFourCycles': optimizing for size and code size would grow
../lcdlibrary/lcd.c:556: warning: called from here
../lcdlibrary/lcd.c:96: warning: inlining failed in call to '_delayFourCycles': optimizing for size and code size would grow
../lcdlibrary/lcd.c:562: warning: called from here
../lcdlibrary/lcd.c:96: warning: inlining failed in call to '_delayFourCycles': optimizing for size and code size would grow
../lcdlibrary/lcd.c:566: warning: called from here
../lcdlibrary/lcd.c:96: warning: inlining failed in call to '_delayFourCycles': optimizing for size and code size would grow
../lcdlibrary/lcd.c:570: warning: called from here
../lcdlibrary/lcd.c:96: warning: inlining failed in call to '_delayFourCycles': optimizing for size and code size would grow
../lcdlibrary/lcd.c:575: warning: called from here
avr-gcc -mmcu=atmega48 -Wl,--defsym=__stack=xOS+xOSstackShift --param inline-call-cost=2 -ffunction-sections -Wl,--gc-sections -Wl,--relax -Wno-main -Winline -Wundef -fomit-frame-pointer -Wl,-Map=FemtoOS_FlashLeds.map femtoos_startup.o femtoos_port.o femt
oos_shared.o femtoos_core.o code_TestFlashLeds.o lcd.o -o FemtoOS_FlashLeds.elf

avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature FemtoOS_FlashLeds.elf FemtoOS_FlashLeds.hex
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O ihex FemtoOS_FlashLeds.elf FemtoOS_FlashLeds.eep || exit 0
avr-objdump -h -S FemtoOS_FlashLeds.elf > FemtoOS_FlashLeds.lss

[...]

Build succeeded with 13 Warnings...


Warum KS0073_4LINES_MODE nicht definiert sein soll, verstehe ich nicht, denn das wird in lcd.c in Zeile 74 eindeutig definiert:

#define KS0073_4LINES_MODE 0x09 /* |0|001|0000 4-bit mode, extension-bit RE = 0 */

Die Boot-Funktion appBoot() sieht so aus:

void appBoot(void)
{
lcd_init(LCD_DISP_ON);
lcd_puts("Staubsaugerrobot");
lcd_gotoxy(0, 1);
lcd_puts("FemtoOS 0.92");
}

In jeder Task (8 Stück) wird nur gewartet:

#if (preTaskDefined(MainTask))

void appLoop_MainTask(void)
{
while(true)
{
taskDelayFromNow(430U);
}
}

#endif

Leider bleibt das LCD immer noch leer, die Anfangsmeldung müsste ja die ganze Zeit zu sehen sein...

Hat jemand so viel Ahnung von FemtoOS, dass er mir sagen kann, was ich noch falsch mache?

PS: Sorry für so viel Code, aber ich denke das ist notwendig...