Programming the Atmel ARM-Cortex, Smart Series development toolchain related question

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

Hi guys.

I have realized that there might be some kind of mystery fog around the Atmel ARM Cortex related product line to me. That said, it is very unclear which tools and toolchain can be employed to start developing programs. There is a lot of information out there but I'd prefer this forum due to the fact that everyone here are mostly dealing with the Atmel products. As for myself, I am quite familiar with AVR Devices and can work with them pretty well. But what would be the advice to the newcomer into the world of ARM products of the Atmel. I mean to start efficient and learning in a constructive pace. Is there anything similar like for the AVR toolchain=?, or maybe like <avr/io.h> file where all sorts of stuff is already defined?=. Any information here will be highly appreciated. laugh 

work in progress...

Last Edited: Thu. Sep 20, 2018 - 08:35 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Get yourself an Atmel evaluation board like the SAM E70 Xplained, or the SAM V71 Xplained

 

http://www.microchip.com/Develop...

http://www.microchip.com/Develop...

 

For development tools Atmel Studio 7 is free and familiar to you already.  It has the ARM/GCC toolchain builtin.  You might need to reinstall AS7 if you didn't include the ARM features the first time around.

 

Next is library and drivers.  Sticking with the Atmel theme you have two choices, Atmel Software Framework 3.X (ASF3), or Atmel START (ASF4).  ASF3 is the legacy framework similar to the AVR toolchain.  ASF4 is a newer web based code generator with a pretty slick clock setup feature.  But the START/ASF4 code generated can be buggy and adding library modules to your project weeks after the initial setup is painful, mostly manual windiff type process.  To be fair though ASF4 has improved over the past year with bug fixes coming out every few months.

 

ASF3 projects use the ASF->ASF Wizard menu item inside Atmel Studio.  START/ASF4 projects use the http://start.atmel.com website to create the baseline project with your selected modules, them imports into Atmel Studio.  Try them both with some sample programs for your eval board to get an idea of what's possible.

 

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

Is there anything similar like for the AVR toolchain?

 There are "ARM Toolchain for xxx" here: http://www.microchip.com/mplab/avr-support/avr-and-arm-toolchains-c-compilers

At least for now :-(

 

or maybe like <avr/io.h> file where all sorts of stuff is already defined?

The equivalent of <avr/io.h> for the ARM chips is <sam.h> and associated sub-includes, typically located starting in the .../CMSIS_Atmel/Device/ATMEL/ directory.

Last I heard, these were not downloadable separately, which is a shame, but they should be compatible with most ARM C compilers.   Figuring out "..." may be a pain.

There may be significant "-I" search paths that you need to add to your compile statement to get everything working.

 

The Device/ATMEL directory I mentioned has a sub-directory for each device family, and those each have "include" and "source" (ie for startup code) directories, and then "include" has sub-dirctories "component" and "instance" directories that define (respectively) the ARM-style peripheral "structures" and a bunch of individual register definitions (sort-of AVR-style)

 

So:

sam.h
  samd21/include/samd21g18a.h
     #define PORT   ((Port *)0x41004400UL)
     samd21/include/component/port.h
        typedef struct ... PortGroup;
     samd21/include/instance/port.h
        #define REG_PORT_OUT1 (*(RwReg  *)0x41004490U)

 

Not all the names make sense, IMO :-(

For example, PORTB is accessed via a "PORTGROUP" srtucture at "PORT_IOBUS->Group[1]->xxx" or individual registers like "REG_PORT_xxx1"PORT_IOBUS->Group[PORT_IOBUS->Group[PORT_IOBUS->Group[  (this is sort-of better than A/B/etc, but it would have been nice if the people who wrote the datasheet had been on the same page...)

 

PORT_IOBUS->Group[

 

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

 as I understood from the above two replies:                1). I get a "SAM" Device from Atmel, 

                                                                                       2). use  "ATMEL studio-7"  for programming, and uploading programs to the "SAM" device. what about the bootloader=?, and AVRMKII ISP? would it be possible to program "SAM" with AVRMKII isp?, or arduino isp?

                                                                                       3). what if I don't want to use the "ATMEL Studio"? I use mostly  "CodeBlocks" IDE for both programming "AVRs" and for everything else. How would it be possible to program "SAM" out of Atmel Studio? (^_^).

                                                                                      

PORTB is accessed via a "PORTGROUP" srtucture at "PORT_IOBUS->Group[1]->xxx"                            

so the regular bitwise operations for setting, clearing and toggling bits not possible to use here? also are there any general things which one can assume to be more or less similar to nice AVR programming? (°_°)

a simple program of using ADC or blinking some leds would be interesting to see, if anyone could post a small snippet of code here, would be appreciated.

 

work in progress...

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

Some of the SAM devices are supported by Arduino. You get an installation of arm-gcc with this. There’s also the likes of plattform-io and MBED.

Most Arm devices use SWD or JTAG, so isp is of no use. Get an explained board with the programmer/debugger on it, otherwise you’ll need something like a segger jlink or blackmagic dongle.

Simple example? There’s a few files involved to do the startup and clock initialisation. Atmel Studio has examples. Or just use Arduino where all the evil is covered.

Also, you want Cortex M, not A

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

 

Arduino and its ecosystem is no go for me. I will never go back there after learning to work with "AVRs" standalone. I have downloaded the "ARM-GCC" compiler from ATMEL aka PIC's website.

  otherwise you’ll need something like a segger jlink or blackmagic dongle.

 It looks like "Segger's J-Link" is a great product to use as general programmer for ARM Cortex Devices, it supports a lot of devices on the market. Also it looks like i can get the "EDU" aka education version for 49 Euro here. 

 So we solved the 2 variables in this equation, that is we have the "ARM-GCC" compiler, we have the "ARM-Programmer" which variables are left to solve? the ARM device itself... (I could order an Atmel Cortex-M Device and plug it to my breadboard with adapter of course).

 Then I will use my CodeBlocks IDE to install the suitable "ARM-GCC" compiler and try to do some nurturing stuff. What else should be done, if i am missing here something in  toolchain?. (*_*)...

work in progress...

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

1). I get a "SAM" Device from Atmel,
2). use  "ATMEL studio-7"  for programming, and uploading programs to the "SAM" device.
    what about the bootloader=?

Some SAM chips have a bootloader built-in (ie SAM3x.)  Most use JTAG or JTAG/SWD for programming, and need an external device for their inital programming.  Of course, you can load in a bootloader and use that thereafter...   There is a standard bootloader protocol for SAM chips (SAM-BA or SAMBA)

and AVRMKII ISP? would it be possible to program "SAM" with AVRMKII isp?, or arduino isp?

No.  AFAIK, there aren't any really low-cost SAM programmers (there could be, theoretically)
You'll need something like an "Atmel ICE", or Segger J-link.
Many of the Eval boards (Atmel Xplained/etc) come with a built-in programming/debugging interface.
Many of the Arduino-oriented boards come with a bootloader pre-programmed.

3). what if I don't want to use the "ATMEL Studio"? I use mostly  "CodeBlocks" IDE for both programming "AVRs" and for everything else. How would it be possible to program "SAM" out of Atmel Studio? (^_^).

