Home > Freescale Kinetis, Hardware, Linux, Linux 2.6, Processors > Linux for Cortex M3 & M4 Microcontrollers

Linux for Cortex M3 & M4 Microcontrollers

December 30th, 2011 Leave a comment Go to comments

There are plenty of low cost Linux development boards based on Cortex A8 or A9 such as the Beaglebone, as well as some devkits based on ARM7 and ARM9 such as SAM9 development kits , but if your application is cost and/or energy sensitive you can also switch to micro-controllers using Cortex M3 or M4 based development boards such as Emcraft SmartFusion devkits. You can run a functional uCLinux system with 1MB of RAM and 1MB of flash including the TCP/IP stack.

Linux Cortex M3 Development Kit

Emcraft Evaluation Kit (Actel Smartfusion A2F200 / 16 MB RAM / 8 MB Flash)

You need to use uClinux and not directly Linux, because the Cortex M3 doess not have a Memory Management Unit (MMU) and only a Memory Protection Unit (MPU). This can bring some interesting software development challenges such as (apparently random) kernel panics, the lack of fork, memory fragmentation and more. You can check out http://kernel.org/pub/linux/libs/uclibc/Glibc_vs_uClibc_Differences.txt for the main differences between uClibc and Glibc.

The instructions to patch and build the Linux kernel for Cortex M3 are available at LinuxM3 page. It supports Keil’s Microcontroller Prototyping System (64MB NOR Flash, 8MB SSRAM) available at http://www.keil.com/mps/default.asp.  The software is comprised of  the linux kernel, busybox, and the initramfs. They are all compiled using CodeSourcery GCC ARM Toolchain.

If you use one the EmCraft Cortex M3 development boards based on Actel SmartFusion (149 USD), you will get the Linux Board Support Package (BSP) for the board you purchased. EmCraft also sells Linux BSP (for 99 USD – software only) for STMicroelectronics STM32F2, NXP NXP LPC1788  (Cortex M3) and Freescale Kinetis (Cortex M4) development boards.

If you just want to play around, most of those board will be fairly expensive starting at several hundreds of dollars to nearly one thousand dollars.  There also some low cost Cortex-M boards such as the STM32F4-Discovery board available for around 15 USD, but there is unfortunately not enough RAM (192KB) to be able to run uClinux.

