Connect with us

Linux on an AVR microcontroller

Discussion in 'Microcontrollers, Programming and IoT' started by Qubix, Jan 5, 2016.

  1. Qubix

    Qubix

    8
    1
    Feb 7, 2015
    Ok ok, I know, people will start laughing and saying that a microcontroller does not have nearly enough memory to store even the linux bootloader, that it does not have a MMU, the architecture of the usual ATMega168 and 328 is only 8 bits, etc...

    But, take a look at this:

    http://dmitry.gr/index.php?r=05.Projects&proj=07. Linux on 8bit

    and this

    http://www.uclinux.org/index.html

    So, even though it IS slow, and even though it obviously requires some peripherals (SD card, RAM memory), it is possible. Now I want to start a project to make one such barebones linux computer, just for fun and also to learn stuff. I've read the first link rather carefully and it seems he needed to write quite a bit of code (ARM emulator, among others).

    1) If I were to use a 32 bit microcontroller, could I get away with just connecting it to some RAM and storage?
    2) If I just use an ATMega328, does anyone know how I could write that emulator, or can I somehow make linux behave nicely on 8 bits?
    3) Is there an 8 bit linux distro that could work directly with the ATMega168/328 ? (The uclinux seems not to support these).

    Sorry if my enthusiasm seems foolish, I am rather new to this stuff and quite excited about such a project. :)
     
  2. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,174
    2,690
    Jan 21, 2010
    That is an incredibly impressive hack.
     
    Gryd3 likes this.
  3. Qubix

    Qubix

    8
    1
    Feb 7, 2015
    Yes, and it is quite old. I am thinking of reproducing it, but I want to simplify what and where I can.
     
  4. EK61

    EK61

    49
    4
    Jan 5, 2014
    Once you get it actually functioning, it would be awesome to see an actual computer built like this. You could print the circuit and maybe even get some actual RAM slots for it.

    If you could get a distro for it that would be awesome. Or could you get the right chip for uCl?

    You must write a tutorial if you get this going! I would love to do this!
     
  5. Qubix

    Qubix

    8
    1
    Feb 7, 2015
    Well, thanks a lot for the confidence vote :). However I am also quite new at this and it will probably take a lot of time to get it done (if I manage to get it done, that is.) I am currently reading as much as I can about microcontrollers and computer architecture, to get an idea of what I actually need to do.
    If I manage to get this project done, then I will certainly make a tutorial for it and also provide all the code (if any).
    In the mean time, suggestions, help in any way, resources (books, websites, youtube videos...) are more then welcome.
     
  6. BobK

    BobK

    7,599
    1,641
    Jan 5, 2010
    It would be much easier to emulate a PDP-11 and bring up the original unix. I wonder if the source is available.

    Given the simplicity (sorry elegance) of the PDP-11 architecture, and it being 16-bit and only a 64K memory limit, I think this could actually run at reasonable speed (possibly even at full speed) on a higher end 16-bit micro like PIC33.

    In fact, I might have to build one of these. Complete with the data entry switches and data bus LEDs on the panel. This would be way cool.

    Bob
     
    (*steve*) likes this.
  7. EK61

    EK61

    49
    4
    Jan 5, 2014
    Personally I see that as a bit of a separate project. Modernish OSes have been on 16-bit (Windows, Mac maybe?). But to get something like Linux on an 8-bit processor, well that would be special. The Unix PC from scratch idea sounds cool all the same though. No idea about Unix, but I know some/all MS-DOS versions are open source now apparently. But that probably doesn't help.
     
  8. BobK

    BobK

    7,599
    1,641
    Jan 5, 2010
    Yes, it is a separate project for sure. But, having been a Digital employee and used the PDP-11 for my work back in 1978, I have fond memories of it. It is a beautiful architecture. The instruction set is so simple, and the format so consistent, that one could actually interpret code when printed out in Octal format. One octal digit was the op code, one the source addressing mode, one the source register, another was the destination addressing mode and finally the destination register. And the high bit was 0 for word and 1 for byte.

    Bob
     
  9. EK61

    EK61

    49
    4
    Jan 5, 2014
    Wow, I never thought an instruction set could be that simple! Sounds ripe for projects.
     
  10. Qubix

    Qubix

    8
    1
    Feb 7, 2015
    This can be interesting :

     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-