Live data from Hacker News

So you want to build an embedded Linux system?

jaycarlson.net

31–40 of 113 posts

Re: So you want to build an embedded Linux system?

#31
post #24

Great article. He sings the praises of Linux memory management and virtual memory, which are unavailable on a microcontroller. Would be interested in comments on the downsides of swapping in a system with a small amount of onboard Flash that may wear out.

Swapping to EEPROM is a bad idea - not just on wear but it's a massive I/O bottleneck.

If you're out of RAM on an embedded project, rethink your design or add more RAM (if time and budget allow)

Re: So you want to build an embedded Linux system?

#32

I have been doing embedded for a number of years. I'm the only fulltime SWE at my company and it just gets exhausting managing 5 different products on completely different code bases/technologies. Plus a web portal that does device management and reporting. So a big thing people should consider when building something to scratch. Am I making something I can use again when I make my next product. Its a much higher men…

Sounds like my day job of the last 10 years or so.

Although I'm mostly focused on the app code, I spent about four months this year debugging various wifi stacks (one for each generation of product). Only to have most of the problems fixed by moving all products to a 5.7 kernel base. Which was no easy project in itself, but mostly not my work.

In my experience, the processor, memory, flash, and all other things combined are trivial compared to getting reliable wifi.

Re: So you want to build an embedded Linux system?

#33
post #11

I especially liked the section on DDR memory PCB routing and how it is less complicated than people make it out to be. At least for this application. Makes one want to try something like this

The part not discussed is how many PCB layers (signal, ground, more signal, more ground, etc) you need when laying down DDR.

If you are playing with a 2x2" EVK then 8 or 10 layers isn't a budgetary problem. When the board starts getting larger it's now it's a huge cost adder as opposed to low speed 2-layer PCB.

This is why designers switch to doing it with SOMs. The SOM can be a high-speed part and the carrier PCB is cheap and slow.

Re: So you want to build an embedded Linux system?

#34
> Yocto is totally the opposite. Buildroot was created as a scrappy project by the BusyBox/uClibc folks. Yocto is a giant industry-sponsored project with tons of different moving parts. You will see this build system referred to as Yocto, OpenEmbedded, and Poky, and I did some reading before publishing this article because I never really understood the relationship. I think the first is the overall head project, the second is the set of base packages, and the third is the… nope, I still don’t know. Someone complain in the comments and clarify, please.

Bitbake is the generic build system around which openembedded recipes (for particular packages) were implemented. Anyone could create a distro using those recipes, dates to the early to mid 2000s.

Yocto was/is a project of the Linux Foundation, basically a working group, where they looked at the state of embedded linux and said, "We want to contribute to this project with documentation and more recipes", starting externally but with hopes to get it mainlined. Poky was/is their reference distro for this effort.

Nowadays all the packages contributed by the Yocto project have been consolidated into openembedded, but poky remains the reference distro.

tl;dr: Yocto is first and foremost an organization of people. Bitbake is the build system. OpenEmbedded is a community of distro-agnostic build system recipes. Poky is a distro maintained by the Yocto organization utilizing OpenEmbedded recipes.

Re: So you want to build an embedded Linux system?

#35

If you want Wi-Fi, FCC certification is hard and expensive. For an off-the-shelf SBC you don’t have to, only need to place a sticker with FCC ID of the SBC. When embedding an SBC, you can fork the firmware from whatever Debian/Android/etc. variant is best supported by that SBC. Stripping down working and well tested Linux image is much easier than building a new OS image from scratch.

There are precertified laydown modules that can also do this. Laird (LSResearch), Telit, Redpine, and Murata are big producers of these.

Re: So you want to build an embedded Linux system?

#36

I have been doing embedded for a number of years. I'm the only fulltime SWE at my company and it just gets exhausting managing 5 different products on completely different code bases/technologies. Plus a web portal that does device management and reporting. So a big thing people should consider when building something to scratch. Am I making something I can use again when I make my next product. Its a much higher men…

Absolutely true. One of the things I learned decades ago as a solo entrepreneur was to force for as much commonality as possible across everything I was doing.

When you wear many hats you have to mentally task switch between domains and this time can sometimes be measures in weeks (example: you've been doing mechanical design and you now have to switch to FPGA design after months of not touching the codebase).

This is why jumping on the latest and greatest trends isn't always the best idea. Languages, tools, frameworks, new chips, new FPGA or CPU architectures, etc. Things that don't mesh at a certain level impose a cognitive load that can really slow you down.

The simplest example of this I have from years back would be using C and Verilog on embedded systems. While Verilog is not software, it's hardware the "C" feel to the language --as opposed to VHDL-- makes for an much easier transition between hardware and software development, at least for me.

Re: So you want to build an embedded Linux system?

#37
post #26
post #24

Great article. He sings the praises of Linux memory management and virtual memory, which are unavailable on a microcontroller. Would be interested in comments on the downsides of swapping in a system with a small amount of onboard Flash that may wear out.

Why would you enable swap?

I assume he sees "virtual memory", and jumps to thinking "swap". Which is rather common, but arguably a mistake.

Virtual memory is what allows for copy on write pages when forking. It is the preferred basis for implementing memory mapped files. It allows for sharing a single copy of shared library in ram, without causing everything to break if one program decides it wants to patch "its" copy of the library in memory.

Yeah sure it allows for paging out anonymous memory too, but that is hardly its sole function.

Re: So you want to build an embedded Linux system?

#38
Good read!

Some others that I have enjoined in the embedded Linux realm are the posts by George Hilliard, Mastering Embedded Linux series and the Designing my Linux-powered Business Card.

https://www.thirtythreeforty.net/posts/2019/08/mastering-emb...

https://www.thirtythreeforty.net/posts/2019/12/designing-my-...

Re: So you want to build an embedded Linux system?

#39
> Because C doesn’t have good programming constructs for asynchronous calls or exceptions, code tends to contain either a lot of weird state machines or tons of nested branches. It’s horrible to debug problems that occur.

Linux is in C though. So, what is really going on?

Re: So you want to build an embedded Linux system?

#40
Can someone more knowledgeable than me elaborate on this statement?

> when compared to application processors, MMUless microcontrollers are horribly expensive, power-hungry, and slow.

What is it about the lack of an MMU that causes a hunger for power?

Post reply on HN