Atmel Studio AVR Port

ChibiOS public support forum for topics related to the Atmel AVR family of micro-controllers.

Moderators: utzig, tfAteba

jscott
Posts: 129
Joined: Tue Jul 03, 2012 3:50 pm
Location: Middle Georgia, USA
Contact:

Atmel Studio AVR Port

Postby jscott » Thu May 02, 2013 1:02 am

I am interested in trying to put together a port for the Atmel Studio 6 package for the AVR line of processors.

Primarily the processors used in the Arduino line of boards. I know family does not have a manager, but
I am hoping there are a few other people with a little more knowledge of Chibios that can provide a little help
and guidance.

I have been working with the AVR line for many years, so I am not expecting too many problems from
that front. Chibios, on the other hand, I have only been working with for about 10 months or so.

This would be a straight C port, not a port into the Arduino environment.

A few of the first things I could use some help with include...

1. I see that Giovanni has created a ARM port using Atmel Studio 6. Would the makefile configuration for
that port make a good starting point for the AVR. I am not very strong with makefile configuration, but I
know that is a key to building a good port.

2. I am hoping that I can pull a lot of the code from the Atmega128-gcc build, anyone know of any problems
that might pop up ahead of time?

I look forward to your input!!

Thanks
-John Scott
www.atl123.com

User avatar
Giovanni
Site Admin
Posts: 14461
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Atmel Studio AVR Port

Postby Giovanni » Thu May 02, 2013 7:53 am

Hi John,

Does Atmel Studio 6 use AVRGCC? if so then I think there is nothing to change into the code in order to create a package. I had a lot of problems by doing that SAM4L demo because conflicts with the ASF libraries (of which I am not a big fan).

Giovanni

jscott
Posts: 129
Joined: Tue Jul 03, 2012 3:50 pm
Location: Middle Georgia, USA
Contact:

Re: Atmel Studio AVR Port

Postby jscott » Thu May 02, 2013 11:48 am

Does Atmel Studio 6 use AVRGCC? if so then I think there is nothing to change into the code in order to create a package. I had a lot of problems by doing that SAM4L demo because conflicts with the ASF libraries (of which I am not a big fan).

Giovanni


Hi Giovanni,

Yes, it does use arvgcc already.

Do you happen to know if ChibiStudio includes the AVR complier? I have only used it for STM32 stuff so far and have not looked closer at it. I depend on it currently, and don't want to break it....

I wonder if that would be better then using Atmel Studio. I am just thinking that I would like
to use Chibios on my small AVR projects because the processor is almost bullet-proof. I have
never killed one in development( and that is saying a lot!! :shock: :shock: )

I have played with Chibios using the 2.4 port into Arduino, and found a lot of benefit, but
it is not a complete port and i am not fond of the Arduino way of doing things for larger
projects. But i built a test program with something like 20 threads, each flashing a Morse
Code message at different rates to different LEDs. Lets see someone do THAT with a
supperloop!!!!! :o :o :o ( by the way, it looks like a really cool old fashoned sci-fi movie
computer doing that!! )

-Thanks

User avatar
Giovanni
Site Admin
Posts: 14461
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Atmel Studio AVR Port

Postby Giovanni » Thu May 02, 2013 12:30 pm

HI,

Hehe, nice idea with the Morse code :)

You can use the AVR compiler with ChibiStudio (or any other compiler), just make sure it is reachable through the PATH environment variable. I use it exactly that way, import the AVRGCC-generated Makefiles into Eclipse projects and it will just work.

Giovanni

jscott
Posts: 129
Joined: Tue Jul 03, 2012 3:50 pm
Location: Middle Georgia, USA
Contact:

Re: Atmel Studio AVR Port

Postby jscott » Sat May 04, 2013 4:18 pm

Ok, i have been poking around with the AVR Port and have found several things out.

It looks like it is pretty much done for the Arduino-Mega. I may need to make a minor
change or two to the make files to handle the additional flash in the 2560, but I
don't expect that to be a problem for a while.

I found that the WinAVR GCC compiler seems to work fine. Although I have not
burned any code onto a board yet. I am going to try to do that today.

I am also going to work on using the WinAVR toolset through ChibiStudio. I
don't know about the debug side, but time will tell.

It looks like the main thing to work on is the HAL. There are several subsystems
in the the HAL that have not been written. That sounds like a fairly easy place
to start.

As I get to working on stuff, I will create new threads to provide information and
ask the many questions I am sure to come up with.

Thanks
-John Scott
www.atl123.com

User avatar
Giovanni
Site Admin
Posts: 14461
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Atmel Studio AVR Port

Postby Giovanni » Sat May 04, 2013 6:37 pm

Hi,

A lot of drivers have been contributed for the AVR but not merged because there is no maintainer for that platform, search in the forum and you will find them.

Giovanni

utzig
Posts: 359
Joined: Sat Jan 07, 2012 6:22 pm
Location: Brazil
Has thanked: 1 time
Been thanked: 20 times
Contact:

Re: Atmel Studio AVR Port

Postby utzig » Sat May 18, 2013 5:54 pm

Hi,

I have not been following these thread but just answered a PVT message from John right now.

I'm working on a driver for the ENC28J60 SPI <-> Ethernet bridge to be used with ChibiOS, and btw I'm using the SPI driver I contributed some weeks ago which is pretty stable on my tests. Since I'm using the UIP stack that comes bundled, it would be a great idea to have a GPT driver for AVR! I was thinking of writing one but if you are up to the task John, that would be great! If you are interested and want some help just ping me.

jscott
Posts: 129
Joined: Tue Jul 03, 2012 3:50 pm
Location: Middle Georgia, USA
Contact:

Re: Atmel Studio AVR Port

Postby jscott » Tue May 21, 2013 1:52 am

utzig,

I will look at the GPT driver. It is one of the drivers I already thought needed to be added. I will probably be asking some questions once I have looked over other implementations and start trying to port it.

One other problem I have encountered with the AVR port is the hidden RAM usage. It turns out that all the initialized strings, including constants, are copied to RAM at startup. I have been using other compilers targeted at the AVR line, so I was somewhat aware of the issue, but it was delt with by the compiler and its libraries. This is not the case with GCC. I was surprised that it was not mentioned in the test report on the ATMega128-16 port under RAM usage. It looks like the RAM usage for the demo is somewhat over 2k not the ~333 bytes listed under 11.13 in the demo report.

Any idea if a work around is available for this with GCC? I can see where this would take the ATMega2560 from a very viable Chibios processor to a more marginal Chibios processor. All this
for smaller tasks of course...

-John Scott

User avatar
Giovanni
Site Admin
Posts: 14461
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Atmel Studio AVR Port

Postby Giovanni » Tue May 21, 2013 8:04 am

This a real issue with AVRs, all strings are in RAM by default, this is why the test suite takes so much ram on that micro.

Giovanni

utzig
Posts: 359
Joined: Sat Jan 07, 2012 6:22 pm
Location: Brazil
Has thanked: 1 time
Been thanked: 20 times
Contact:

Re: Atmel Studio AVR Port

Postby utzig » Tue May 21, 2013 12:55 pm

There is no workaround for this AFAIK. To put data in Flash you have to declare it with PROGMEM and use the pgm_read_* functions to read it back (which uses LPM instruction). If there is any way to make GCC do this by default for all data, I'm not aware of it.


Return to “AVR Support”

Who is online

Users browsing this forum: No registered users and 1 guest