
Linux on STM32 Microcontrollers - donquichotte
https://elinux.org/STM32
======
tyingq
Is this just an experimental/fun exercise? The boards have 8 to 16mb of RAM
and are likely more expensive than some other platform with more RAM.

Just seems like taking a good product and trying to use it in an
odd/unintended way.

~~~
leggomylibro
It does seem like it at a first glance - these are Cortex-M microcontrollers
which are really not suitable for running a full-fledged OS. They don't even
have an MMU, and they usually only have ~10-100KB of RAM on the chip. Plus,
only some packages with >144 pins are able to memory-map external RAM chips
like these evaluation boards do.

It's a very cool and impressive project, but I wouldn't use it to write an
application. Besides cost, the biggest reasons to use these instead of
Cortex-A chips are power efficiency and simplicity, and implementing things
like process isolation in software seems like throwing all that out the
window.

But on the other hand, if your device will be plugged in and power consumption
isn't a huge concern, I could definitely see the appeal to having things like
a Ruby interpreter or an X server running on your MCU. You could compile and
deploy existing code, ideally. But I bet it would take more time to get all of
that working well than it would to just write your application with an SDK and
an RTOS.

Also, I'm guessing this project predates the STM32MP1:
[https://www.st.com/en/microcontrollers-
microprocessors/stm32...](https://www.st.com/en/microcontrollers-
microprocessors/stm32mp1-series.html)

~~~
vardump
> They don't even have an MMU,

But they might have an MPU.

[http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc....](http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0439b/Chdecfea.html)

~~~
leggomylibro
The MPU does look more capable than I'd originally thought, but it still seems
very restrictive for general-purpose computing. 8-16 slots and difficult data
boundary/width conditions:

[http://embedded-computing.com/articles/security-and-the-
cort...](http://embedded-computing.com/articles/security-and-the-cortex-m-
mpu/)

Like I said, this is a very impressive project and I admire the people who
were able to make it happen, but in the context of writing an application it
sort of seems like a solution looking for a problem.

It reminds me of running Linux on the Nintendo DS. You _can_ , and it's a
fascinating toy, but the games are written bare-metal for a reason.

~~~
vardump
If the Linux kernel on STM32 has something important to offer for the
application, like quicker time to market, while meeting the requirements and
hitting price targets, why not?

But yeah, if I needed to run Linux, I'd quickly pick something like Cortex
A53, Cortex R52... etc. But hey, there might be a niche for Linux running on
STM32.

Doing embedded (and drivers) at dayjob.

------
analognoise
I'm a much bigger fan of either bare metal or an RTOS for embedded systems;
it's amazing how people will shoehorn Linux into places it doesn't belong,
because Linux.

~~~
benj111
But on the other hand if you just want to collect a few sensor readings and
don't want to learn an entire new stack....

~~~
bschwindHN
If you want to collect a few sensor readings and don't want to learn an entire
new stack...just use Arduino. Yes it's "learning a new stack" but honestly I
bet it's easier than getting Linux to run on something it shouldn't be running
on.

~~~
benj111
"something it shouldn't be running on"

That's not a law of nature though. Linus Torvalds hasn't decreed "thou shall
not run this on an MCU". If it runs on an MCU that's fine. Theres a rich
history of using computers for things they weren't designed for.

Id agree though, Arduino is in general the way to go, but STM32 is cheaper
than Arduino and it depends what you're wanting to do.

~~~
tyingq
_" STM32 is cheaper than Arduino"_

Wait, what? Did you mean the opposite?

~~~
vardump
Some STM32 chips can go below $0.50 (?). Not chips like in the article,
though. Quick Digikey search came up with $0.83 for STM32L011F4U6TR (32 MHz
Cortex M0+, 16 kB program memory, 2 kB data RAM, 512 bytes EEPROM).

Atmels ("Arduinos") were a bit cheaper in general, but then again it's hard to
compare MCUs without application requirements in mind. Like if I needed 32 MHz
Cortex M0+ class performance, comparable Atmels would be more expensive (I
think).

The conclusion is, either one can be cheaper. Depends on the requirements.

~~~
benj111
I was talking dev boards not bare chips.

If you're going with an MCU that's uses Linux because you don't want to learn
another platform you aren't the demographic to be buying bare chips.

Can you even get bare stm32s in hand solderable form factors???

~~~
vardump
> If you're going with an MCU that's uses Linux because you don't want to
> learn another platform you aren't the demographic to be buying bare chips.

Say, you have an existing prototype running on Linux and production ready (or
nearly) hardware. Porting it to another platform might delay the launch and
make you go out of business.

Just playing devil's advocate.

~~~
tyingq
The other choice is SOC setups that are already proven with uCLinux, like the
various chips used in home routers. Also minus MMU, etc, but with dev boards
that already have reasonable amounts of RAM and proven field success.

That's why I'm confused with this project. FriendlyARM, for example, already
has cheap uCLinux proven boards with a bundled display, which seems to be what
this is trying to be.

I'm assuming this project was just a personal _" itch to scratch"_, which is
cool, but doesn't make it generally useful.

~~~
vardump
Yes, there are "better" choices, but perhaps not within product budget. Or
perhaps missing some I/O feature, like high frequency ADC channels. Or any
other parameter you need to optimize for. When you're making 100 000 gadgets,
you really have to think about BoM.

> ... uCLinux proven boards with a bundled display, which seems to be what
> this is trying to be.

I don't see any reason to think that's what this projects tries to be? Just
because some dev board happened to have a display?

> I'm assuming this project was just a personal "itch to scratch", which is
> cool, but doesn't make it generally useful.

Now, I don't see a need to personally use this project in production. But I
don't either think it's outlandish if someone else does. In the end, nothing
is generally useful in the embedded space, it's all just smaller and smaller
niches.

