3
\$\begingroup\$

MMU is needed to run Linux and perhaps for other tasks related to OS. However, the PIC32 does not have one of these. Why would someone make a high end microcontroller and not include a MMU?

It may make sense for lower level PICs like PIC18F, PIC24 to not have MMU, but why did Microchip not put in an MMU into the PIC32 which is their high end processor?

\$\endgroup\$
  • 3
    \$\begingroup\$ Don't use Linux on an MCU. If you need multitasking, use a lightweight RTOS kernel like FreeRTOS. \$\endgroup\$ – Peter Jul 13 '15 at 3:06
  • \$\begingroup\$ PIC32MZDA should be able to run Linux. I am going to give it go. Take a look at this site: lwn.net/Articles/667824 \$\endgroup\$ – Ted Apr 9 '18 at 19:14
4
\$\begingroup\$

PIC32 does mot have Memory Management Unit ...

But it does.

The PIC32 uses the MIPS architecture, which normally is paired with an MMU. When Microchip designed the PIC32MX family, they left it off. The largest PIC32MX, in terms of memory, is the high-end PIC32MX795F512L which has 512KB of program flash and 128KB of RAM.

However the newer PIC32MZ family, introduced earlier this year, does have an MMU (or so the datasheet claims on the first page; I haven't used it yet).

enter image description here

The PIC32MZ2048ECM144, for example, has 2MB of program flash and 512KB of RAM. I'm pretty sure this is still not enough to run a real version of of Linux. In any case I'm guessing Microchip will continue to come out with new PIC32MZ versions with increasingly larger memory spaces. Ideally, they might come out with a PIC32 that has an external memory interface (appearing in the memory map as regular memory, not a peripheral). PIC32s already can run code out of either flash or RAM.

A while back I saw a job listing from Microchip for a Linux drivers engineer. Hmm.

\$\endgroup\$
  • \$\begingroup\$ I am involved in a port of BSD to the MZ chips. Part of the RetroBSD project. \$\endgroup\$ – Majenko Jul 14 '15 at 13:39
  • \$\begingroup\$ The PIC32MZ...DA chips are now available. Either with 32MB internal DDR or an external DDR interface for up to 128MB DDR. Also a GPU for direct driving of an LCD panel. \$\endgroup\$ – Majenko Jan 14 '18 at 23:49
  • \$\begingroup\$ @Majenko in fact I am currently using the 32 MB version of the MZ DA for a voice recognition project. \$\endgroup\$ – tcrosley Jan 14 '18 at 23:54
  • \$\begingroup\$ Excellent. Shame they didn't make a DAF version with the EF's FPU in it. \$\endgroup\$ – Majenko Jan 14 '18 at 23:56
5
\$\begingroup\$

First, the PIC32 doesn't run Linux. A cursory Google search shows a lack of working full-fledged Linux distributions or kernel builds for the PIC32 (for reasons such as insufficient RAM, lack of interest)

Second, while it may be a high-end offering, it is still a microcontroller, whose purpose is somewhat different from a general-purpose processor. It only carries up to 32 KB of physical RAM, which is definitely not enough.

However, a reading of the PIC32MX family datasheet shows that the PIC32 family contains a "fixed mapping translation" unit for virtual memory. This MMU-like feature does implement memory-mapping resources such as flash, as well as kernel/user segmentation.

Edit: I can't answer why Microchip doesn't get involved with Linux/Android, as I don't work for Microchip. I can only say that, based on the specifications of the specific microcontroller that you mention, it may be high-end for a microcontroller/microprocessor, but is not sufficient for a Linux-based system, let alone one running a Java VM, with a JIT (won't happen due to memory, and because JIT on a Harvard architecture is a questionable premise). A microcontroller is designed to act in a simple embedded application in a low-latency and highly reliable manner, and running Linux or Android is not necessarily conducive to doing things cheaply, and in a reliable and realtime manner.

\$\endgroup\$
  • \$\begingroup\$ I was wondering that since OS is important for complex applications and android and other linux distributions have become so popular, it does not make sense for Microchip to stay away from it, \$\endgroup\$ – quantum231 Jul 13 '15 at 0:23
  • \$\begingroup\$ @quantum231 Please see edits. \$\endgroup\$ – Andrey Akhmetov Jul 13 '15 at 0:31
  • 1
    \$\begingroup\$ At MASTERs 2014, Microchip CEO Steve Sanghi make comments to the audience during his keynote regarding PIC32 and Linux. His comments were basically "We hear you loud and clear", i.e. there may be some future developments in that direction, but the existing lines would likely face challenges without the ability to address external RAM and Flash. \$\endgroup\$ – Adam Lawrence Jul 13 '15 at 1:12
  • 1
    \$\begingroup\$ The PIC32 has way more than 32 KB of RAM. The PIC32MX family has a maximum RAM of 128 KB. The newer PIC32MZ has a maximum RAM of 512 KB. \$\endgroup\$ – tcrosley Jul 13 '15 at 7:36
1
\$\begingroup\$

An MMU is primarily useful in cases where a system will need to host multiple processes with independent arbitrarily-overlapped lifetimes. Support for such actions is essential in Linux, but completely unnecessary in many embedded applications where all processes are established on startup, and continue to run until the system is powered off or reset.

In general, there are significant tradeoffs between a system's ability to adapt to dynamically-changing usage requirements and its ability to guarantee consistent timely responses to stimuli. Something like an automatic guided vehicle's motion control system may need to perform some calculations 10,000 times/second consistently without hiccups, but may have no need to keep some processes active while others are changed. It may be completely sufficient for it to have a command to "confirm that vehicle is motionless and brakes are set, then reboot." If there is no need to have a system's memory layout change while processes are active, there's little benefit to having an MMU.

\$\endgroup\$
1
\$\begingroup\$

I think you can use µClinux ; μClinux is a fork of the Linux kernel for microcontrollers (in embedded systems) without a memory management unit (MMU).

\$\endgroup\$
  • \$\begingroup\$ wouldn't any real world OS need a MMU? \$\endgroup\$ – quantum231 Jan 7 '17 at 15:31
  • \$\begingroup\$ @quantum231 what is your definition of "real world OS"? To me, things like FreeRTOS or uClinux (although this one doesn't seem to have been ported to PIC32, unlike what this answer suggests) can definitely be called a real OS, and they don't need a MMU. The MMU just makes it possible to virtualize the address space, which is very handy to make better use of the memory ressources when applications are run dynamically, but it isn't required for many devices (which still use a "real" OS to provide hardware resources management, threading, ...) \$\endgroup\$ – dim Jan 7 '17 at 21:10
  • 1
    \$\begingroup\$ You are right , I have checked µClinux official web-site ,it doen't support PIC32 . FreeRTOS is a good choise for your application (open source license ) \$\endgroup\$ – Mohammed Amine Jan 15 '17 at 23:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.