Monday, 31 July 2017

arm - Smallest embedded linux distro?


I like to ask to the experts out there.. What is the best embedded linux distro for:



  • Flash memory ~ 700Kb

  • Ram ~ 256Kb

  • Processor: High end arm cortex M3 (something from STM32 family for eg)


Required modules: - Kernel core - Basic driver set: USB/Networking (for WiFi - No AP, just client, no security)/SPI/Uart/I2C



Is this at all possible or am I dreaming?


The idea is to use a 5$ high end CortexM3 and don't use any external memories so that I can enjoy the ready drivers for SDIO/WiFi etc.




  • I updated the question with clarification on WiFi. WiFi in the sense that it is a simple, run of the mill client. Nothing fancy, perhaps wep if I can fit it.




  • Another update: How about uCLinux?






Answer



I'd say you're dreaming. The main problem will be the limited RAM.


In 2004, Eric Beiderman managed to get a kernel booting with 2.5MB of RAM, with a lot of functionality removed.


However, that was on x86, and you're talking about ARM. So I tried to build the smallest possible ARM kernel, for the 'versatile' platform (one of the simplest). I turned off all configurable options, including the ones that you're looking for (USB, WiFi, SPI, I2C), to see how small it would get. Now, I'm just referring to the kernel here, and this does not include any userspace components.


The good news: it will fit in your flash. The resulting zImage is 383204 bytes.


The bad news: with 256kB of RAM, it won't be able to boot:


$ size obj/vmlinux
text data bss dec hex filename
734580 51360 14944 800884 c3874 obj/vmlinux


The .text segment is bigger than your available RAM, so the kernel can't decompress, let alone allocate memory to boot, let alone run anything useful.


One workaround would be to use the execute-in-place support (CONFIG_XIP), if your system supports that (ie, it can fetch instructions directly from Flash). However, that means your kernel needs to fit uncompressed in flash, and 734kB > 700kB. Also, the .data and .bss sections total 66kB, leaving abut 190kB for everything else (ie, all dynamically-allocated data structures in the kernel).


That's just the kernel. Without the drivers you need, or any userspace.


So, yes, you're going to need a bit more RAM.


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...