Skip to content

sam.h not found in 1.0.15 #221

@bdlabitt

Description

@bdlabitt

Updating from 1.0.13 to 1.0.15 results in error below. Error disappears when regressing to 1.0.13

Arduino: 1.8.0 (Linux), Board: "Adafruit Feather M0"

/home/bruce/Apps/arduino-1.8.0/arduino-builder -dump-prefs -logger=machine -hardware /home/bruce/Apps/arduino-1.8.0/hardware -hardware /home/bruce/.arduino15/packages -tools /home/bruce/Apps/arduino-1.8.0/tools-builder -tools /home/bruce/Apps/arduino-1.8.0/hardware/tools/avr -tools /home/bruce/.arduino15/packages -built-in-libraries /home/bruce/Apps/arduino-1.8.0/libraries -libraries /home/bruce/Arduino/libraries -fqbn=adafruit:samd:adafruit_feather_m0 -vid-pid=0X239A_0X800B -ide-version=10800 -build-path /tmp/arduino_build_652060 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arm-none-eabi-gcc.path=/home/bruce/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1 -prefs=runtime.tools.CMSIS.path=/home/bruce/.arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel -prefs=runtime.tools.bossac.path=/home/bruce/.arduino15/packages/arduino/tools/bossac/1.6.1-arduino -prefs=runtime.tools.openocd.path=/home/bruce/.arduino15/packages/arduino/tools/openocd/0.9.0-arduino -verbose /home/bruce/Arduino/WiFiUdpNtpClientClock/WiFiUdpNtpClientClock.ino
/home/bruce/Apps/arduino-1.8.0/arduino-builder -compile -logger=machine -hardware /home/bruce/Apps/arduino-1.8.0/hardware -hardware /home/bruce/.arduino15/packages -tools /home/bruce/Apps/arduino-1.8.0/tools-builder -tools /home/bruce/Apps/arduino-1.8.0/hardware/tools/avr -tools /home/bruce/.arduino15/packages -built-in-libraries /home/bruce/Apps/arduino-1.8.0/libraries -libraries /home/bruce/Arduino/libraries -fqbn=adafruit:samd:adafruit_feather_m0 -vid-pid=0X239A_0X800B -ide-version=10800 -build-path /tmp/arduino_build_652060 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arm-none-eabi-gcc.path=/home/bruce/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1 -prefs=runtime.tools.CMSIS.path=/home/bruce/.arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel -prefs=runtime.tools.bossac.path=/home/bruce/.arduino15/packages/arduino/tools/bossac/1.6.1-arduino -prefs=runtime.tools.openocd.path=/home/bruce/.arduino15/packages/arduino/tools/openocd/0.9.0-arduino -verbose /home/bruce/Arduino/WiFiUdpNtpClientClock/WiFiUdpNtpClientClock.ino
Using board 'adafruit_feather_m0' from platform in folder: /home/bruce/.arduino15/packages/adafruit/hardware/samd/1.0.15
Using core 'arduino' from platform in folder: /home/bruce/.arduino15/packages/adafruit/hardware/samd/1.0.15
Detecting libraries used...
"/home/bruce/.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=10800 -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/" "-I/home/bruce/.arduino15/packages/adafruit/hardware/samd/1.0.15/cores/arduino" "-I/home/bruce/.arduino15/packages/adafruit/hardware/samd/1.0.15/variants/arduino_zero" "/tmp/arduino_build_652060/sketch/WiFiUdpNtpClientClock.ino.cpp" -o "/dev/null"
"/home/bruce/.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=10800 -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/" "-I/home/bruce/.arduino15/packages/adafruit/hardware/samd/1.0.15/cores/arduino" "-I/home/bruce/.arduino15/packages/adafruit/hardware/samd/1.0.15/variants/arduino_zero" "/tmp/arduino_build_652060/sketch/WiFiUdpNtpClientClock.ino.cpp" -o "/tmp/arduino_build_652060/preproc/ctags_target_for_gcc_minus_e.cpp"
In file included from /tmp/arduino_build_652060/sketch/WiFiUdpNtpClientClock.ino.cpp:1:0:
/home/bruce/.arduino15/packages/adafruit/hardware/samd/1.0.15/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.

[code]

/*
 Udp NTP Client

 Get the time from a Network Time Protocol (NTP) time server
 Demonstrates use of UDP sendPacket and ReceivePacket
 For more on NTP time servers and the messages needed to communicate with them,
 see http://en.wikipedia.org/wiki/Network_Time_Protocol

 created 4 Sep 2010
 by Michael Margolis
 modified 9 Apr 2012
 by Tom Igoe

 This code is in the public domain.
 */
 /*  Modified by BDLabitt to add Adafruit SSD1306 OLED display, and run on WINC1500 Wireless links
  *  Platform: Adafruit Feather MO
 */

#include <SPI.h>
#include <WiFi101.h>
#include <WiFiUdp.h>
#include <TimeLib.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

Adafruit_SSD1306 display = Adafruit_SSD1306();

#if defined(ESP8266)
  #define BUTTON_A 0
  #define BUTTON_B 16
  #define BUTTON_C 2
  #define LED      0
#elif defined(ARDUINO_STM32F2_FEATHER)
  #define BUTTON_A PA15
  #define BUTTON_B PC7
  #define BUTTON_C PC5
  #define LED PB5
#elif defined(TEENSYDUINO)
  #define BUTTON_A 4
  #define BUTTON_B 3
  #define BUTTON_C 8
  #define LED 13
#else 
  #define BUTTON_A 9
  #define BUTTON_B 6
  #define BUTTON_C 5
  #define LED      13
#endif

#if (SSD1306_LCDHEIGHT != 32)
 #error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif

