I bought a Zero, Sketch works, how do I use AS7?

Go To Last Post
36 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I use Studio 7 for Atmel projects using the AtMega644P (30K lines of assembly language!), and I have successfully written a short test program in Sketch that runs on my new Zero. But I am at a loss as to how to build the same project in AS7. Any pointers on how to create the project, where to find the needed .h files, etc., would be appreciated. I've spent hours looking through the overwhelming amount of stuff on the web, but can't figure out how to get this thing started.

 

Brian

 

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

Don't know about anyone else but I'm not sure I understand what you are asking here?

 

Are you asking how to bring Arduino sketch code into Studio 7? The key to it all (assuming it calls Arduino library functions) is to arrange for the code in AS7 to link with libcore.a (which you build and then lift from Arduino).

 

I've only just started using AS7 and I think it maybe has a way to automate this. But if you ignore that there's been tons of threads relating to AS6 that explain how to build/lift a libcore.a manually. Needless to say they all include the term "libcore.a".

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

First off.  Do you have a Zero or an M0_Pro ?

 

You can write regular code for the SAMD21G18A cpu in AS7.   You can debug it with the onboard EDBG chip in AS7, Keil, Rowley, ...

 

If you want to build Arduino sketches in AS7,  you need to do a lot more head scratching.

i.e. add paths to libcore.a, headers etc

 

Or the "Visual Micro" might import everything for you.

 

Visual Micro worked in AS6 and provided unlimited Spam for your enjoyment.

Visual Micro does not seem to work with AS7.   Has anyone had success?   I would like to build for DUE and M0_PRO.

 

David.

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

Visual Micro does not seem to work with AS7.   Has anyone had success? 

The Atmel release notes for As7 said something about "easy import of Arduino sketches". I took that to mean something Atmel were now providing that would presumably surplant the need for Visual Micro? But having only run As7 about 3 times so far I can't say I've stumbled upon such a thing in my travels just yet.

 

(I sort of assume the idea would be you tell it where you have Arduino installed and it goes a cherry picks things like wiring.c from it? Or maybe not).

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

"easy import of Arduino sketches" just crashes on my AS7.

 

Installing VM does not work either.

 

I presume that someone has had success with AS7, Win7-64, Arduino imports.   Even if it is just for AVR.

I have given up.

 

David.

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

I'm waiting for a multi-GB download to complete so now may be the time to go and try this...

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

