Author Topic: Atmel Software Framework (ASF)  (Read 12460 times)

0 Members and 2 Guests are viewing this topic.

Offline vini_iTopic starter

  • Regular Contributor
  • *
  • Posts: 83
Atmel Software Framework (ASF)
« on: June 20, 2015, 12:09:23 am »
this is more a philosophical question then anything else.

i've been using pic micro controllers for going on four years now. i try to rely as little as possible on microchip's software libraries. i find them to be often incomplete and inconsistent. this isn't a concern for me i've learned to use the processors quite well by configuring all the settings and registers manually. that said microchip make that procedure quite painless by providing bit wise operation macros. combined with the auto complete i would say it's comfortable.

to become more worldly i'm working on learning atmel micros. what i'm running into is that working with the registers directly is rather clunky and requires you to essentially build your own bit wise operation macros.

my question, is it worth investing the time to learn ASF. how complete and functional is it? will i find myself going back to modifying the registers manually to compensate for some short coming of ASF?
 

Offline c4757p

  • Super Contributor
  • ***
  • Posts: 7799
  • Country: us
  • adieu
Re: Atmel Software Framework (ASF)
« Reply #1 on: June 20, 2015, 12:13:05 am »
No, but you'll find yourself doing long battle with the build system, and praying for real documentation...
No longer active here - try the IRC channel if you just can't be without me :)
 

Offline vini_iTopic starter

  • Regular Contributor
  • *
  • Posts: 83
Re: Atmel Software Framework (ASF)
« Reply #2 on: June 20, 2015, 12:21:12 am »
No, but you'll find yourself doing long battle with the build system, and praying for real documentation...

would you mind elaborating more on your comments?
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 12504
  • Country: us
    • Personal site
Re: Atmel Software Framework (ASF)
« Reply #3 on: June 20, 2015, 01:13:46 am »
If you can help it at all, avoid ASF as a plague. Different people have different work styles, of course. But with direct registers access you control the code and if you are gaining experience in the process of writing it.

With ASF, you still need to mess with registers in case if something is not working or just not written the way you want, but now you also need to wanter though a ton of unreadable code. And in the end you are gaining experience with ASF, which is mostly irrelevant in the real world.

But I don't like manufacturer supplied libraries.
Alex
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 12504
  • Country: us
    • Personal site
Re: Atmel Software Framework (ASF)
« Reply #4 on: June 20, 2015, 01:15:16 am »
ASF is perfect if you are a contractor and need to slap together something that you have no intention of maintaining in a long term. But whoever will be maintaining that code will hate you, for sure. Not good for karma :)
Alex
 

Offline slashdev

  • Contributor
  • Posts: 10
Re: Atmel Software Framework (ASF)
« Reply #5 on: June 20, 2015, 02:17:34 am »
ASF?  [deleted].

How many projects have you read about that actually used it?

Honestly, there is no amount of JTAG debugging that will ever compensate for [deleted].  I've used other frameworks, and I've also designed, implemented and sold my own.  This one is [deleted].

If you want a framework, look at Cosa: a great OO design, very efficient, has lots of supported devices, and has lots of examples.

On a totally unrelated note, this.
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 12779
  • Country: nz
Re: Atmel Software Framework (ASF)
« Reply #6 on: June 20, 2015, 02:38:49 am »
to become more worldly i'm working on learning atmel micros. what i'm running into is that working with the registers directly is rather clunky and requires you to essentially build your own bit wise operation macros.

You only have to do it once though.
Make some macros that work they way you want.
Done and done.
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline trevwhite

  • Frequent Contributor
  • **
  • Posts: 955
  • Country: gb
Re: Atmel Software Framework (ASF)
« Reply #7 on: June 20, 2015, 10:02:32 pm »
ASF really is for the marketing guys. I was at a workshop when it came out and they were talking about how great it is to use. As soon as something doesnt quite work you find that you have to read the datasheet and as said read through a ton of unreadable code that has been written to support too many different processors and thus has layers and layers of abstraction. You end up pulling your hair out. The other thing is that when using the ASF you are not completely in control any more. The layers of abstraction make you end up not really knowing what is going on with the code which is always bad. As soon as you get a bug that isnt straight forward you are going to be in a world of trouble.

ASF is just painful and I think its best used to enable demonstration of features rather than applicable to real world projects. I also do not know how efficient the code is.





 

Offline ralphd

  • Frequent Contributor
  • **
  • Posts: 445
  • Country: ca
    • Nerd Ralph
Re: Atmel Software Framework (ASF)
« Reply #8 on: June 20, 2015, 10:14:33 pm »
Go with the Atmel Toolchain, and good 'ol makefiles that any C programmer will understand.
http://www.atmel.com/tools/atmelavrtoolchainforlinux.aspx
https://github.com/nerdralph/dmbs
Unthinking respect for authority is the greatest enemy of truth. Einstein
 

