[En-Nut-Discussion] Nut/OS for AT90CAN128 processor

Henrik Maier hmlists at focus-sw.com
Thu Feb 10 08:30:57 CET 2005


Today I checked in my changes for the AT90CAN128 CPU support. More than 
40 source files needed to be changed. Even though I tried to be very 
careful and checked every change twice, I expect that some things I 
wasn't aware of might be broken now. Some more modifications might be 
required to support the ICC compiler which I don't have.

Refer to the Changelog for details what I have done.

Conditional compilation was the area which required most changes. The 
other main area is the different register architecture of the AT90CAN128 
CPU. AT90CAN128 is more related to the ATmega169 than to the ATmega128.

I followed the following concept in regards to conditional compilation:

1) Generic tests for AVR architecture are now performed using the 
__AVR__ macro instead of checking for __AVR_ATmega128 || 
__AVR_ATmega103. __AVR__ is defined in GCC when compiling for the AVR 

2) Generic tests for the enhanced AVR architecture (e.g. 2nd serial 
port, memory, SFRs, sleep mode, etc. etc.) are now performed using the 
__AVR_ENHANCED__ macro instead of checking for only for __AVR_ATmega128. 
__AVR_ENHANCED__ is defined automatically in GCC when compiling for 
ATMEGA128, ATMEGA64, and AT90CAN128.

There are still a few issues with the AT90CAN128 which have to be resolved:
1) The EEPROM routines in avr-libc are broken for this device and I 
suggest that NutOS includes its own routines to overcome this issue. I 
have some C code which I can contribute. At this stage NutLoadConfig is 
just a dummy for this CPU.
2) In addition the automatic calculation of the CPU frequency is not 
implemented. NUT_CPU_FREQ must be set for compilation.
3) Support for ICC and this CPU is also outstanding.
4) There are some timing issues as NutSleep sleeps longer than it should.
5) CAN device driver has to be completed

However I have a unit running here happily doing web serving and CAN 


Henrik Maier

FOCUS Software Engineering Pty Ltd
Brisbane, Australia - Web: www.focus-sw.com
Phone: +61-402 970 933 - Fax: +61-7-3009 0399

More information about the En-Nut-Discussion mailing list