Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) missing some/all avr library (Read 3831 times)
jimf
Junior Member
**
Offline


Posts: 16
Joined: May 30th, 2015
missing some/all avr library
Feb 10th, 2021 at 2:39am
Print Post  
Hi, I'm working on a project using an ESP32 which will log data from our greenhouse and display it via the web using Adafruit's IO.  I've been able to get some test programs going with the ESP32 that exercise some sensors and have been able to upload and debug OTA.  I ran into trouble building when I started experimenting with AdafruitIO.  Sooooo, I decided to just use one of the examples in the Adafruit-IO-master library...the assumption being that the code should compile and work correctly.  However, I got the same type of error I was getting in my code.   It relates to unfound files detected during deep search for libraries.  "The SoftwareSerial-master library encountered an unknown path resolve error.C*: 41:27: fatal error: avr/interrupt.h: No such file or directory".  I previously got a similar error when building the example code regarding SoftwareSerial.h.....so I looked for the SoftwareSerial library on GitHub, loaded it, then got another avr header not found.  I looked in my Arduino/libraries that got installed with the IDE and didn't see an avr library.  I looked for the entire avr library on GitHub/web but didn't find anything.  I reinstalled my arduino IDE just for kicks....no change.  The code I'm trying to build is below and I've attached the compiler build/verbose as an attachment.  Any help you can give is much appreciated.  thanks....jim

// Adafruit IO Temperature & Humidity Example
// Tutorial Link: https://learn.adafruit.com/adafruit-io-basics-temperature-and-humidity
//
// Adafruit invests time and resources providing this open source code.
// Please support Adafruit and open source hardware by purchasing
// products from Adafruit!
//
// Written by Todd Treece for Adafruit Industries
// Copyright (c) 2016-2017 Adafruit Industries
// Licensed under the MIT license.
//
// All text above must be included in any redistribution.

/************************** Configuration ***********************************/

// edit the config.h tab and enter your Adafruit IO credentials
// and any additional configuration needed for WiFi, cellular,
// or ethernet clients.
#include <AdafruitIO_WiFi.h>
#include <AdafruitIO_Time.h>
#include <AdafruitIO_MQTT.h>
#include <AdafruitIO_Group.h>
#include <AdafruitIO_FONA.h>
#include <AdafruitIO_Feed.h>
#include <AdafruitIO_Ethernet.h>
#include <AdafruitIO_Definitions.h>
#include <AdafruitIO_Data.h>
#include <AdafruitIO_Dashboard.h>
#include <AdafruitIO.h>
#include "config.h"

/************************ Example Starts Here *******************************/
#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>

// pin connected to DH22 data line
#define DATA_PIN 2

// create DHT22 instance
DHT_Unified dht(DATA_PIN, DHT22);

// set up the 'temperature' and 'humidity' feeds
AdafruitIO_Feed *temperature = io.feed("temperature");
AdafruitIO_Feed *humidity = io.feed("humidity");

void setup() {

  // start the serial connection
  Serial.begin(115200);

  // wait for serial monitor to open
  while(! Serial);

  // initialize dht22
  dht.begin();

  // connect to io.adafruit.com
  Serial.print("Connecting to Adafruit IO");
  io.connect();

  // wait for a connection
  while(io.status() < AIO_CONNECTED) {
    Serial.print(".");
    delay(500);
  }

  // we are connected
  Serial.println();
  Serial.println(io.statusText());

}

void loop() {

  // io.run(); is required for all sketches.
  // it should always be present at the top of your loop
  // function. it keeps the client connected to
  // io.adafruit.com, and processes any incoming data.
  io.run();

  sensors_event_t event;
  dht.temperature().getEvent(&event);

  float celsius = event.temperature;
  float fahrenheit = (celsius * 1.8) + 32;

  Serial.print("celsius: ");
  Serial.print(celsius);
  Serial.println("C");

  Serial.print("fahrenheit: ");
  Serial.print(fahrenheit);
  Serial.println("F");

  // save fahrenheit (or celsius) to Adafruit IO
  temperature->save(fahrenheit);

  dht.humidity().getEvent(&event);

  Serial.print("humidity: ");
  Serial.print(event.relative_humidity);
  Serial.println("%");

  // save humidity to Adafruit IO
  humidity->save(event.relative_humidity);

  // wait 5 seconds (5000 milliseconds == 5 seconds)
  delay(5000);

}
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: missing some/all avr library
Reply #1 - Feb 11th, 2021 at 12:23am
Print Post  
Hi

The error is with the software serial library that you have installed. I asume you installed the library because you have also switched on the visual micro software serial debug option.

The software serial library you have installed is desined for Atmel AVR processors and woudl expect an Atmel board to be selected.
  
Back to top
WWW  
IP Logged
 
jimf
Junior Member
**
Offline


Posts: 16
Joined: May 30th, 2015
Re: missing some/all avr library
Reply #2 - Feb 11th, 2021 at 2:17am
Print Post  
Thank you Tim!  Are you able to point me to the correct software serial library to install?  Thanks again....jim
  
Back to top
 
IP Logged
 
jimf
Junior Member
**
Offline


