bit-tech.net

Linux ported to Atmel's ATmega microcontrollers

Linux ported to Atmel's ATmega microcontrollers

Dmitry Grinberg's design allows an Atmel microcontroller to run a full GNU/Linux operating system - albeit slowly.

The Ubuntu Linux distribution has been ported to the cheapest and most portable platform yet: An Atmel ATmega microcontroller.

Boasting a 20MHz 8-bit AVR processor, 128KB of flash storage and a massive 16KB of SRAM, the ATmega1284P isn't the most logical choice for building a microcomputer. It's the same basic design found in the Arduino prototyping platform: a microcontroller, designed to use its 32 pins to interface with external hardware like sensors, motors and LEDs.

That didn't stop Russian-born and California-based programmer Dmitry Grinberg from taking on the challenge of porting the Linux kernel and a full desktop operating system to the device, though.

'It is common to see newbies asking in microcontroller forums if they can run Linux on their puny little eight-bit micro,' Grinberg explains of his inspiration in a blog post. 'The results are usually laughter. It is also common to see, in Linux forums, asked what the minimum specs for Linux are. The common answer is that it requires a 32-bit architecture and an MMU and at least a megabyte of ram to fit the kernel.'

Grinberg decided that such a limitation could likely be avoided by emulating hardware the ATmega chips don't have in software. Designing his own ARM emulator - 'porting someone else's code is no fun, plus none of the emulators I saw out there were written in a way that would make them easy to port to an eight-bit device,' he explains - Grinberg was able to convince the ATmega1284P chip to pretend that it was a PXA255 ARMv5TE processor.

Overclocking the chip to 24MHz from the stock 20MHz, and adding a 16MB SIMM module for RAM and a 1GB SD card for the operating system itself, Grinberg was able to successfully load an older copy of Ubuntu Linux onto the device, complete with a graphical user interface.

While it works, the result isn't exactly a speed demon: Grinberg has timed the boot process at around two hours to reach the BASH shell - something an average netbook can achieve in around two seconds - and a further four hours to load the rest of the operating system. 'Starting X [the graphical user interface] takes a lot longer,' Grinberg adds.

'Curiously enough, once booted, the system is somewhat usable,' Grinberg claims in defence of the design. 'You can type a command and get a reply within a minute. That is to say that you can, in fact, use it. I used it today to format an SD card, for example. This is definitely not the fastest, but I think it may be the cheapest, slowest, simplest to hand assemble, lowest part count, and lowest-end Linux PC. The board is hand-soldered using wires, there is not even a requirement for a printed circuit board.'

Grinberg's design, which he's releasing under a non-commercial open source licence, is portable to other microcontrollers such as the cheaper ATmega644. When you're talking about a chip that costs just £8, however, it's probably worth just plumping for the more powerful ATmega1284P.

Full details of the build, which is the equivalent of an ARMv5TE processor running at around 6.5KHz (yes, we meant to type kilohertz and not megahertz) can be found on Grinberg's website.

10 Comments

Discuss in the forums Reply
SpAceman 30th March 2012, 12:42 Quote
What a boss. I bet he was one of those newbies once. Got laughed at then decided he would do it one day. That will show them.
wuyanxu 30th March 2012, 12:48 Quote
This is a triumph, a huge success!

Atmel AVR's are great, very easy to program for, who needs RPi :p
Xlog 30th March 2012, 12:50 Quote
Writing CPU emulator != porting.
Second to last paragraph: there is no such thing as ATmega1268P.
Gareth Halfacree 30th March 2012, 12:54 Quote
Quote:
Originally Posted by Xlog
Writing CPU emulator != porting.
For the purposes of this exercise, "getting X software to run on Y" is functionally equivalent to "porting."
Quote:
Originally Posted by Xlog

Second to last paragraph: there is no such thing as ATmega1268P.
Typo, fixed.
Xlog 30th March 2012, 14:39 Quote
Quote:
Originally Posted by Gareth Halfacree
Quote:
Originally Posted by Xlog
Writing CPU emulator != porting.
For the purposes of this exercise, "getting X software to run on Y" is functionally equivalent to "porting."

The term "porting" implies the alteration of software for it to run in different target environment. In this case the software - Ubuntu OS - was not altered, but rather another software layer was added.

Would it be okay to say "the car was made to go over water" if the said car was only parked on a ferry?
While the expression is technically correct it implies an entirely different meaning.
Gareth Halfacree 30th March 2012, 14:48 Quote
Quote:
Originally Posted by Xlog
Would it be okay to say "the car was made to go over water" if the said car was only parked on a ferry?
If you bought the car and got the ferry too, yes.
schmidtbag 30th March 2012, 15:08 Quote
just think how much more usable if he used something like arch linux or gentoo with LXDE then this would probably be usable to the point of being a little practical. ditch the gui altogether and you've basically got a really cheap beaglebone.

although maybe not completely practical, this is some awesome work. way to prove dozens of people wrong.
fluxtatic 31st March 2012, 06:09 Quote
Quote:
Originally Posted by Xlog
Writing CPU emulator != porting.

No need to be a dick about it. This is ****ing awesome
SexyHyde 2nd April 2012, 00:20 Quote
This is an awesome achievement!
Quote:
Originally Posted by Xlog
The term "porting" implies the alteration of software for it to run in different target environment. In this case the software - Ubuntu OS - was not altered, but rather another software layer was added.

Would it be okay to say "the car was made to go over water" if the said car was only parked on a ferry?
While the expression is technically correct it implies an entirely different meaning.

a car analogy to this is "he made the car run on an engine made from paperclips, glue and washing up bottles! 0-0.60 is quoted as 3.4 hours"
dark_avenger 2nd April 2012, 06:43 Quote
Pretty cool but not very practical. Certainly shows how versatile Linux is though.
Log in

You are not logged in, please login with your forum account below. If you don't already have an account please register to start contributing.



Discuss in the forums