Atmel Studio 7 - Create project from Arduino sketch - Page 1
Forum section: electronics / general

author: Gixy
author_rank: Regular Contributor
timestamp: June 21, 2016, 03:41:28 pm
content: Hi all,Now that Microchip owns Atmel, I thought it was a good idea to look at the development framework of these MCUs. The opportunity was given to me with the modification of the rework station 858D+ done by madworm and wguibas (Robert and Wayne) in this forum.As the re-engineered firmware was done under an Arduino sketch, I first used this environment to compile and build the binary, then loaded in the MCU (Atmega328p) with a TL866A programmer: no problem, works as expected.Then, I installed Atmel Studio 7 and tried to use the function "New project from Arduino sketch". This function creates a "solution" which contains two projects, one is the Arduino sketch, the other being the Arduino core, which contains all the libraries referenced by the sketch. This is the theory. Practically speaking, when I launch the project creation, AS7 hangs when creating the Arduino Core project and never ends. When I finally kill the process, the project directories are created, but most probably incorrectly, as if I try to build the executable, it stops immediatly with errors like "<Arduino.h> not found".I googled this problem and found some people with the same problem, but up to now I didn't find any practical workaround.The project is very simple, without external functions or specific I/O drivers: it only drives ports to manage the handle heater and fan, and a LED display.Is it known that ATmel Studio isn't as mature as MPLAB(X)? I'm an old timer Microchip user and this first experience with ATmel is not so positive...What do you think?Denis

author: ataradov
author_rank: Super Contributor
timestamp: June 21, 2016, 05:08:43 pm
content: I don't use Arduino, so I can't give you any advice on the actual question, but I have a few comments on this:Quote from: Gixy on June 21, 2016, 03:41:28 pmYou are looking at some really marginal feature, which should not even be a part of AS in a first place (IMO, of course). AS is perfectly good IDE (if you like IDEs) when used for its intended purpose.Quote from: Gixy on June 21, 2016, 03:41:28 pmWell, try to import Arduino sketch into MPLAB first

author: picandmix
author_rank: Frequent Contributor
timestamp: June 21, 2016, 07:35:56 pm
content: You need Visual Micro, just follow the instructions on this link.You do not need the paid for version which includes a debugger, the free part is enough for what you want to do.http://www.visualmicro.com/

author: dannyf
author_rank: Super Contributor
timestamp: June 21, 2016, 09:36:06 pm
content: "Is it known that ATmel Studio isn't as mature as MPLAB(X)? "AS is based on visual studio and that's a proven product. The issue you have is with the plug ins, not VS itself.Mplabx is a microchip software product and that tells you all you need to know about its quality

author: Gixy
author_rank: Regular Contributor
timestamp: June 21, 2016, 11:08:01 pm
content: Hi,My goal is not to create an Arduino project under AS7, but a normal Atmel project. So, the Visual Micro Plugin is not useful for that.There is a dedicated function "Create project from Arduino sketch", but this function doesn't work, and I'm not alone in this case. Even with the trivial "Blink" sketch the project generation doesn't work. This is why I'm wondering on the maturity of the product: what do you think of a product where what is announced as a new feature hasn't been tested at all?I'll try to find some help directly from Atmel or Atmel forum.ThxDenis

author: ataradov
author_rank: Super Contributor
timestamp: June 21, 2016, 11:12:28 pm
content: I don't know to what extent it was tested. I know that in general it works (or worked in some versions), so your specific problem may be related to your setup.Import from Arduino sketch is a gimmick feature anyway. If you want Arduino - use Arduino IDE.

author: Gixy
author_rank: Regular Contributor
timestamp: June 21, 2016, 11:19:05 pm
content: Once more, my goal is to transform the Arduino sketch into a normal Atmel project. I installed last AS7 version as well as last Arduino IDEversion. Cannot do better.

author: westfw
author_rank: Super Contributor
timestamp: June 22, 2016, 05:28:46 am
content: QuoteYou're probably suffering from differences in the directory format that Arduino has been introducing relatively recently.Which version of Arduino did you install, and what exact sketch/etc are you trying to import? (I can't find anything that is unambiguously " the rework station 858D+ done by madworm and wguibas")