Posts: 16
Joined: May 30th, 2015
Re: missing some/all avr library
Reply #3 - Feb 11th, 2021 at 2:20am
Print Post  
oops....hit post too quickly.  In addition to pointing me to the correct software serial library to install, would you please indicate what part of the build verbose output I sent lead to your conclusion?  Many thanks.....jim
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: missing some/all avr library
Reply #4 - Feb 11th, 2021 at 2:39am
Print Post  
1)
I misread the debugger setting, it appears to be set to UDP. Can you switch it off for now so that we can ensure a clean normal build. Thanks

2)
The build output in your post now appears to be missing the error. I am unsure if the problem is my browser or if you have changed the output attached to your first post? It no longer shows the error for me but previously it showed the softwareSerial library was reporting the missing avr. Where did you download the software serial library from?

  
Back to top
WWW  
IP Logged
 
jimf
Junior Member
**
Offline


Posts: 16
Joined: May 30th, 2015
Re: missing some/all avr library
Reply #5 - Feb 11th, 2021 at 10:43pm
Print Post  
Attached is the build with upload/debug through serial port.  SoftwareSerial comes from https://github.com/PaulStoffregen/SoftwareSerial.  Thanks!
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: missing some/all avr library
Reply #6 - Feb 11th, 2021 at 11:23pm
Print Post  
In the output we can see the error is raised by the softwareSerial library. They are not all the same. The one you selected is for the avr boards. 

I suggest you delete this folder C:\Users\jimfr\OneDrive\Arduino\libraries\SoftwareSerial-master

There does seem to be a version for the esp described here.

https://www.arduino.cc/reference/en/libraries/espsoftwareserial/

Installing a library can be done via Library Manager. In the manager you will see the latest version of the library.

After you prove things are working, you then have other options if you need to use two different versions of an Arduino  library (with the same name) within different projects, but please create a new thread if you need guidance with that. Thanks



  
Back to top
WWW  
IP Logged
 
jimf
Junior Member
**
Offline


Posts: 16
Joined: May 30th, 2015
Re: missing some/all avr library
Reply #7 - Feb 13th, 2021 at 11:27pm
Print Post  
Thanks Tim.....that did the trick!  How did you know that the softwarSerial library was for AVR?  Perhaps more importently, is there a way for me to know which arduino libraries work with a given platform?  I'll probably be using AVR boards and ESP32 boards for some time to come.  Thanks again.....jim
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: missing some/all avr library
Reply #8 - Feb 14th, 2021 at 6:33pm
Print Post  
The error you could see was this:-
 
Code
Select All
The SoftwareSerial-master library encountered an unknown path resolve error.C*: 41:27: fatal error: avr/interrupt.h: No such file or directory
   compilation terminated 



I suggest cloning and then creating a shared library project with the software serial library. That way your esp project can use the SoftwareSerial library from a location of your choice, away from the documents/libraries folder. This is a feature of visual micro that allows you to avoid the limitations of arduino libraries for different architectures.

Each Arduino library contains a library.properties text file. That contains some simple definition info for the library. One property in that file is architectures=. An astrix * means any and some libraries are incorrectly marked as *. Normally you would expect to see exp32,avr if the library supports both but not others. In you case the original library should have been marked as architecures=avr or architecures=avr,sam. The new library you are using might have architecures=esp32

If a library you have installed does not appear on the "Add Library" menu that might suggest the architectures= do not match the current platform. In this case, Visual Micro will still attempt to compile #includes for the library but doesn't suggest it as a library to use.
  
Back to top
WWW  
IP Logged
 
jimf
Junior Member
**
Offline


Posts: 16
Joined: May 30th, 2015
Re: missing some/all avr library
Reply #9 - Feb 17th, 2021 at 11:30pm
Print Post  
Thx!  
I've added #define ARDUINO_ARCH_ESP32 to my code.
Seems like there are 2 scenarios....I'd greatly appreciate your comments.  Libraries below are in ...Documents\Arduino\Libraries.  Using SoftwareSerial.h as an example:

Scenario 1: SoftwareSerial-master has library properties that specifically lists supported architectures (not *) and does not include ESP32. ESPSoftwareSerial-master has library properties with ESP32, ESP8266
If my code contains #include <SoftwareSerial.h>, will the build process use the header found under ESPSoftwareSerial?

Scenario 2: Same as above except SoftwareSerial-master properties has architectures=* (incorrect).  When I build, what SoftwareSerial.h will be used?  

I'm assuming Scenario 1 would work ok and Scenario 2 would fail.  Would a fix be to add the correct header to the solution explorer Header list ?  How about specifying more of the path to the correct folder in the library. e.g. #include <ESPSoftwareSerial-master\SoftwareSerial.h>?

If there is a better way to handle this, please point me to some documentation....hoping it exists.  
Again....thank you!
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: missing some/all avr library
Reply #10 - Feb 21st, 2021 at 10:27pm
Print Post  
Ones with sepcific architectures should take priority however they are often wrong. The best solution is to add them as shared libraries to your projects. That way you select the correct library for each use. The verbose compiler output shows which libraries have been found so it is quite easy to see which libraries are used.
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint