0

Feather M0 compile error
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Feather M0 compile error

by BillBigge on Mon Jan 22, 2018 7:00 am

I have just bought a Feather M0 and installed the Adafruit SAMD board definitions using the board manager as shown in your tutorial. When I select 'Feather M0' as the board in the IDE and compile my project I get this error:

fatal error: sam.h: No such file or directory #include "sam.h"

Full verbose compile output is at the bottom.
I am running Windows 10 64 bit on a Dell Laptop with Arduino IDE 1.8.5 I also have teensyduino installed. The Feather M0 correctly appears in the list of serial ports.

My code:
Code: Select all | TOGGLE FULL SIZE
bool state = 0;

#if defined(ARDUINO_SAMD_ZERO) && defined(SERIAL_PORT_USBVIRTUAL)
  // Required for Serial on Zero based boards
  #define Serial SERIAL_PORT_USBVIRTUAL
#endif

void setup() {
  // put your setup code here, to run once:
  pinMode(13, OUTPUT);
  Serial.begin(115200);
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(13, state);
  state = !state;
  //if(Serial) Serial.println("Testing: " + millis());
  if(Serial) delay(500);
  else delay(2000);
}



Verbose compile output:
Code: Select all | TOGGLE FULL SIZE
C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Bill\AppData\Local\Arduino15\packages -hardware D:\Dropbox\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Bill\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries D:\Dropbox\Arduino\libraries -fqbn=adafruit:samd:adafruit_feather_m0 -vid-pid=0X239A_0X800B -ide-version=10805 -build-path C:\Users\Bill\AppData\Local\Temp\arduino_build_660864 -warnings=all -build-cache C:\Users\Bill\AppData\Local\Temp\arduino_cache_677595 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.openocd.path=C:\Users\Bill\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.9.0-arduino -prefs=runtime.tools.bossac.path=C:\Users\Bill\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.6.1-arduino -prefs=runtime.tools.arm-none-eabi-gcc.path=C:\Users\Bill\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1 -prefs=runtime.tools.CMSIS.path=C:\Users\Bill\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel -verbose D:\Dropbox\Arduino\FeatherM0Test1\FeatherM0Test1.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Bill\AppData\Local\Arduino15\packages -hardware D:\Dropbox\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Bill\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries D:\Dropbox\Arduino\libraries -fqbn=adafruit:samd:adafruit_feather_m0 -vid-pid=0X239A_0X800B -ide-version=10805 -build-path C:\Users\Bill\AppData\Local\Temp\arduino_build_660864 -warnings=all -build-cache C:\Users\Bill\AppData\Local\Temp\arduino_cache_677595 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.openocd.path=C:\Users\Bill\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.9.0-arduino -prefs=runtime.tools.bossac.path=C:\Users\Bill\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.6.1-arduino -prefs=runtime.tools.arm-none-eabi-gcc.path=C:\Users\Bill\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1 -prefs=runtime.tools.CMSIS.path=C:\Users\Bill\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel -verbose D:\Dropbox\Arduino\FeatherM0Test1\FeatherM0Test1.ino
Using board 'adafruit_feather_m0' from platform in folder: C:\Users\Bill\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.0.21
Using core 'arduino' from platform in folder: C:\Users\Bill\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.0.21
Detecting libraries used...
"C:\Users\Bill\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions  -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10805 -DARDUINO_SAMD_FEATHER_M0 -DARDUINO_ARCH_SAMD  -DARDUINO_SAMD_ZERO -D__SAMD21G18A__ -DUSB_VID=0x239A -DUSB_PID=0x800B -DUSBCON '-DUSB_MANUFACTURER="Adafruit"' '-DUSB_PRODUCT="Feather M0"' "-I/CMSIS/Include/" "-I/CMSIS/Device/ATMEL/" "-IC:\Users\Bill\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.0.21\cores\arduino" "-IC:\Users\Bill\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.0.21\variants\feather_m0" "C:\Users\Bill\AppData\Local\Temp\arduino_build_660864\sketch\FeatherM0Test1.ino.cpp" -o "nul"
"C:\Users\Bill\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions  -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10805 -DARDUINO_SAMD_FEATHER_M0 -DARDUINO_ARCH_SAMD  -DARDUINO_SAMD_ZERO -D__SAMD21G18A__ -DUSB_VID=0x239A -DUSB_PID=0x800B -DUSBCON '-DUSB_MANUFACTURER="Adafruit"' '-DUSB_PRODUCT="Feather M0"' "-I/CMSIS/Include/" "-I/CMSIS/Device/ATMEL/" "-IC:\Users\Bill\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.0.21\cores\arduino" "-IC:\Users\Bill\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.0.21\variants\feather_m0" "C:\Users\Bill\AppData\Local\Temp\arduino_build_660864\sketch\FeatherM0Test1.ino.cpp" -o "C:\Users\Bill\AppData\Local\Temp\arduino_build_660864\preproc\ctags_target_for_gcc_minus_e.cpp"
In file included from C:\Users\Bill\AppData\Local\Temp\arduino_build_660864\sketch\FeatherM0Test1.ino.cpp:1:0:

