Zero compiling problems


I have a problem with the compiling of the ZERO board; I’ve done my own library and put into the library folder. The library consists of many classes, structures etc. some uses core Arduino calls (Serial, String, AnalogRead etc). Hence, they include the [ #include <Arduini.h>

Compiling is done in the Arduino IDE (1.6.7). The zero is installed in the baord manager.

I also have an Atmel Mega 2560. Everything compiles (and runs) perfect.

With the Zero I get:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\Arduino.h:29:20: fatal error: avr/io.h: No such file or directory

#include <avr/io.h>
I have tried to copy all src from C:\Program Files (x86)\Arduino into my own folder and pointed Arduino.h in that folder instead. But the problems just propagates… Cannot find <\Utils\Delay.h> etc. etc. Eventually, the board is not defined in some .h etc. etc…

Any suggestions?

Thanks in advance,
Daniel Petrini

The zero architecture is ARM, not AVR. Try to comment the include statement with "avr/xxx.h" and "utils/xxx.h".

You can also do a conditional include :

#if defined(__SAM3X8E__) || defined(__SAMD21G18A__) //for ARM boards
    #include "whatever.h" //only for sam and samd boards (Due and Zero)

#else  //for AVR boards
    #include "avr/xxx.h"  //only for avr boards


And please post your code, it's hard to help without it.

Hello, I hope you already know that Arduino AVR (ATMEL propietary architecture) is completely different to the SAMD architecture (Standard ARM Cortex M0+).

And you are using an AVR library.

Arduino AVR libraries are usually very compatible with our Arduino Zero Boards, but as soon as you deals with E/S, or HW level stuff, you get this compilation errors, for example as soon as you use BV_ macros or lower level instruction you will issues.

However it is not so difficult to port code form AVR to SAMD, I have had these kinds of issues, and with limited C knowledge, you can overcome many issues. You can see some of my efforts :

Good luck!