You can add the CLI toolchain to CodeBlocks.  (presumably.  I haven't done it.)  I don't know if there's a version that is already set up for you.  (ImageCraft ARM C compiler is CodeBlocks based, IIRC.)

    >> PORTB is accessed via a "PORTGROUP" srtucture at "PORT_IOBUS->Group[1]->xxx"                            
so the regular bitwise operations for setting, clearing and toggling bits not possible to use here?

Of course the regular operations are available:

     PORTB |= 1<<bitmum;
// becomes
     PORT_IOBUS->Group[1].OUT |= 1<<bitnum;    // Read/Modify/Write :-(
     // You could even do
     #define PORTB (PORT_IOBUS->Group[1].OUT)  // probably not a good idea.  .IN is different.
      // or
    PORT_IOBUS->Group[1].OUTSET = 1<<bitnum;  //faster, and atomic.

The peripherals are substaintially more complex than on an AVR, and more powerful (similar to XMega, actually.)  You'll need to study the (~1000 page) datasheet and probably assorted example and library code.

 

Arduino and its ecosystem is no go for me. I will never go back there after learning to work with "AVRs" standalone.

If you say so.  I'd rate it "pretty good" in terms of being "example code" to look at.  Less complex (and more limited) than ASF or equivalent "vendor library."

 

a simple program of using ADC or blinking some leds would be interesting to see

I have this: https://github.com/WestfW/SAMD10...
It's sort-of geared toward implementing Arduino-like functions from scratch (which is not an awful learning exercised, IMO.)
Alex Taradov has some nice examples here: https://github.com/ataradov?tab=...
And even if you don't like Atmel Studio, you should probably install it just so you can look at their example projects.  (alas, they mostly use ASF, which many people don't like, and which sometimes seems to make chip features more obscure rather than more understandable.)  Or there is also "Atmel Start" which is sort-of an online project builder...

 

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

For $49 euro you could buy a number of different manufacturer’s cortex m boards all with debuggers. For a beginner, you really want to start with a dev board.

Putting a chip on an adapter then into a breadboard is going to be a perilous journey. What you got away with doing on AVRs is likely to be less successful. Again, grab a dev board as they are cheap and have the right stuff to get the chip working reliably. Something like the Infineon xmc2go board is small and can plug into a breadboard at a cost that is probably less than you can buy the chip and adapter board. You could probably get one for zilch if you ask the local rep nicely. There’s many others to choose from starting from around $5usd. With the debugger on board.