C:\Users\Bill\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.0.21\cores\arduino/Arduino.h:48:17: fatal error: sam.h: No such file or directory

 #include "sam.h"

                 ^

compilation terminated.

exit status 1
Error compiling for board Adafruit Feather M0.
Last edited by danhalbert on Mon Jan 22, 2018 7:47 pm, edited 1 time in total.
Reason: add [CODE] tags

BillBigge
 
Posts: 13
Joined: Mon Jan 22, 2018 6:49 am

Re: Feather M0 compile error

by danhalbert on Mon Jan 22, 2018 2:33 pm

Did you install both the Arduino and Adafruit SAMD M0 board support packages? You need both.

We have seen Arduino become confused and need to be reinstalled. If the above doesn't fix it, uninstall Arduino and delete the C:\Users\yourself\AppData\Local\Arduino15 folder, and then reinstall everything. (Note that AppData is a hidden folder.)

danhalbert
 
Posts: 1722
Joined: Tue Aug 08, 2017 12:37 pm

Re: Feather M0 compile error

by BillBigge on Tue Jan 23, 2018 8:44 am

Ah, thanks. That fixed it.

BillBigge
 
Posts: 13
Joined: Mon Jan 22, 2018 6:49 am

Re: Feather M0 compile error

by danhalbert on Tue Jan 23, 2018 9:19 am

Hi - just for reference, did you just need to install the other board package, or did you need to wipe and reinstall? We're trying to figure out if there's some latent bug in Arduino. Thanks.

danhalbert
 
Posts: 1722
Joined: Tue Aug 08, 2017 12:37 pm

Re: Feather M0 compile error

by BillBigge on Tue Jan 23, 2018 10:12 am

Well this is where it gets complicated!

I was actually trying to fix a problem with a Sparkfun SAMD21 mini board. It was taking about a minute to upload a sketch unless you put some load on the CPU, for example if I ran an animation sketch in processing and played a youtube video in a browser, it would upload a sketch in a few seconds. -- Erasing flash and writing the code would take over a minute, verification would be done in milliseconds.

In order to figure out what was going on I bought a feather M0 board. It worked fine so I tried unloading all the existing board definitions except the Adafruit ones - in the process I made the mistake of not keeping the Arduino SAMD definitions.

I also did a clean install of Arduino just to make sure it wasn't a bad driver install or similar, and I forced windows to reinstall every driver for my laptops USB hardware and avoided using any USB3 ports just to eliminate this as a cause (I originally plugged the SFE board into a USB3 port) I am now using the USB 3 ports with the Feather M0 without any issues.

The Adafruit M0 board works fine but the Sparkfun board does not.

Both boards are fine when using USB serial for data. The problem is just with the Sparkfun bootloader.

I have ordered another Sparkfun M0 board just so I can double check that it is not a board fault. If that one also causes problems then I will report what I have found to Sparkfun and Arduino. I am aware of others having similar problems with Sparkfun M0 boards and blaming device drivers but it is unclear why this is the case given that, as far as I know, the bootloaders should be functionally identical . . .

Unfortunately I don't have a programmer otherwise I would try and flash the Sparkfun board with your version of the bootloader.

I would welcome any insight Adafruit had on the issue!

Thanks for your help.

BillBigge
 
Posts: 13
Joined: Mon Jan 22, 2018 6:49 am

Re: Feather M0 compile error

by danhalbert on Tue Jan 23, 2018 10:34 am

Thanks for the report. On Windows 10, no drivers are needed: the usbser.sys driver that comes with Windows 10 provides the needed connectivity. I don't know which bootloader Sparkfun uses but I imagine it's similar to what Arduino uses for M0's for their boards. I don't know why you'd have trouble.

Some of our Feather M0 boards use the conventional SAM-BA bootloader, but we use the UF2 bootloader for the Express boards and Trinket and Gemma M0 so we can load CircuitPython easily. On those boards on Windows you will see three different COM ports used, one for UF2, one for a native Arduino program, and one for CircuitPython. You may need to double-click and then select the correct port before uploading in Arduino, because Arduino is not as good at guessing which port to use as it might be.

danhalbert
 
Posts: 1722
Joined: Tue Aug 08, 2017 12:37 pm

Re: Feather M0 compile error

by wpavalko on Mon Jan 29, 2018 2:14 pm

I had what may be a similar problem. After I updated to 1.8.5 yesterday, I could no longer compile a perfectly good Feather M0 sketch. I downgraded to 1.8.4 and I still can't compile. I get "multiple library" errors of wire.h and similar "multiple library" errors.

wpavalko
 
Posts: 57
Joined: Wed Mar 09, 2016 9:42 pm

Re: Feather M0 compile error

by danhalbert on Mon Jan 29, 2018 2:25 pm

@wpavalko - there does seem to be some issue with Arduino that involves corruption of the Arduino15 directory. I'd suggest uninstalling, removing that folder, and reinstalling. You will need to reinstall the board support packages.

danhalbert
 
Posts: 1722
Joined: Tue Aug 08, 2017 12:37 pm

Re: Feather M0 compile error

by boroko on Wed Mar 28, 2018 6:29 am

I wonder if that is why I'm having trouble with a sketch that works on a 32u4 Feather and throws all kinds of odd errors (mostly related to the RTC on a Adalogger Feather) on a Feather M0?
I'll try the uninstall/reinstall and see if that helps.

On a possible side note:
I have seen the following two different ways, can anyone explain if there's a difference....

#if defined(ARDUINO_ARCH_SAMD)

and,

#if defined(ARDUINO_SAMD_ZERO)

boroko
 
Posts: 44
Joined: Mon Jul 06, 2015 2:41 am

Re: Feather M0 compile error

by boroko on Thu Mar 29, 2018 2:53 am

Almost the same setup as BillBigge. Win10, Arduino IDE 1.8.5 (after a wipe of 1.8.3), upgraded the board files.

My sketch is getting to the size limits of a Feather 32u4 and I'd like to move up to a Feather M0, but the same program will run on the 32u4, and go nuts on the M0. They both have Adalogger Featherwings on them and most of the errors seem to center around the RTC.

I haven't even a clue on where or how to start looking on why a M0 would treat a sketch differently than a 32u4.
If it would be helpful, I can post the compile errors, or even the relevant code, but I'm inclined to think its something external to that, like the M0 needs a different library to operate or something.

Any hints?
bo

boroko
 
Posts: 44
Joined: Mon Jul 06, 2015 2:41 am

Re: Feather M0 compile error

by boroko on Thu Mar 29, 2018 7:23 am

Looks like it was a combination of things (of course). The two biggest were:

A couple of the lines that referred to the RTC had different capitalization. The 32u4 didn't seem to mind, but the M0 did. I don't begin to understand that one...

The divider for reading a connected LiPo battery in on A9 on the 32u4, and A7 on the M0.

Much better now with the cryptic (or not) abort errors.

bo

boroko
 
Posts: 44
Joined: Mon Jul 06, 2015 2:41 am

Re: Feather M0 compile error

by Jimib5150 on Sun Apr 01, 2018 12:13 am

Well gentle men I have read your post I assembled a adalogger logger myself and programmed it on a m0 feather and it failed to function. it cycled about 10 times wouldn't change date and time then died. So I tried it on an uno and it didn't get any better. I have no answers as for Compiling errors you have to have all the libraries or nothing compiles. the other half of the equation is the wiring check all connections and hope for the best.

Jimib5150

Jimib5150
 
Posts: 1
Joined: Sun Apr 01, 2018 12:06 am

Re: Feather M0 compile error

by b3pkay on Fri Dec 07, 2018 2:41 am

Helllo,

Messing with a Feather MO and having some errors. Originally when I used this board it was during a workshop and on a different computer. It's been a while since I've done anything with it so it took me a bit to load all of the necessary libraries in order for it to communicate with my Mac. Upon uploading I am receiving the following error:

Arduino: 1.8.5 (Mac OS X), Board: "Adafruit Feather M0"

Archiving built core (caching) in: /var/folders/b6/3whb1j6j73q9n2n0rxxpllyr0000gn/T/arduino_cache_518666/core/core_adafruit_samd_adafruit_feather_m0_ee7bb1bf0476d6b9e4fe6ccebee1e83e.a
Sketch uses 18416 bytes (7%) of program storage space. Maximum is 262144 bytes.
java.io.IOException: Cannot run program "{runtime.tools.bossac-1.7.0.path}/bossac": error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at java.lang.Runtime.exec(Runtime.java:620)
at java.lang.Runtime.exec(Runtime.java:485)
at processing.app.helpers.ProcessUtils.exec(ProcessUtils.java:11)
at cc.arduino.packages.Uploader.executeUploadCommand(Uploader.java:129)
at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:207)
at cc.arduino.UploaderUtils.upload(UploaderUtils.java:78)
at processing.app.SketchController.upload(SketchController.java:713)
at processing.app.SketchController.exportApplet(SketchController.java:686)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2168)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 10 more
An error occurred while uploading the sketch

Any thoughts?? It has messed up the program that was running successfully on the board and LED before... it turned all of the LEDs on super bright... and after a few minutes I could smell it overheating. I think it's okay, but any help would be appreciated.

b3pkay
 
Posts: 2
Joined: Fri Dec 07, 2018 2:37 am

Re: Feather M0 compile error

by danhalbert on Fri Dec 07, 2018 9:22 am

It looks like you may not have installed the board support packages for Arduino SAMD and Adafruit SAMD, because Arduino can't find bossac. Have you followed the steps here to set up Arduino:
https://learn.adafruit.com/adafruit-fea ... -ide-setup

danhalbert
 
Posts: 1722
Joined: Tue Aug 08, 2017 12:37 pm

Re: Feather M0 compile error

by b3pkay on Fri Dec 07, 2018 10:11 am

I figured the Arduiono SAMD package was already installed and then couldn't find it because I was looking in the library last night.

THANK YOU! So easy, all good now.

b3pkay
 
Posts: 2
Joined: Fri Dec 07, 2018 2:37 am

Please be positive and constructive with your questions and comments.