Trying to port to xmega256A3...

travisgriggs wrote on Monday, November 26, 2012:

We have some code where I work at that runs on an xmega256A3. I think it’s overtly complex with all of its state machines, and would like to try using FreeRTOS with it. I’m new to this. I’ve read through a bunch of the docs. I downloaded the latest (I’m excited about the tickless support, because we frequently sleep to save power). And I think I’m correct in noticing that this processor is not an official supported port. I’m developing on an OSX box with CrossPack’s AVR toolchain and avrdude.

So I cloned Demo/AVR_ATMega323_WinAVR, that seemed like it would be the most similar to the xmega256a3 and my platform. I made minor adjustments to the makefile (adjusted the DIRAVR and MCU variables).

When I try to ‘make’ from there, I get the following error:

ParTest/ParTest.c:102:2: error: ‘DDRB’ undeclared (first use in this function)

What confuses me though, is where DDRB would normally come from? A ‘grep -R “DDRB” *’ at the root FreeRTOS directory level, doesn’t turn up anything that gives me any hints about what to do to resolve it for my target…

Any help/hints with this specific issue, as well as any general guidance about what else I’m going to need to do to make this work, are much appreciated. I would love to hear that there’s already been a port to the xmega256a3…

edwards3 wrote on Monday, November 26, 2012:

I just looked in partest.c (the file that generates the error) for the AVR GCC port and it contains the line:


FreeRTOSConfig.h includes <avr/io.h> so the definition must come from there.

I guess that is a data direction register for port B? I suspect the name used by the compiler has changed since the demo was written.

You will find other AVR ports in the Interactive site Also check out the forums at

where there are some FreeRTOS users.