Error importing Arduino project

Go To Last Post
62 posts / 0 new

Pages

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The last version of my project, too big to be attached here, can be downloaded HERE

 

I hope it will be useful.

 

Livio

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Thank you very much! You have done a great job!

I tried to find out, why the import of Arduino SAMD sketches does not run with the latest version of the tool chains (Microchip Studio 7.0.2542, Arduino SAMD Boards 1.8.11) and maybe the following could be a reason.

 

When searching for issues with the basic string library (strlen, memcpy, etc) I've found this post here:

https://github.com/arduino/Ardui...

 

The "String.h" may be the cause for the failure, when import a an Arduino sketch with latest versions of Arduino ARM package into Microchip Studio.

 

As soon as I replace "String.h" with "WString.h" and rename every occurrence in the solution

  C:\{my project path}\ArduinoCore\ArduinoCore.cppproj(339):    <Compile Include="include\core\api\deprecated\WString.h">
  C:\{my project path}\ArduinoCore\ArduinoCore.cppproj(378):    <Compile Include="include\core\api\WString.h">
  C:\{my project path}\ArduinoCore\include\core\api\deprecated\WString.h(19):// including WString.h is deprecated, for all future projects use Arduino.h instead
  C:\{my project path}\ArduinoCore\include\core\api\deprecated\WString.h(23):#include "../String.h"
  C:\{my project path}\ArduinoCore\include\core\api\ArduinoAPI.h(35):#include "WString.h"
  C:\{my project path}\ArduinoCore\include\core\api\IPAddress.h(24):#include "WString.h"
  C:\{my project path}\ArduinoCore\include\core\api\Print.h(24):#include "WString.h"
  C:\{my project path}\ArduinoCore\src\core\api\String.cpp(22):#include "WString.h"

 

and add the missing dtostrf.c.impl in the folder

  C:\{my project path}\ArduinoCore\include\core\api\deprecated-avr-comp\avr

 

the solution compiles and I can debug with my Atmel-ICE debugger ;-)

 

I will try and reproduce that all on an other machine/installation and with another Arduino project tomorrow and come back.

 

Best, Chris

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

GREAT !!!

 

It works with Blink example.

 

I take the file   dtostrf.c.impl  from: C:\Users\<userName>\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.11\cores\arduino\api\deprecated-avr-comp\avr

If you had posted this solution earlier I would have saved three sleepless nights  crying... however something I have learned.

 

Thank you

Livio

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As promised I checked the workaround with two other (randomly selected) examples:

 

Prerequisites: Microchip Studio 7.0.2542, Arduino SAMD Boards 1.8.11

 

Case 1: Arduino MKR WAN 1310 with example LoRaSendAndReceive.ino

    - works with the suggested replacement of all "String.h" by "WString.h"  and rename the file String.h in the folder C:\{ my project path}\ArduinoCore\include\core\api

    - copy the file dtostrf.c.impl  from: C:\Users\<userName>\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.11\cores\arduino\api\deprecated-avr-comp\avr 

       to   C:\{my project path}\ArduinoCore\include\core\api\deprecated-avr-comp\avr

   ==> compiles without error messages

 

Case 2: Arduino MKR NB 1500 with example GPRSUdpNtpClient

    - apply the modifications from above

 

    => new 8 errors observed:
            Error        reference to 'UDP' is ambiguous   

            Error        recipe for target 'src/libraries/MKRNB/NBUdp.o' failed

            ...etc....

    The reason is that in the libraries for ArduinoCore the include file Udp.h is available 3 times!

         \ArduinoCore\include\core\Udp.h  and

         \ArduinoCore\include\core\api\Udp.h  and

          \ArduinoCore\include\core\api\deprecated\Udp.h

        

     -  when I rename \ArduinoCore\include\core\Udp.h to MyUdp.h

     ==> the solution compiles without error messages

 

Maybe one of the Arduino guys can help, why that is not an issue when running the project from the Arduino IDE. I've checked several compiler option with Microchip Studio but without success.

 

My conclusion is that with the transition of the former Arduino SAMD Boards packages to "Arduino API" concept as included in Arduino SAMD Board 1.8.11 there may be more issues when importing sketches to Microchip Studio that must be solved manually.

 

But at least basic imports work with the "String.h" and dtostrf.c.impl workaround described above

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ChrisEbi wrote:
Maybe one of the Arduino guys can help

You'd have to go to the Arduino forums to find them:

 

https://forum.arduino.cc/

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Chris,

referring to your solution I have a few questions because I think I didn't get it correctly. I'm referring to your notes:

 

As soon as I replace "String.h" with "WString.h" and rename every occurrence in the solution

 

What exactly did you do: Did you rename (or delete) the existing String.h in ../core/api and copied Wstring.h from ../core/api/deprecated/WString.h to ../core/api/WString.h or did you copy this as ../core/api/String.h or what exactly did you do?

 

  C:\{my project path}\ArduinoCore\ArduinoCore.cppproj(339):    <Compile Include="include\core\api\deprecated\WString.h">
  C:\{my project path}\ArduinoCore\ArduinoCore.cppproj(378):    <Compile Include="include\core\api\WString.h">

 

So did you make two changes change in the cpproj-project configuration file ??? (I halso have two references, but on different line numbers)

  C:\{my project path}\ArduinoCore\include\core\api\deprecated\WString.h(19):// including WString.h is deprecated, for all future projects use Arduino.h instead

This occurence is only comment so its change is not mandatory?

C:\{my project path}\ArduinoCore\include\core\api\deprecated\WString.h(23):#include "../String.h"

So here you leave the reference to String.h?

  C:\{my project path}\ArduinoCore\include\core\api\ArduinoAPI.h(35):#include "WString.h"
  C:\{my project path}\ArduinoCore\include\core\api\IPAddress.h(24):#include "WString.h"
  C:\{my project path}\ArduinoCore\include\core\api\Print.h(24):#include "WString.h"
  C:\{my project path}\ArduinoCore\src\core\api\String.cpp(22):#include "WString.h"

So I assume the solution requires a reference to WString.h in all four files. Is that correct?

 

By the way: I found a (simple) solution to use the USB download also for the MKR WiFi 1010 board. Now I wish to gather all information to put them into a PDF-guidline which explains how to import Arduino sketches and download those to the MKR WiFi 1010 board using the USB-cable.

AckerSchnacker

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

With all the required "Wstring.h" corrections I was able to compile and run a basic (blink) Arduino import project on the MKR WiFi1010 board.

Next I imported a WiFiNINA based project from Arduino to a new Atmel Studio project, did all the required WString.h modifications as required and finally noticed that the WiFiNINA libraray was not imported at all!

 

Before I was able to run rlivios example design (see #40) which alreday solved that problem but in a different way (removing the arduino namespace).

I also tried to add the WiFiNNA libraray to the Arduino core using "project-> Add existing item" or "Add Arduino library" all attempts caused a number of compiler errors!

 

So my question: Does anybody know how to successfully add the WiFiNINA librarie for the MKR WifI1010 board?

 

Any help is welcomed (before I finally give up to use Atmel Studio for the MKR WiFi 1010 board ...)

AckerSchnacker

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Look at this: https://gojimmypi.blogspot.com/2018/12/swd-debugging-arduino-mkr-wifi-1010.html

and https://github.com/gojimmypi/MKR-WiFi-1010

 

I add some notes at the end of the page of gojimmpi because I need some changes to work.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

One additional remark for those people who want to run Jimmys example without Atmel-ICE but via USB download: Simply select the

 

-Tflash_with_bootloader.ld

 

linker script in the Linker options. Then it can be downloaded using bossac.exe without overwriting the bootloader at address 0x00000

 

Also I tried to recap all the steps to include the spi and WiFININA libs in my own basic MKR WiFI1010 project. It's a real nightmare: the pathes and directories are different if you start with an actual arduino project or if you start with Jimmys WiFiNINAWIFISSLClient. So I'll give up to create my own basic project!

Anyway thanks again rlivio

AckerSchnacker

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The root of this problem is that Windows by default does not respect filename case sensitivity. Thanks to the Arduino team's decision to rename 'WString.h' to 'String.h' (in newer core packages), Windows gets confused between 'String.h' and 'string.h'.

 

While it is possible to laboriously rename references back to WString, every time you import a new project (as suggested by ChrisEbi), this is not necessary if you enable case sensitivity on the Atmel Studio 7 default projects directory.

In my case (Windows 10 Pro) this is "C:\Users\jon\Documents\Atmel Studio\7.0". Thankfully, having done this, all sub-directories recursively inherit the case sensitivity setting. So new projects will be setup correctly by default.

 

Note; this method doesn't automatically update existing projects, the directory needs to be empty. But if you move your existing projects, do the following command, then copy them back, you should be fine.

 

Using Powershell (as Administrator), run

PS> fsutil.exe file setCaseSensitiveInfo "C:\Users\jon\Documents\Atmel Studio\7.0" enable

 

Hopefully this is usefully to new punters. I have to tell you it was a real drag having the import procedure fail on my first attempt at using Atmel Studio 7

Thanks to all here that helped me find this solution.

Last Edited: Sat. Mar 26, 2022 - 02:43 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Worked for me. I had to use this command in powershell first: Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

 

After restart, your command worked:  fsutil.exe file setCaseSensitiveInfo "C:\Users\<your userid>\Documents\Atmel Studio\7.0" enable

 

 

I then had to edit, dtostrf.c to fix it up.

 

After that, it compiles.

 

Thanks!

Pages