Posted by ChrisEbi: Fri. Feb 12, 2021 - 03:36 PM(Reply to #52)
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:
Posted by rlivio: Fri. Feb 12, 2021 - 03:56 PM(Reply to #53)
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 ... however something I have learned.
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
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?
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?
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.
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 ...)
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!
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.
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.
The last version of my project, too big to be attached here, can be downloaded HERE
I hope it will be useful.
Livio
- Log in or register to post comments
TopThank 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
- Log in or register to post comments
TopGREAT !!!
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
... however something I have learned.
Thank you
Livio
- Log in or register to post comments
TopAs 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
- Log in or register to post comments
TopYou'd have to go to the Arduino forums to find them:
https://forum.arduino.cc/
Top Tips:
- Log in or register to post comments
TopHi 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
- Log in or register to post comments
TopWith 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
- Log in or register to post comments
TopLook 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.
- Log in or register to post comments
TopOne 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
- Log in or register to post comments
TopThe 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.
- Log in or register to post comments
TopWorked 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!
- Log in or register to post comments
TopPages