Offline electro-logic

  • Contributor
  • Posts: 21
Re: Atmel Software Framework (ASF)
« Reply #9 on: June 21, 2015, 09:39:12 am »
ASF is good for complex things like USB, less for SPI or simpler things.
I have written a series of tutorials (in Italian but you can google translate it) at http://electro-logic.blogspot.it/p/indice-articoli-su-asf.html
It has its own philosophy that i try to explain in my blog.
 

Offline JuKu

  • Frequent Contributor
  • **
  • Posts: 566
  • Country: fi
    • LitePlacer - The Low Cost DIY Pick and Place Machine
Re: Atmel Software Framework (ASF)
« Reply #10 on: June 22, 2015, 12:17:22 pm »
What electro-logic and mojo-chan said pretty much is my experience, too. I ended up writing my own serial and SPI modules, but getting USB, file system, RTOS and Ethernet working pretty much the first try on a small uC was rather amazing.
http://www.liteplacer.com - The Low Cost DIY Pick and Place Machine
 

Offline omnix

  • Newbie
  • Posts: 4
  • Country: us
Re: Atmel Software Framework (ASF)
« Reply #11 on: July 19, 2015, 03:20:12 am »
I have been using Blinking_LED examples from the ASF on CortexM just to trace down what is going on in the chip during initialization (oscillators, PLLs, buses...). Endless layers and layers of .h includes constructed of endless #ifdef and #ifndef ... Sometimes 7 or more layers of nested #include-s just to set/clear some bit in some register.
You would need days to find out what really happens in anything not so trivial as Blinking_LED.

That being said, in comparison with reading thousands of datasheet pages for the actual chip, together with hundreds and hundreds of pages for the ARM core, ASF examples are still faster way (simply because of the absence of anything better) to (relatively) quickly grasp how to set up and use some periphery. Just use a lot of Quick find, Find in files, Goto implementation, debugger and similar functions in your IDE to track down what some ASF macro/function really does (whit the actual registers and bits) and you should be ok. The more you practice the faster you become in this.

This is the only useful purpose I found of the ASF for now. I personally would not use it for any serious projects of my own.
 

Offline Bassman59

  • Super Contributor
  • ***
  • Posts: 2499
  • Country: us
  • Yes, I do this for a living
Re: Atmel Software Framework (ASF)
« Reply #12 on: July 20, 2015, 04:00:51 am »
I have been using Blinking_LED examples from the ASF on CortexM just to trace down what is going on in the chip during initialization (oscillators, PLLs, buses...). Endless layers and layers of .h includes constructed of endless #ifdef and #ifndef ... Sometimes 7 or more layers of nested #include-s just to set/clear some bit in some register.
You would need days to find out what really happens in anything not so trivial as Blinking_LED.

Right now I'm trying to figure out why none of the examples compile, now that I've installed ASF 3.25.0. Two undeclared symbols, which are actually #defines, and as far as I can tell -- and the "Goto Implementation" feature finds both of the #defines.

Arrrgh.
 

Offline tombi

  • Regular Contributor
  • *
  • Posts: 163
  • Country: au
Re: Atmel Software Framework (ASF)
« Reply #13 on: July 26, 2015, 01:38:28 pm »
I don't particularly like the fact that when you include ASF services etc it puts all the source into your project.

I don't understand why they couldn't just make these into libraries and then you could link with them (and include the headers you want).

If I don't put all this stuff into version control with my code it means to setup my source from version control you first have to create a project and select the right ASF options etc. If I do put them in version control and the ASF code changes down the track the build could fail in odd ways as I have whatever version of the ASF code that was around when I created the project.

This seems very clunky to me although I am used to coding for systems without these size limitations.

I also prefer to use C++ classes to modularize my code. The ASF code doesn't wrap anything in extern "C" {} so I get compile errors unless I wrap the standard includes with this in my code.

The documentation (to put it nicely) is sparse. I get more from AVRFreaks than I do from the Atmel documentation.

Tom
 

Offline ralphd

  • Frequent Contributor
  • **
  • Posts: 445
  • Country: ca
    • Nerd Ralph
Re: Atmel Software Framework (ASF)
« Reply #14 on: July 26, 2015, 03:11:30 pm »
You can do modular code in C.  I find Arduino has been a bad example of good software design.  I've seen many classes that take configuration information in their constructors.  Configuration and functional code should be abstracted.  The gnu configure/make framework is an example of this.
It also makes code management a real pain.  I was helping out someone with improvements to an Arduino library, and I had to back out my configuration changes every time I wanted to check in functional changes to the code.
Unthinking respect for authority is the greatest enemy of truth. Einstein
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4670
  • Country: us