int status = WL_IDLE_STATUS;

char ssid[] = "xxxxxx";  //  your network SSID (name)
char pass[] = "yyyyyyyyyyyy";       // your network password

int keyIndex = 0;            // your network key Index number (needed only for WEP)
//long tzoffset = -4;         // EDT
const int timeZone = -4;  // Eastern Daylight Time (USA)
unsigned int localPort = 2390;      // local port to listen for UDP packets
//IPAddress timeServer(129, 6, 15, 28); // time.nist.gov NTP server
IPAddress timeServer(132, 163, 4, 103); // time-c.timefreq.bldrdoc.gov
const int NTP_PACKET_SIZE = 48; // NTP time stamp is in the first 48 bytes of the message
byte packetBuffer[ NTP_PACKET_SIZE]; //buffer to hold incoming and outgoing packets
// A UDP instance to let us send and receive packets over UDP
WiFiUDP Udp;

void setup()
{
  //Configure pins for Adafruit ATWINC1500 Feather
  WiFi.setPins(8,7,4,2);
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3C (for the 128x32)
  display.display();
  delay(1000);
  display.clearDisplay();
  display.display();
  
  pinMode(BUTTON_A, INPUT_PULLUP);
  pinMode(BUTTON_B, INPUT_PULLUP);
  pinMode(BUTTON_C, INPUT_PULLUP);
    
  // check for the presence of the shield:
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    // don't continue:
    while (true);
  }
  // Connect to WiFi network:
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
    status = WiFi.begin(ssid, pass);
    // wait 10 seconds for connection:
    delay(10000);
  }
  Serial.println("Connected to wifi");
  //displayPreamble();
  //display.display();  // actually display the screen
  printWiFiStatus();
  Serial.println("\nStarting connection to NTP server...");
  Udp.begin(localPort);
  setSyncProvider(getNtpTime);
  setSyncInterval(61);                // resync every n seconds.  needed for onboard osc.
                                      // try not to be synchronous to minimize server load
}

void displayPreamble()
{
  IPAddress ip = WiFi.localIP();
  long rssi = WiFi.RSSI();
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
  display.print("SSID:");
  display.println(WiFi.SSID());
  display.print("IP:");
  display.println(ip);
  display.print("RSSI:");
  display.print(rssi);
  display.println("dBm");
}
time_t prevDisplay = 0;  // when the digital clock was displayed

void loop()
{
  if(timeStatus() != timeNotSet) {
    if (now() != prevDisplay) {       // update the display only if time has changed
      prevDisplay = now();
      digitalClockDisplay();
    }
  }
}

void digitalClockDisplay(){
  // digital clock display of the time
  displayPreamble();
  Serial.print(hour());
  display.print(hour());
  printDigits(minute());
  printDigits(second());
  Serial.print(" ");
  display.print(" ");
  Serial.print(month());
  display.print(month());
  Serial.print("/");
  display.print("/");
  Serial.print(day());
  display.print(day());
  Serial.print("/");
  display.print("/");
  Serial.print(year()); 
  display.print(year()); 
  Serial.println(); 
  display.display();    // show the display
}

void printDigits(int digits){
  // utility for digital clock display: prints preceding colon and leading 0
  Serial.print(":");
  display.print(":");
  if(digits < 10)
  {
    Serial.print('0');
    display.print('0');
  }
  Serial.print(digits);
  display.print(digits);
}

/*-------- NTP code ----------*/
time_t getNtpTime()
{
  while (Udp.parsePacket() > 0) ; // discard any previously received packets
  Serial.println("Transmit NTP Request");
  sendNTPpacket(timeServer);
  uint32_t beginWait = millis();
  while (millis() - beginWait < 1500) {
    int size = Udp.parsePacket();
    if (size >= NTP_PACKET_SIZE) {
      Serial.println("Receive NTP Response");
      Udp.read(packetBuffer, NTP_PACKET_SIZE);  // read packet into the buffer
      unsigned long secsSince1900;
      // convert four bytes starting at location 40 to a long integer
      secsSince1900 =  (unsigned long)packetBuffer[40] << 24;
      secsSince1900 |= (unsigned long)packetBuffer[41] << 16;
      secsSince1900 |= (unsigned long)packetBuffer[42] << 8;
      secsSince1900 |= (unsigned long)packetBuffer[43];
      return secsSince1900 - 2208988800UL + timeZone * SECS_PER_HOUR;
    }
  }
  Serial.println("No NTP Response :-(");
  return 0; // return 0 if unable to get the time
}

// send an NTP request to the time server at the given address
void sendNTPpacket(IPAddress &address)
{
  // set all bytes in the buffer to 0
  memset(packetBuffer, 0, NTP_PACKET_SIZE);
  // Initialize values needed to form NTP request
  // (see URL above for details on the packets)
  packetBuffer[0] = 0b11100011;   // LI, Version, Mode
  packetBuffer[1] = 0;     // Stratum, or type of clock
  packetBuffer[2] = 6;     // Polling Interval
  packetBuffer[3] = 0xEC;  // Peer Clock Precision
  // 8 bytes of zero for Root Delay & Root Dispersion
  packetBuffer[12]  = 49;
  packetBuffer[13]  = 0x4E;
  packetBuffer[14]  = 49;
  packetBuffer[15]  = 52;
  // all NTP fields have been given values, now
  // you can send a packet requesting a timestamp:                 
  Udp.beginPacket(address, 123); //NTP requests are to port 123
  Udp.write(packetBuffer, NTP_PACKET_SIZE);
  Udp.endPacket();
}

void printWiFiStatus() {
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print your WiFi shield's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);

  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.print(rssi);
  Serial.println(" dBm");
}
[/code]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions