If I use the arduino ‘delay’ function my application never gets past the delay(1) line..
if I use the atmel studio's _delay_ms , it works fine.
My application includes “Arduino.h” and the compiler symbol flag is set correctly (F_CPU=16000000L), with the optimization set for size (-O2)
Do I need to include Wiring.cpp?
I could live without using the Arduino delay, but I'm worried that there may be other arduino functions in the arduino core.a library that may fail to work if the root cause isn't fixed!
Do you use int main()?
You will need to call init() or setup timer 0 yourself: http://arduino.land/FAQ/content/2/2/en/can-i-use-int-main-with-arduino.html
Thanks! Calling init() did the trick!
It's also good that my application didn't have an init() function declared.. although I bet the linker would have caught that.
Is there a page that lists all the core library function names?
The reference has most, however things like init() are internal and most probably undocumented outside of the code.
You can also have a look in the source, https://github.com/arduino/Arduino/tree/master/hardware/arduino/cores/arduino
although I bet the linker would have caught that.
Unfortunatly not, C++ allows function overloading. The code below compiles but is only 170 bytes compared to 450 with the built in init().
Lucky you didn't define your own.
void init(){}
void setup() {
}
void loop() {
}