Re: Atmel Software Framework (ASF)
« Reply #15 on: July 27, 2015, 02:32:31 am »
Quote
I don't particularly like the fact that when you include ASF services etc it puts all the source into your project.
I sorta like it.  It beats having to version-control ASF separately.  If my code works, it'll continue to work, regardless of API changes and bugs that Atmel might add to ASF later.

(Is there an easy way to "replace all ASF files with version X" ?)
 

Offline Bassman59

  • Super Contributor
  • ***
  • Posts: 2499
  • Country: us
  • Yes, I do this for a living
Re: Atmel Software Framework (ASF)
« Reply #16 on: July 27, 2015, 04:57:58 pm »
I don't particularly like the fact that when you include ASF services etc it puts all the source into your project.

I don't understand why they couldn't just make these into libraries and then you could link with them (and include the headers you want).

If I don't put all this stuff into version control with my code it means to setup my source from version control you first have to create a project and select the right ASF options etc. If I do put them in version control and the ASF code changes down the track the build could fail in odd ways as I have whatever version of the ASF code that was around when I created the project.

I prefer it. How does your company manage software/firmware libraries? If the library code is brought into the project as source, you check the whole thing into the repository.

I suppose The Right Thing To Do would be to have the firmware library source in the repository as its own project, tagged as one might normally do for home-grown libraries. The Subversion user simply adds the library source as an external.


 

Offline alank2

  • Super Contributor
  • ***
  • Posts: 2203
Re: Atmel Software Framework (ASF)
« Reply #17 on: July 27, 2015, 05:21:10 pm »
I sorta like it.  It beats having to version-control ASF separately.  If my code works, it'll continue to work, regardless of API changes and bugs that Atmel might add to ASF later.

Me too.  All projects get their own copies of libraries so that they don't break when a library is changed/updated/fixed/bugged.  You can choose when to do that and if something breaks you'll have an idea why.
 

Offline ralphd

  • Frequent Contributor
  • **
  • Posts: 445
  • Country: ca
    • Nerd Ralph
Re: Atmel Software Framework (ASF)
« Reply #18 on: July 28, 2015, 01:31:27 am »
I sorta like it.  It beats having to version-control ASF separately.  If my code works, it'll continue to work, regardless of API changes and bugs that Atmel might add to ASF later.

Me too.  All projects get their own copies of libraries so that they don't break when a library is changed/updated/fixed/bugged.  You can choose when to do that and if something breaks you'll have an idea why.
Make a git repo for each project, and make the library set a submodule.   The submodule points to a specific version of the library files, so when they are updated your project still references the old version.
Unthinking respect for authority is the greatest enemy of truth. Einstein
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4670
  • Country: us
Re: Atmel Software Framework (ASF)
« Reply #19 on: July 28, 2015, 05:06:01 am »
(also, source code is (or can be) very compact compared to the N compiler-optioned versions for M processor families.
AVR8 in the non-ASF toolchain has about 70MB worth of library and startup code.  (of course, most of that is libc and libgcc stuff that is still binary anyway, and ASF is just more ON TOP OF that...))
 

Offline tombi

  • Regular Contributor
  • *
  • Posts: 163
  • Country: au
Re: Atmel Software Framework (ASF)
« Reply #20 on: August 04, 2015, 05:27:39 am »
Sorry for the slow response.

Yes managing a gazillion libraries (for each micro) would be hard.

I care that the functionality provided by the ASF meets it specifications but I don't want to maintain it. Ideally they will provide API backward compatibility (semantic and interface) between versions so it should just work if I move my code to another version of Atmel Studio.

Also I have found that often compiler changes will require source changes. I don't want to have to sort this out myself which I would have to do if I carry the ASF code around with my code.

If I am coding in say DevStudio I wouldn't check in the libraries that come with the runtime - I would assume they are available with the compiler (and I would require one of a few compilers to be present - say 2008, 2012 etc). My assumption was that I could do this with ASF. The problem here is if I don't check them in it makes compiling the project from checked-in source harder (can't just open the project and hit F7)

The analogous situation would be carrying around the source to the standard library with your project - you wouldn't do it.

For other third party components then yes I would check them in and manage them but as compiled libraries plus headers.

Then there is the Maven/Ivy/NuGET approach where your build file just fetches the right versions of the dependencies from the internet when you run the build.

Tom
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4670
  • Country: us
Re: Atmel Software Framework (ASF)
« Reply #21 on: August 04, 2015, 11:57:09 pm »
Hmmph.  I just chased some bugs around having to do with there being several copies of gclk.h being accessed by the LED Toggle SAMD10 example project.  With incompatible definitions of some symbol...  (one part of ASF, one part of the compiler install (I think.))  You can see some details here:
http://www.avrfreaks.net/forum/samd10-xplained-mini-questions-and-experiences-start-clock-configuration
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->