Oh great. So on my new Win10 machine AS7 seems to work just fine but it seems I cannot run the 1.6.7 Arduino IDE. I see the splash screen then nothing beyond that :-(

 

So I cannot run an experiment to create an Arduino sketch then try to import it into AS7.

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

To clarify, it is a Zero, not an M0-Pro. And what I am unsure of is how to start a project that will upload correctly to the Zero. Do I need to add Arduino core code, or is it attached for me like it is in Sketch?

 

With Sketch, everything is set up for me and I can start writing simple programs, hit upload, and poof, I have a working Arduino project. With AS7, I don't know what I don't know. If I create a blank C or CPP project, I don't know what I need to do to make it compile for execution on the Zero, how to upload it, nothing! Where do I start? Let's say I want to create a C project in AS7 that blinks the LED, a pretty simple Sketch project. How do I do that same thing in AS7, and how do I upload it via the USB programming port?

 

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

If you start a new project in AS7,   you will get a skeleton main() which #includes <sam.h> and calls

      SystemCoreClockUpdate();

 

The rest of the project is up to you.

 

Try it and see.

 

Oh,  after you have been using AS7,  you need to "Burn Bootloader" again when you go back to the Arduino IDE.

 

David.

Last Edited: Wed. Jan 20, 2016 - 09:40 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:

 

Oh,  after you have been using AS7,  you need to "Burn Bootloader" again when you go back to the Arduino IDE.

 

David.

 

Uh, OK, why?

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

OK, I see way to create a project "from a Sketch file", but when I define the project, the Zero board is not one of the available choices. How do I add that? In Sketch, there was a pop-up to get the latest board info.

 

Brian

 

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

Do you have IDE v1.6.x or v1.7.x ?

 

Can you select and build for a UNO ?

 

AS7 crashes on me.    I have Win7-64.  I have tried 1.6.x and 1.7.x with equal failure.

 

Do you want to build Arduino sketches or regular C / C++ projects?

 

David.

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

The IDE is 1.6.7.

 

PC is Windows 7, 64-bit. AS7 is working fine.

 

I can build for an UNO and it loads fine and compiles. No Zero in the list.

 

I am starting small - just trying to see if I can get an Arduino Sketch to run from AS7. Then I need to do the big C project which can't be done in Sketch. If I had a Zero to choose from, I think the first part would work. The C project is more confusing because I don't know what I need to include.

 

Brian

 

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

Note - I did update the Tools Pack Manager to include a SAMD21, which was successful.

 

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

How did you get your AS7 to build a sketch for a Uno ?

 

If you can get one Target to work,  it should be fairly simple to get other ones working.

 

Once you have the Tools and paths for the Zero,  it should build just like any regular C++ project.

 

David.

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

In File -> New -> Projects, there was a choice to Create a Project from a Sketch file. When you select that, it asks what Board you want to use. I picked Uno. But I need it to show Zero. I also selected the target, and it allowed me to select the SAMD21. It even updated the bootloader in the Zero. But I know that the binary code for a SAMD21 is not the same as for a Mega328. So I have to be able to select a Zero!

 

Brian
 

Last Edited: Thu. Jan 21, 2016 - 06:34 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If I select New Project -> Create C++ project from Arduino sketch

I receive a "Sequence contains no elements" message and an empty form.

 

I can populate the form with my Arduino installation directory, board, device and sketch location.

As soon as I click [Ok] or [Cancel] AS7 goes opaque and restarts.

 

I presume that the "Create C++ project from Arduino sketch" is expecting to find some files or settings.  

Does anyone know what it should look for or what I am missing?

 

I would like to build a sketch for Due or Zero but I am happy to just start with a Uno.

 

David.

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

Here is a screen shot of my options when I click New Project. It works fine. I have used the Tools->Extensions and Updates menu to make sure I have a lot of Arduino-related stuff installed.

 

 

Brian
 

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

I can download the Visual.Micro.Atmel.Studio.vsix file and set the VSIX installer to

C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\VSIXInstaller.exe

 

If I try running the vsix file,  nothing appears to happen.

 

David.

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

w0dz wrote:
Here is a screen shot of my options when I click New Project.

Have you added "Visual Micro" from the extension gallery then? My AS7 new projects dialog looks the same as your EXCEPT that I don't have that very last entry.

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

All right gang, I am still having troubles. I can create a C project for the SAMD21. But that is not an Arduino Zero. It's a SAMD21. There are no programmer tools available. No choice of USB port. I can also import a Sketch that works on the Zero, but I do not have a choice of Arduino Zero to cross compile it against. Only ATMega processors. When is the Zero going to be supported in AS7?

 

Or am I missing something?

 

Brian

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

A Zero would be a convenient hardware target. So would any of the SAMD21xxxx Xplained. Or a bare SAMD21 chip.

They will run the same binary code. You select the chip in AS7.

From a cost and convenience point of view, you could do your development on a Due clone.
FRDM or NUCLEO boards are very cheap and have loads of example code. And they run MBED.
Of course they are not Atmel chips. They will be easier than ASF.
David.

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

david.prentice wrote:
Oh, after you have been using AS7, you need to "Burn Bootloader" again when you go back to the Arduino IDE.
Is there a way to program the arduino Zero from within AS7 without using the arduino sketch and/or additional hardware?

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

Yes, AS7 programs the Zero's SAMD chip through the EDBG via its SWD interface.

You just develop your programs in the usual way on AS7. Select EDBG as the Tool.

After you have finished with AS7 and want to use the Arduino IDE, burn the Bootloader.
If you never use the Arduino IDE, you do not need the bootloader.

David.

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

david.prentice wrote:

Yes, AS7 programs the Zero's SAMD chip through the EDBG via its SWD interface.

You just develop your programs in the usual way on AS7. Select EDBG as the Tool.

After you have finished with AS7 and want to use the Arduino IDE, burn the Bootloader.
If you never use the Arduino IDE, you do not need the bootloader.

David.

 

That is awesome, I may just get myself one, simply as a dev board. Can the Due also be programmed through AS7 without additional hardware?

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

No, you nèed an ATMEL-ICE or other JTAG/SWD debugger with a Due. I guess that any brand of demo ARM board debugger will work.

The Zero has its own EDBG chip on the board but has only got a limited amount of GPIO.

A NUCLEO or FRDM have sufficient GPIO and onboard debuggers but are not Atmel.

David.

p.s. note that the mini-ribbon and connectors will cost you more money than buying a whole NUCLEO.

Last Edited: Sat. Jan 30, 2016 - 07:08 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:

A NUCLEO or FRDM have sufficient GPIO and onboard debuggers but are not Atmel.

 

Would you recommend them? How is their support and forums?

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

You have access to thousands of MBED projects. The common form factor encourages examples. Just like an Arduino. They accept Uno shields.
The chip manufacturers have Wizards that are probably easier than ASF. They are supported by most ARM IDEs. Some IDEs have size limitations.

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

If I create a SAMD21 project in AS7, I can download it to a Zero. But it would save time to load the Arduino core code into the project and then be able to use the routines that are already there for pin control, read/write to the USB port, etc. How do I do that?

 

Brian

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

In theory, you can import an Arduino sketch into AS7. AS7 just crashes for me.

It seems to work for other people. Try building Uno sketches first. Then tell AS7 that you have a Zero.
This probably means using the v1.7.8 IDE

If I could build for a Uno, I could help you with the Zero. Meanwhile, I can only build regular AS7 projects.

David.

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

That doesn't work. I can import Sketches into AS7, but I can't then tell it it's got a Zero for a target. That choice is not in the list. So it won't cross compile for Zero. So I am assuming that to make it work, I have to create a SAMD21 project from scratch, but that implies I have to add the Arduino core to it. I can't figure out how to do that.

 

Brian

 

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

If you can import Sketches without AS7 crashing,  you are almost there.

 

Which IDE are you using?   v1.7.8 has got all the cores in its installation directory.

 

v1.6.7 keeps 'extra' cores in its packages directory.  e.g. C:\Users\David Prentice\AppData\Local\Arduino15

Note that you can't browse for this directory.   But you can get there via the Settings tab.

 

If I could get a Uno sketch without AS7 crashing,   a Zero or Due would be easy.   It should just be adding the installation path to AS7.

 

If anyone understands how the overjoyful VisualStudio stuff works,   the crash feature could be fixed.

 

David.

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

david.prentice wrote:
I presume that someone has had success with AS7, Win7-64, Arduino imports. Even if it is just for AVR. I have given up.

Some success but only if the sketch is small and doesn't include a lot of libraries. Also there is no support for importing Zero or M0 Sketches. Its just Atmega328 and I believe the 2560.

"When all else fails, read the directions"

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

OP said existing project was 30K SLOC of assembly language.

Not exactly Atmel Studio's cup o' tea.

 

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

stevech wrote:
Not exactly Atmel Studio's cup o' tea.

That comment has me intrigued! In what way is Studio not able to handle 30K line projects? I regularly use Visual Studio (parent of Atmel Studio) with 2..5 million line projects - solutions with 100+ sub-projects. It is designed for "big" solutions.

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

AS7 works just fine to develop 30K line assembly language for an ATMega644P. It most certainly IS Atmel Studio's cup of tea. I am not trying to port that to an Arduino Zero. I only mentioned it to illustrate that I am not a newbie when it comes to using Atmel stuff. But I am a newbie when it comes to using an Arduino.

 

I am trying to figure out how to use the Arduino USB println and write and read functions to the native USB port on a Zero. I can import a Sketch program just fine that talks to the USB port on the Zero. But when I try to tell AS7 the target is a Zero, it doesn't work. There is no Zero in the list, just Unos and Dues and all that other old stuff. So it can't cross compile for a Zero using the Arduino Import procedure. That means I have to create a NEW project, tell it it's for a SAMD21, and it can indeed be downloaded to a Zero. But I then have to create my own routines to talk to the USB port, toggle pins, etc. I would rather not do that. So I want to import the Arduino libraries that have USB port support. How do I do this? Where are the libraries? I can't find them anywhere. Can standard Arduino.h libs even be used with the samd21? Or is the SAMD21 USB library already part of the samd core? If so, what are the names of the routines and how do I use them? And where the sam (d) hill do they go? Tools? Toolchain? Sheesh.

 

Brian