author: douardda
author_rank: Regular Contributor
timestamp: June 22, 2016, 06:53:08 am
content: HiI'm not sure it's relevant in this discussion but I recently discovered (and adopted so far) PlatfirmIOhttp://platformio.org/It's not an IDE by itself but a cross platform build system for several embedded environments that integrates nicely with many code editors or IDE.DavidEnvoyé de mon GT-N7105 en utilisant Tapatalk

author: Gixy
author_rank: Regular Contributor
timestamp: June 22, 2016, 07:24:24 am
content: @westfwHi,Arduino 1.6.9 (latest version).This is the thread for the re-engineering of the 858D+ rework station:https://www.eevblog.com/forum/reviews/youyue-858d-some-reverse-engineering-custom-firmware/But anyway, even the import of the basic "blink" project is hanging. This is the ArduinoCore creation which causes the problem, not the sketch itself. This problem seems to be known but I didn't find any working workaround.ThxDenis

author: Psi
author_rank: Super Contributor
timestamp: June 22, 2016, 08:50:37 am
content: Running Arduino library/code inside AVRStudio is more of an experimental AS feature.The number of people doing it will be extremely small.I'm not surprised it gets broken by a new Arduino version.Typically if your using AVRStudio you have graduated beyond using Arduino libraries.

author: obiwanjacobi
author_rank: Super Contributor
timestamp: June 22, 2016, 10:23:00 am
content: The only thing this feature does is copy over all core arduino source files and include everything in the solution/project.You can do that by hand probably faster than wasting time with something that obviously doesn't work.

author: Gixy
author_rank: Regular Contributor
timestamp: June 22, 2016, 11:38:03 am
content: @obiwanjacobiI'll try that and see if it's so simple to do. I don't know how are arranged source files in the Arduino's directory. Thanks for this.

author: obiwanjacobi
author_rank: Super Contributor
timestamp: June 22, 2016, 12:45:05 pm
content: You'll get compile errors if you forget files, then go search for the correct file that contains the symbols that could not be found.Good luck! ;-)

author: Gixy
author_rank: Regular Contributor
timestamp: June 22, 2016, 01:50:27 pm
content: Yes, that was exactly what I hoped AS7 would do for me...

author: dannyf
author_rank: Super Contributor
timestamp: June 22, 2016, 09:52:31 pm
content: You will find that it requires a fairly good understanding of a modern mcu. Quite doable, but not easy.

author: westfw
author_rank: Super Contributor
timestamp: June 22, 2016, 09:59:09 pm
content: Converting "blink" worked for me. Built successfully, too. Eventually. W10/32 Virtual Box VM, AS 7.0.943, Arduino 1.6.9It was slow enough that I was wondering whether it had hung, but W10 is generally pretty slow in a VM...(The AS project winds up with 294KB in 57 files, 22 (!) folders.)

author: obiwanjacobi
author_rank: Super Contributor
timestamp: June 23, 2016, 05:09:46 am
content: Quote from: westfw on June 22, 2016, 09:59:09 pmYou have to respect the original file structure in order not to screw up the #includes...

author: Gixy
author_rank: Regular Contributor
timestamp: June 23, 2016, 11:27:21 am
content: Indeed, it seems difficult to do this by hand. I'd rather continue to do it like westfw. Thx guys

author: Gixy
author_rank: Regular Contributor
timestamp: June 24, 2016, 10:23:04 pm
content: Hi guys,I contacted the Atmel support for this problem and received an answer in less than 2 hours (congrats!). Two files were joined with it: arduino.dll and arduino.pkgdef to put in the Atmel Studio installation directory. Once that done, everything works !https://www.eevblog.com/forum/Smileys/default/icon_smile_thumbsup.gifI've nevertheless been obliged to modiy the original source code of the Arduino for the EEPROM functions, for which the prototypes provided by Atmel are different from those of Arduino (functions names and arguments types). I finally compared the generated .hex files, they are totally different but of quite the same size.I also installed the Visualmicro plugin and was then able to import and manage the project as an Arduino project under Atmel Studio. The generated .hex is almost the same than the original one, only 4 lines are slightly different. I don't intend to use this feature, but I wanted to try it. That way no need to modify sources.Conclusion:- there was a problem in the 'create project from Arduino sketch' function- this problem is known by Atmel and the patch is already done. Probably will it be part of the next release- Atmel support is very fast to answerBRDenis