Atmel Software Framework (ASF) - Page 1
Forum section: electronics / general

author: vini_i
author_rank: Regular Contributor
timestamp: June 20, 2015, 12:09:23 am
content: 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?

author: c4757p
author_rank: Super Contributor
timestamp: June 20, 2015, 12:13:05 am
content: No, but you'll find yourself doing long battle with the build system, and praying for real documentation...

author: vini_i
author_rank: Regular Contributor
timestamp: June 20, 2015, 12:21:12 am
content: Quote from: c4757p on June 20, 2015, 12:13:05 amwould you mind elaborating more on your comments?

author: ataradov
author_rank: Super Contributor
timestamp: June 20, 2015, 01:13:46 am
content: 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.

author: ataradov
author_rank: Super Contributor
timestamp: June 20, 2015, 01:15:16 am
content: 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

author: slashdev
author_rank: Contributor
timestamp: June 20, 2015, 02:17:34 am
content: ASF? .How many projects have you read about that actually used it?Honestly, there is no amount of JTAG debugging that will ever compensate for . I've used other frameworks, and I've also designed, implemented and sold my own. This one is .If you want a framework, look atCosa: a great OO design, very efficient, has lots of supported devices, and has lots of examples.On a totally unrelated note,this.

author: Psi
author_rank: Super Contributor
timestamp: June 20, 2015, 02:38:49 am
content: Quote from: vini_i on June 20, 2015, 12:09:23 amYou only have to do it once though.Make some macros that work they way you want.Done and done.

author: trevwhite
author_rank: Frequent Contributor
timestamp: June 20, 2015, 10:02:32 pm
content: 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.

author: ralphd
author_rank: Frequent Contributor
timestamp: June 20, 2015, 10:14:33 pm
content: Go with the Atmel Toolchain, and good 'ol makefiles that any C programmer will understand.http://www.atmel.com/tools/atmelavrtoolchainforlinux.aspxhttps://github.com/nerdralph/dmbs

author: electro-logic
author_rank: Contributor
timestamp: June 21, 2015, 09:39:12 am
content: 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) athttp://electro-logic.blogspot.it/p/indice-articoli-su-asf.htmlIt has its own philosophy that i try to explain in my blog.

author: JuKu
author_rank: Frequent Contributor
timestamp: June 22, 2015, 12:17:22 pm
content: 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.

author: omnix
author_rank: Newbie
timestamp: July 19, 2015, 03:20:12 am
content: 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 ofQuick 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.

author: Bassman59
author_rank: Super Contributor
timestamp: July 20, 2015, 04:00:51 am
content: Quote from: omnix on July 19, 2015, 03:20:12 amRight 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.

author: tombi
author_rank: Regular Contributor
timestamp: July 26, 2015, 01:38:28 pm
content: 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

author: ralphd
author_rank: Frequent Contributor
timestamp: July 26, 2015, 03:11:30 pm
content: 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.

author: westfw
author_rank: Super Contributor
timestamp: July 27, 2015, 02:32:31 am
content: QuoteI 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" ?)

author: Bassman59
author_rank: Super Contributor
timestamp: July 27, 2015, 04:57:58 pm
content: Quote from: tombi on July 26, 2015, 01:38:28 pmI 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.

author: alank2
author_rank: Super Contributor
timestamp: July 27, 2015, 05:21:10 pm
content: Quote from: westfw on July 27, 2015, 02:32:31 amMe 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.

author: ralphd
author_rank: Frequent Contributor
timestamp: July 28, 2015, 01:31:27 am
content: Quote from: alank2 on July 27, 2015, 05:21:10 pmMake 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.

author: westfw
author_rank: Super Contributor
timestamp: July 28, 2015, 05:06:01 am
content: (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...))

author: tombi
author_rank: Regular Contributor
timestamp: August 04, 2015, 05:27:39 am
content: 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

author: westfw
author_rank: Super Contributor
timestamp: August 04, 2015, 11:57:09 pm
content: 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