Error importing Arduino project

Go To Last Post
62 posts / 0 new

Pages

Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Windows 10 - Arduino IDE 1.8.13 - Microchip Studio 7.0.2542

 

I'm trying to import an Arduino IDE project into Microchip Studio.

 

I am able to import the project, but when I compile it I get a long string of errors.
The same project compiled with Arduino IDE does not give any errors.

I try: Tools - Device Pack Manager - Check for Updates -> All packs are up to date

Someone can help me?

Thank you

Livio

Attachment(s): 

This topic has a solution.
Last Edited: Fri. Feb 12, 2021 - 10:33 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I suggest that you :

 

1.  start by building a proven library example in the Arduino IDE.

2.  quote example by name

3.  import into AS7.0

4.  build in AS7.0

 

Then we can replicate your problem.

I don't have a

ARDUINO_SAMD_MKRWIFI1010

 

But this should not stop me compiling.

 

From memory,   AS7.0 is not very good at "importing" SAMD21 projects.

It certainly can't import SAM3X projects (Arduino Due)

 

David.

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

Thank you David

 

I start from example: SSLClient - EthernetHTTPS

I add a line #include <Wire.h>

I can compile with Arduino IDE without errors and I save it in a new folder with name EthernetHTTPS2

 

Microchip Studio - File - New - Project Create project from Arduino sketch - OK - I select the example saved before, EthernetHTTPS2 - OK

The project, named ArduinoSketch6, is created without errors and I can see the source code.

 

Build - Build Solution -> 54 Errors

Attachment(s): 

Last Edited: Fri. Feb 5, 2021 - 11:43 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

rlivio wrote:
MKRWIFI1010

See: https://www.avrfreaks.net/forum/mkr-wifi-1010-arduino-sketch-doesnt-compile-atmel-studio

 

david.prentice wrote:
From memory,   AS7.0 is not very good at "importing" SAMD21 projects.

It certainly can't import SAM3X projects (Arduino Due)

In the other thread, I wrote:
I think it's really just intended for fairly basic "sketches"?

probably also focused on the more "mainstream" Arduinos?

 

https://www.avrfreaks.net/commen...

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

"Importing" Arduino sketches is intended for "Blinky" style projects on an AVR.   Which it manages quite well.

 

Sketches with pointers, references, ... will compile fine in Arduino IDE on AVR, ARM, ESP, ...

AS7.0 does not know how to import.   And will not compile properly even for a simple AVR.

 

The Arduino IDE is a lot more reliable than AS7.0

I have not used PlatformIO but it probably works as well as the Arduino IDE (if it has been configured correctly)

 

I have not attempted a SAMD21 Import recently.   So AS7.0 may have improved.

I might try a simple Zero (SAMD21) project tomorrow.

 

Personally,   I compile with the Arduino IDE but debug the generated ARM ELF file in Rowley Crossworks.   e.g. SAM3X or SAMD21

 

David.

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

I never use PlatformIO, but this evening I tried, I can import and compile without errors, but I have some problems to debug with Atmel-ICE,

so my conclusion is that there aren't errors in files, the problem is inside the import process from Arduino files to AS7 (Microchip Studio),

for some unknow reason some file is not imported, but I can't identify which file/files.

 

I tried to import Blink, same errors! Probably the problem is the Board/Processor

 

I have also try the plug-in Visual Micro inside Microchip Studio, but unfortunately also with this procedure I have errors, I am trying to solve with the forum in Visual Micro.

More or less some problems with Visual Studio + Visual Micro, I don't find a solution until now.

 

My target is to develop software in C++ using the Arduino Library and debug with Atmel-ICE (or I can consider to buy a different debugger), any suggestion?

 

I don't know Rowley Crossworks, I will look.

 

Thanks to all

Livio

Last Edited: Sat. Feb 6, 2021 - 02:16 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

rlivio wrote:
my conclusion is that there aren't errors in files, the problem is inside the import process from Arduino files to AS7 (Microchip Studio)

Which is exactly what David said above, and I said in the other thread.

 

for some unknow reason some file is not imported, but I can't identify which file/files.

It's probably not (just) about some files - but also about the project settings

 

I tried to import Blink, same errors! Probably the problem is the Board/Processor

Exactly the same in the other thread; which takes us back to the first point - if the simplest "sketch" won't import properly, there's no point trying anything more complicated!

 

 

I have also try the plug-in Visual Micro inside Microchip Studio, but unfortunately also with this procedure I have errors, I am trying to solve with the forum in Visual Micro.

It would be helpful to post a link to that thread - clearly you are not the only one having this issue

 

My target is to develop software in C++ using the Arduino Library and debug with Atmel-ICE (or I can consider to buy a different debugger), any suggestion?

Why do you feel the need to avoid the Arduino IDE?

 

Or, if Microchip Studio is your key thing, perhaps it would be easier to just work from scratch - rather than import Arduino libraries?

 

Or do the porting manually?

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...
Last Edited: Sat. Feb 6, 2021 - 10:29 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

rlivio wrote:
I get a long string of errors

Actually, I think there are only two distinct errors:

  1. str... functions and mem... functions are not declared;
  2. SPI.h file is not found.

 

The first one suggests that you a missing a #include of string.h

 

The 2nd one could be an Include Path issue.

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

david.prentice wrote:
I compile with the Arduino IDE but debug the generated ARM ELF file in Rowley Crossworks

Similarly, you should be able to debug the ELF in Microchip Studio.

 

 

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

High awneil,

I obviously have the same problem as you. I'm using an Arduino WiFi 1010.

 

My experience is that if you add the string.h or cstring.h AS7 will produce even more compiler errors!

Also adding SPI.h didn't solve my problem...

 

Juergen

AckerSchnacker

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

jr1952 wrote:
I obviously have the same problem as you

No, it's not my problem - see the other thread.

 

My experience is that if you add the string.h or cstring.h AS7 will produce even more compiler errors!

Which is exactly as reported in the other thread - have you read it yet?

 

Also adding SPI.h didn't solve my problem...

it would solve the problem of not finding that header, but that was just one of the things in your build report - it would obviously not affect any of the missing str... and mem... declarations

 

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

I am trying to create a project in Microchip Studio with all the files used in ArduinoIDE inside Microchip Studio.

