Hi everybody,
I've started working on a maple board for 2 weeks now and I am facing a weird problem with the LiquidCrystal library.
I am using the command-line toolchain with libmaple 0.0.12.
The LCD is working fine with this basic arduino-like code:
#include <wirish/wirish.h>
// include the library code:
#include "./libraries/LiquidCrystal/LiquidCrystal.h"
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(0,1,2,3,4,5);
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(24, 2);
// Print a message to the LCD.
lcd.print("hello, world!");
}
void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print(millis()/1000);
}
// Force init to be called *first*, i.e. before static object allocation.
// Otherwise, statically allocated objects that need libmaple may fail.
__attribute__((constructor)) void premain() {
init();
}
int main(void) {
setup();
while (true) {
loop();
}
return 0;
}
No problem, this is working as it should, so I guess everything is wired correctly.
BUT if I change the optimization option flag in the makefile from -Os to -O1, 2 or 3, the LCD does not seem to initialize.
Any ideas why this is not working? Apart from this I did not face any other problem with switching the optimization flag from s to 1, 2 or 3.