So if you are a hobbyist, you’d probably better stick to boards such as Beagleboard or Raspberry Pi , but if you want to develop and mass-produce a real product, Cortex M3/M4 based devices running uClinux are definitely an option. If you can find a cheap Cortex-M dev board with 1MB or more RAM that costs less than 100 USD, let me know in the comment section.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

  1. Guillaume FORTAINE
    January 5th, 2012 at 09:02 | #1

    Hello,

    Happy New Year :)

    For your information :

    http://www.linuxfordevices.com/c/a/News/Freescale-mystery-SoC-tipped/

    Best Regards,

    Guillaume FORTAINE

  2. January 5th, 2012 at 09:41 | #2

    @Guillaume FORTAINE
    Happy New Year to you too !
    The link you sent me talks about a Freescale Soc with Cortex A5 + Cortex M4 and the CoreTile Express development board. But it seems it need to be connected to a motherboard, and I can’t find any pricing info.

  3. Guillaume FORTAINE
    January 5th, 2012 at 11:28 | #3

    @cnxsoft

    Hello,

    Clearly, the idea that you mention in your post is really interesting. However, to my knowledge, there is no Cortex-M3/M4 processor with more than 256kb of RAM and I don’t think that the situation will evolve. That’s why this chip from Freescale seems to be a good alternative, especially, due to the choice of a Cortex-A5 as Application Processor. The corresponding price and development boards should be available in the following months.

    Best Regards,

    Guillaume FORTAINE

  4. January 5th, 2012 at 11:36 | #4

    @Guillaume FORTAINE
    Cortex M3/M4 processors do not embed more than 256 KB of RAM, but some development boards (like the one provided by Emcraft or Keil) use external RAM. That’s why they are able to run uClinux.
    Having that said, the Freescale Cortex A5 SoC may also prove be a good alternative, we’ll have to wait and see.

  5. Guillaume FORTAINE
    January 5th, 2012 at 21:45 | #5

    @cnxsoft

    Hello,

    For your information :

    https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/uClinux%20on%20STM32&currentviews=17561

    “I see no practical use of uClinux on STM32. This micro was not designed to run such OS. Big, slow, CM3 is not optimized to run from EMI.

    I don’t even see any practical use of uClinux on any micro. You always need external memory to store it and to run it. Why not real Linux instead?

    The only part you need to change is micro with MMU. Price for such micro is basically the same to one without MMU.”

    Best Regards,

    Guillaume FORTAINE

  6. February 3rd, 2012 at 00:40 | #6

    Well, essentially, what you are saying is, if you want to run Linux, use a MMU-full microprocessor; don’t use Cortex-M3.

    I am not sure I agree. Outside of the price, there are power considerations. Applications with low-power requirements is where Cortex-M3 shines. Perfect power profiles at dynamic times; plenty of low-power modes to choose from for static times. You don’t get that with a MMU-full processor.

    Consider an application that is idle most of the time but needs lots of “features” when active. True, uClinux requires external RAM to run from, however at idle times external RAM is idle too and draws very little power.

    uClinux may actually make perfect sense for higher-end Cortex-M3/M4 applications, including designs based on the STM32F2/F4 devices. With Linux, you get royalty-free support for pretty much all I/O interfaces (and there are plentty of those on STM32F) as well as lots and lots of ready-to-go tools and applications. Yet, you are able to be low cost and low power, which is why people choose Cortex-M in the first place.

  7. February 3rd, 2012 at 11:49 | #7

    The Kinetis K70 MCU Module (Cortex M4) with 128MB RAM is available for 109 USD, with Freescale Tower system it costs 179 USD. Link: http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=TWR-K70F120M

    I could not find open source ucLinux implementation for Kinetis K70, but emCraft has a new ucLinux stack for Kinetix K70: http://www.emcraft.com/index.php/products/95

  8. March 16th, 2012 at 06:32 | #8

    Hello,

    For your information :

    http://meteroi.com/?q=node/33

    “SEM-T37

    *Features

    -STM32F207 / Cortex-M3 MCU
    -SSD1963 TFT LCD Controller
    -1MByte SRAM for ucLinux
    -128/256MByte NAND Flash
    -64Kb I2C ROM
    -USB Device and USB Host Option”

    Best Regards,

    Guillaume FORTAINE

  9. March 19th, 2012 at 18:19 | #9

    Here is a pointer to the video of a live uClinux session running on the Freescale Kinetis K70 MCU:

    http://www.youtube.com/watch?v=UZjJrLG9CeA

    Linux (uClinux) runs just beatifully on this device. Using ‘dhrystone’, we get about 50% performance we get on a 250Mhz Freescale PowerPC box. Fast boot-up, lots of RAM (the TWR-K70 module provides 128MB of RAM and 256MB of NAND Flash), networking, JFFS2, framebuffer, SSH, HTTPD, Qt/E – all this runs just fine on K70. Overall user experience is your regular “embedded Linux” on an MMU-full microprocessor.

  10. March 19th, 2012 at 19:24 | #10

    I think it’s nice, so I blogged about it http://www.cnx-software.com/2012/03/19/uclinux-running-on-freescale-kinetis-k70-mcu-cortex-m4-module/.

    However, since you have framebuffer and Qt Embedded support, it would have been better to show Qt/E in the video.

  11. March 26th, 2012 at 22:44 | #11

    @ cnxsoft

    In the Kinetis K70 context, the only type of input device we support with Qt at this time is an emulated keyboard using stdin input. We are working on a device driver for the USB host interface, which will allow us to support USB mouse. When done, we will provide a Qt GUI video for uClinux on K70.

    Meanwhile, we have developed a video showing the Linux framebuffer and a Qt GUI demo for another Cortex-M3, NXP’s LPC1788. Details are available here:

    http://forums.nxp.com/viewtopic.php?t=5695

  12. April 19th, 2012 at 13:17 | #12

    Emcraft Systems has open sourced its ports of U-Boot and uClinux for Cortex-M3 and Cortex-M4 at github:

    https://github.com/EmcraftSystems

    For more information about supported reference platforms, refer to Emcraft’s web site:

    http://www.emcraft.com

  13. August 30th, 2012 at 03:52 | #13

    Would packages of ARMv7 thumb2 distributions like Debian armhf and Ubuntu on ARM work with Cortex-M4 MCUs? The kernel would still be a custom build, but having a package repository is a big help to application developers. They can then focus on coding their vertical app instead of building general purpose apps.

  14. September 26th, 2012 at 10:52 | #14

    @J Alvarez
    Sorry, for the very late answer. I don’t think it would be possible to use any Ubuntu or Debian packages on Cortex M processor, as they are not built against uClibc.

  15. Brendan Simon
    September 29th, 2013 at 20:33 | #15

    PHYTEC have a single board computer with a Freescale Vybrid A5 SOM for $55 and a Freescale Vybrid A5/M4 SOM for $65 :)

    http://www.phytec.com/products/single-board-computers/

  16. September 29th, 2013 at 20:52 | #16
  1. June 18th, 2012 at 15:13 | #1
  2. September 26th, 2012 at 13:48 | #2