I found on github some files (https://github.com/arduino/Ardui...).

I took the files and put them into the project, but now I am stopper with errors: "strcpy was not declared in this scope" and many other: memcpy, strcmp etc. 

Where could these functions be? Inside some object files? Inside the compilator? 

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

rlivio wrote:
"strcpy was not declared in this scope"

That's a basic C (or C++) error.

 

You can look up in your C (or C++) reference where those standard library files are declared.

 

eg,

 

https://www.cplusplus.com/reference/cstring/strcpy/

 

Or just see #8.

 

Here are some C learning & reference materials for you:

 

https://blog.antronics.co.uk/2011/08/08/so-youre-thinking-of-starting-with-c/

 

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...
Last Edited: Sat. Feb 6, 2021 - 01:59 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Now I have a project in Microchip Studio derived from the Example Led Blink for the board MKRWiFi1010, I can upload and debug  with Atmel-ICE on the board and it RUN. (if anyone wants to have it I can post a zip).

 

If I need a library I can drag the files, usually found on GitHub, directly inside the Solution Explorer of this project.

This usually works.

To move forward with my project I need to add the library for I2C (Wire), but this library is very rooted inside the package of Arduino IDE, if i try to drag inside my project the files Wire.h and Wire.cpp they 
need other file that need other file that need other files ... I'm lost.
I would like to try to put all the Arduino files back into the project. Crazy? May be.

I found on GiyHub some collections, but from these is missing strcpy etc. probably because these aren't in source file.

I am working on it.

 

 

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

Hi rlivio,

...sounds optimimistic, could you please provide a zip of your LedBlink, than I would try it with my project(s)

Thanks in advance

Juergen

AckerSchnacker

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

I am not very far from the solution to have a base project in Microchip Studio for MKRWiFi1010

Now I have some errors about missing declaration of: strcpy, strlen, memcpy, memcmp, strstr, memmove etc.

 

any idea where to find them?

 

Last Edited: Sat. Feb 6, 2021 - 04:24 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sorry, no! I already tried with the C/C++ standard libraries <string.h>. But I also noticed that a different String.h is already part of the automatically generated core-project. So I suspect that there are differences between the standard C-library and String.h. Does anybody know mre about it!

juergen

AckerSchnacker

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

Ok Juergen

I can't put the file here, is more than 10Mb.

You can download from www.girocorto.it/file.htm

try it and let me know, but don't ask me hard questions, i am not an expert.

You can find also the version with errors, have a look, I don't know how to fix.

 

 

My starting point is the project Blink, I can compile, upload and run.

Unfortunately the project is not complete with all the Arduino files, when I tried to convert a more complete project then I was unable to compile it.
So starting from that project, with all the right settings, I deleted all the Arduino core files and replaced them with the ones I found in the folder

C:\Users\livio\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.11

I remember that I am trying to have a project for Arduino MKRWiFi1010 board, SMD21 processor
I had to work hard to fix them all, but in the end I was able to compile it without missing file errors, but strcmp errors etc. remained.
At this point I don't know what to do anymore.

 
I want to use Microchip Studio because I'm not that good at writing and I need a good debugger, I have Atmel-ICE that I've worked with and I'm fine with, this is why I don't want to use ArduinoIDE.

 

Livio

Last Edited: Sat. Feb 6, 2021 - 05:57 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
It would be helpful to post a link to that thread - clearly you are not the only one having this issue

 

The forum is https://www.visualmicro.com/forums/

search for "Livio" and you can find all my post and answers, but at now I don't have a solution with Microchip Studio + Visual Micro or with Visual Studio + Visual Micro, I'm still working on it.

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

awneil wrote:

Actually, I think there are only two distinct errors:

  1. str... functions and mem... functions are not declared;
  2. SPI.h file is not found.

 

The first one suggests that you a missing a #include of string.h

 

The 2nd one could be an Include Path issue.

 

#include of string.h ? If i put this in sketch.cpp no solution. In other files? But are files from Arduino, not edited by me.

 

No more error on SPI.h

 

I start from a working project and I just replaced the files, all Microchip Studio settings should have remained those of the working project ... unless ... if I don't use strcpy etc. in the Blink project. optimization may have excluded from compiling files (?) I will try next night.

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

Hi Livio,

of course no hard questions cool, only experts can ask hard questions...

 

I tried your blink example and it compiled successfully on my installation!

So obviously the original arduino SAMD21 library has to be used. The one provided by Microchip seems to have errors!

 

A question to all the other experts: Instead of manually copying the files from the arduino library, wouldn't it be easier to change the project settings manually using a different include path? So I (tomorrow) will try to use:

 

C:\Users\<username>\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.11\cores\arduino

 

instead of $(ProjectDir)\...\core\samd21

 

I'll let you know...

 

AckerSchnacker

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

rlivio wrote:
#include of string.h ? If i put this in sketch.cpp no solution. In other files? But are files from Arduino, not edited by me.

Again, this is basic C stuff - and the same in C++

 

The language requires that a thing must be declared before it is used.

 

string.h provides those declarations - so you must include it in any file which uses any of the functions it declares.

 

 

 

 

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

.. sorry, I just noticed that rlivio already changed the settings in the AS 7 Toochain->Directories dialog using the -I-directive. So I will try with a more interesting application example using the WIFINina library.

 

And..., of course that is basic C/C++ stuff, but ist doesn't help to include standard C-librariess/header-files like <string.h> if the (arduino example) requires different libraries which are not supported by the autogeneratde AS7 core-application.

Juergen

AckerSchnacker

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

awneil wrote:

Again, this is basic C stuff - and the same in C++

 

The language requires that a thing must be declared before it is used.

 

string.h provides those declarations - so you must include it in any file which uses any of the functions it declares.

 

Yes I know, but as I said I did not write the software, it comes from Arduino IDE, so I don't think only some #define is missing, I think there are some files or some inclusion at the makefile level, but I had taken a project that worked so I was hoping that all the compilation directives were correct.

I just don't know what to think. I keep working on it.

 

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

jr1952 wrote:
I tried your blink example and it compiled successfully on my installation!

 

Great !   It is the first time that I put something on the net instead of always taking.smiley

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

rlivio wrote:
it comes from Arduino IDE

And one of the things that the Arduino IDE manages for you is getting the #includes right.

 

You're going to need to know how to do that yourself if you want to move to a "conventional" IDE like Microchip Studio.

 

Which brings us back to the question:

Why do you feel the need to avoid the Arduino IDE?

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

awneil wrote:
Why do you feel the need to avoid the Arduino IDE?

 

I have nothing against the Arduino IDE, it's an exceptional tool, and says one who has started writing in Assembler for the Motorola MC6800, writing directly in machine code and calculating program jumps by hand,

The Arduino IDE has allowed many people to approach programming by making it easy what is absolutely not easy: writing only two instructions and turning on a LED,
without having to worry about everything behind is needed to start a microprocessor.
But it has its limitations. First of all, the unavailability of a hardware debugger such as the Atmel-ICE.
I am convinced that the availability of libraries is exceptional, and that is why I am trying to put the two together taking the best of each.

I've been using Atmel Studio for some years, with Atmel-ICE, to develop my programs on my boards, that use the same Arduino processors, in order to use libraries available on internet,
how a builder uses bricks, made by someone else, to build houses.

Now stop talking we have a job to do. smiley

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

in Wire.h there are two lines:

 

    // RX Buffer

arduino::RingBufferN<256> rxBuffer;
 

    //TX buffer
arduino::RingBufferN<256> txBuffer;

 

If I compile I get a series of errors, see attached file.

 

Can someone help me to fix?

 

if I change  those lines in

 

    // RX Buffer

  RingBufferN<256> rxBuffer;
 

    //TX buffer
  RingBufferN<256> txBuffer;

 

I can compile WITHOUT errors.

I do not think it is wise to modify these lines, but this indication could be useful to understand how to fix the errors.
I can't understand the meaning of arduino::  something related to  namespace arduino; at the beginning of the file

Attached the file Wire.cpp and Wire.h that come from Arduino package SAMD Version 1.8.11

 

 

... the more I think about it the more it seems right to remove arduino :: but I'm not sure.

 

Tomorrow, no today, I will write some code to use the I2C bus and i will check if it works.

 

Attachment(s): 

Last Edited: Sun. Feb 7, 2021 - 01:39 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Suppose it's ok to delete arduino:: from the above line.

Now I can compile and upload to the board and the led flash.

 

What I have done succesfully in the past is to search for a library and insert it into my project.

 

Well. To test the I2C bus I could connect an MCP23017 and drive a led on this chip.

 

Ok. I have the library MCP23017.cpp MCP23017.h I insert it -> Compile -> ERRORS !!!

 

In short I noted a difference between the library Wire.cpp .h taken from the package for the board MKRWiFi1010 and the same name library I used before:

 

All the text in Wire.h is enclosed inside namespace arduino { ... } and in Wire.cpp there is, at the top: using namespace arduino;

Inside MCP23017 I don't have this. If I modify this library adding namespace arduino { ... } in MCP2307.h and using namespace arduino; in MCP23017.cpp I can compile without errors.

 

I don't know what it means and what it's for ... I have to study.

 

Last Edited: Sun. Feb 7, 2021 - 10:22 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jr1952 wrote:
 I suspect that there are differences between the standard C-library and String.h.

Indeed.

 

'C' doesn't really have a proper string type - they are just char arrays, with the requirement of a NUL terminator.

 

The C++ String (capital 'S') class is, indeed, a different thing:

 

https://www.cplusplus.com/reference/string/string/

 

I'm not sure if the Arduino String (again, capital 'S') class differs:

 

https://www.arduino.cc/reference/en/language/variables/data-types/stringobject/

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

rlivio wrote:
the unavailability of a hardware debugger

 

Have you looked at the Arduino Pro IDE ?

 

https://www.avrfreaks.net/forum/arduino-pro-ide-alpha-now-available

 

What is the state of that now?

 

 

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

rlivio wrote:
I don't know what it means and what it's for ... I have to study.

Indeed.

 

https://en.cppreference.com/w/cpp/language/namespace

 

It would probably be a good idea to get up to speed with C++ on a PC first.

 

Then, when you have a good grasp of the language itself, it'll be easier to see & understand what's going on here.

 

 

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

 

Thank you, I will look.

 

Good news, the project is now working also with the library Wire.

 

Last Edited: Sun. Feb 7, 2021 - 03:19 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
Have you looked at the Arduino Pro IDE ?

 

Yes, but the first impression did not impress me, but in truth I didn't spend much time on it.
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

rlivio wrote:

in Wire.h there are two lines:

 

    // RX Buffer

arduino::RingBufferN<256> rxBuffer;
 

    //TX buffer
arduino::RingBufferN<256> txBuffer;

 

If I compile I get a series of errors, see attached file.

 

Can someone help me to fix?

 

if I change  those lines in

 

    // RX Buffer

  RingBufferN<256> rxBuffer;
 

    //TX buffer
  RingBufferN<256> txBuffer;

 

I can compile without error.

 

And about this change? Do you think is ok? 

I will also try to ask on the site where I got that library.

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

rlivio wrote:
I will also try to ask on the site where I got that library.

Presumably the way all the Arduino "framework" hangs together is documented somewhere ... ?

 

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

 
I am still working on the idea of ​​creating a basic project, in Microchip Studio, for the Arduino MKRWiFi1010 + MKR ETH Shield.
The works are progressing well, now I have imported the libraries: Wire, SPI and Ethernet, as soon as finished I will make the project available.

Livio

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

to awneil

 

I have finish to work, I have a project in Microchip Studio for the board MKRWiFi1010, some library are included: Ethernet (MKR ETH Shield or USR-ES1), WiFi NINA, SPI and WIRE (I2C bus).

Do you think it can be useful? 
Would you like to take a look at it?
Do you have the time and the desire to see if we can make it public?
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

rlivio wrote:
I have finish to work

Congratulations! Time to mark the solution, then.

 

rlivio wrote:
Do you think it can be useful?

It would probably be useful to the other 2 people who have started threads on this recently?

 

EDIT: https://community.atmel.com/comm...

 

see if we can make it public?

Why not just attach it here?

 

I don't have any  MKRWiFi1010 - so no particular interest here.

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...
Last Edited: Tue. Feb 9, 2021 - 10:17 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

The file is too big to post here, is 44Mb, you can found it Here

 

The library are inside.

What I don't like is that I had to make changes to the libraries:

I remove all occurence of namespace arduino and arduino:: otherwise there was a lot of errors that I can't remove.

 

there is also. Warning    Command Line Exceeds Limit libArduinoCore.a 

I don't know how to remove, but it's only a warning, I think if someting is missing it would have been an ERROR

 

Surely it could have done better, I have done my best.

I know I still have a lot to learn, but this project will serve me as a starting point with this board and the SAMD21 processor.
What worries me is that, without having written anything, half of the memory is already occupied, both, RAM and FLASH.

There is a small menu on the Terminal to check some functions, inside arduino_secrets.h must be entered name and password of WiFi network.

 

Let me know ... good job

 

Livio

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

For the family album.

 

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

Would be more useful to mark the one where you gave the link to the code as the solution - that's what people will be looking for!

 

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...
Last Edited: Tue. Feb 9, 2021 - 12:06 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
Perhaps you could have created your own namespace called "arduino" ?

 

No, I never see before the word namespace, looking at your link some post before I see:

 

Namespaces provide a method for preventing name conflicts in large projects.

Symbols declared inside a namespace block are placed in a named scope that prevents them from being mistaken for identically-named symbols in other scopes.

So I simply remove all the namespace reference, so now I don't have different spaces, and I was lucky thah no identically-named errors appeared.

 

By making the command-line shorter!

I don't know how. I put all the project, named MKRWiFi1010, in a folder on D:\MS,  shorter than this?

Probably isn't a problem about directory name. 

Command line generated by Michochip Studio? Maybe we need to dig into it.

After working for three days untill 3AM I am satisfied to see no more errors ... I can accept a warning.wink

Last Edited: Tue. Feb 9, 2021 - 12:06 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Would be more useful to mark the one where you gave the link to the code as the solution - that's what people will be looking for!

 

Ok, done

I was thinking the solution was linked to the all thread not to single post.

Is the first time I found a solution.surprise

Last Edited: Tue. Feb 9, 2021 - 12:15 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks rlivio, that sounds good...

 

But obviously you use an Atme-ICE??? programmer. So you don't create a binary-file * MKRWiFi1010.bin in your Debug directory.

That's exactly what those people need who wish to program with bossac.exe (as used in the Arduino IDE).

So my question: How can I create a *.bin file ???

 

I already tried:

 

arm-none-eabi-objcopy -O binary <filename>.elf <filename>.bin

 

This created the bin file but when I loaded it to the MKR WiFi 1010 the board died and lost its USB-port in the Windows device manager (Luckily for me that I could wake it up by pressing the reset button for a long time and restarting the device manager ...huh...)

 

I used bossac as follows: I copied bossac to a different directory and used it as follows:

 

1st step: erase the memory on a different COM-port

mode COM4:1200,n,8,1

 

2nd step program using bossac using my COM6:

"C:\Program Files (x86)\bossac\bossac.exe" -i -d --port=COM6 -U true -i -e -w -v -R %BINFILE%

 

where %BINFILE% is my binary file.

 

Any help is welcomed

Juergen

 

 

 

AckerSchnacker

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

jr1952 wrote:
But obviously you use an Atme-ICE???

 

Yes I am using Atmel-ICE and Microchip Studio.

When I load the software with this, the bootstrap is erased.

If I need to restore the bootstrap I use:

ArduinoIDE -Select the board MKRwiFi1010

ArduinoIDE - Tools - Programmer: Atmel-ICE

ArduinoIDE - Tools - Write Bootloader

Press two times the reset button, the bootloader starts and the BUILT_IN led fade-in fade-out

This is my way of working.

 

So you don't create a binary-file * MKRWiFi1010.bin in your Debug directory

No I don't have a binary file in Debug directory

That's exactly what those people need who wish to program with bossac.exe

Sorry, I never heard of bossac.exe

 

So my question: How can I create a *.bin file ???

Sorry, I don't have an answer now.
I'll do some testing to understand how to create the binary file and let you know.

 

Livio

Last Edited: Wed. Feb 10, 2021 - 06:10 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

With this setting I have a .bin file in folder D:\MS\MKRWiFi1010\MKRWiFi1010\Debug

 

Try and let me know.

Attachment(s): 

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

Hi rlivio,

thanks for digging in that problem. Ye,s I now was able to create the bin-file (I left the other checkkboxes unchecked, becaus theye aren't needed as I think).

 

For your information: bossac.exe is a program which loads *.bin files via the USB-Port to samd-devices. It is used in the Arduino IDE and Atmel-ICE is not required. So it should be interesting for a lot of users.

 

But when I load the MKRWiFI1010.bin-file that was generated by AS7 in the ..\Debug folder the Windows device manager looses connection to the MKR-WiFI1010 board! Only after pressing the reset button for long time and reconnecting the USB-cable a new connection was established to the Windows device-managerangry.

This is NOT the case if I use the same procedure for a *.bin file which was generated with the Arduino IDE.

 

So I used your project where I  replaced your sketch.cpp against myBlink.cpp which is the standard blink example fpr the LED_BUILTIN. I did two implementations:

- using the Arduino-IDE generated a bin-file with size 12kB

- using the AS7-IDE the size of the bin file was 115kB which is a huge difference!

The log Files that were created by bossac during download showed this big difference: The Arduino design wrote 12044 Bytes to the flash, wile the AS7-design required 116980 Bytes!

Both logfiles have been attached because I couldn't see any significant differences for the two binaries.

 

So I conclude that not only the size but also the startup behavior is different for the Arduino- and AS7-binaries. At least if the USB download is used. So I consider #40 to be not (yet) a correct solution of the problem to generate binary files for the MKR WiFi1010 using the AS7-IDE.

 

Hope anybody else has an idea to solve that problem...

Juergen

 

Attachment(s): 

AckerSchnacker

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

Hi Juergen

 

jr1952 wrote:

- using the Arduino-IDE generated a bin-file with size 12kB

- using the AS7-IDE the size of the bin file was 115kB which is a huge difference!

Yes, Arduino IDE includes only the libraries that are used in the sketch, and Blink uses very few, so the bin file is very small.

My project, in AS7 IDE, includes ALL the library that are inside the project, in the Solution Explorer window, not just the used ones.

One solution can be to remove from the project libraries not needed.

 

But when I load the MKRWiFI1010.bin-file that was generated by AS7 in the ..\Debug folder the Windows device manager looses connection to the MKR-WiFI1010 board!

Yes because the sketch, in my setup, is allocated at the beginning of the flash, ERASING the bootloader.

So I conclude that not only the size but also the startup behavior is different for the Arduino- and AS7-binaries.

Surely. My proposed setup is different from yours.

I want to use Atmel-ICE for a seriously debugging, so I have erased the bootloader and I use Atmel-ICE to load the program on the board, no need USB and therefore it is not possible to load the sketch with bossac.

After, and only after, the sketch on the board starts, the USB can be used, in fact only when the sketch starts I hear from the PC a beep that report to me that a new USB device is connected, at this time, not before, I open a Terminal on PC (Tera Term or similar) and I can communicate with the board.

 

All this my work is started to use Microchip Studio + Atmel-ICE on MKRWiFi1010, including libraries that will be useful to me later, any other configuration is uncharted terrain.

 

Bye

Livio

 

P.S. I am still working on this project adding other libraries.

 

 

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

Dear all

 

Thank you very much for this discussion!

 

I'm jumping to this because I have the exact same problem with with the most minimal "blink.ino" configuration and a MKRZERO.
I locate the problem with the default libraries, which are not being filed properly at all with the current import function.

 

Is it correct to summarize the current state of the threads

 

https://www.avrfreaks.net/forum/mkr-wifi-1010-arduino-sketch-doesnt-compile-atmel-studio

 

https://community.atmel.com/forum/error-importing-arduino-project

 

that you have to assemble the project manually and the import function of the current Microchip Studio version definitely does not work for the SAMD projects?

 

Cheers,

Chris

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
I was looking for a solution, I did't find it and so I started working to create it.

My solution is here, in this thread: https://www.avrfreaks.net/comment/3086531#comment-3086531

 

It works for me, with Microchip Studio - Atmel-ICE - MKRWiFi1010 (SAMD21 processor)

 

I will post, probably later today, a new project with more libraries included.

 

For me is now a good point to start to write code for this board, certainly the memory is already half full, but if not needed, some libraries can be easily removed.

 

Bye

Livio

Pages