logoalt Hacker News

saltmatetoday at 12:55 PM3 repliesview on HN

This seems very well written, but has a lot of requirements/previous knowledge required by a reader. Are there similar resources that fill these gaps?


Replies

randusernametoday at 1:49 PM

I like Realtime C++ (Kormanyos) and Making Embedded Systems (White)

The former is probably more what you are looking for.

birdsongstoday at 1:23 PM

I only skimmed the book, but I think this is an artifact of the embedded engineering side. (Something I do professionally.)

I've seen a lot of new people come into my team as juniors, or regular C/C++ engineers that convert to embedded systems. There is a real lack of good, concise resources for them, and the best result I've had is just mentoring them and teaching as we go.

You could look for an intro to embedded systems resource. Or just get a dev kit for something. Go different than the standard Pi or Arduino. Try and get something like a STM32G0 dev kit working and blinking its lights. It's less polished, but you'll have to touch more things and learn more.

If you want, core areas I would suggest to research are the very low level operations of a processor:

* How does the stack pointer work? (What happens to this during function calls?

* How do parameters get passed to functions by value, by reference? What happens when you pass a C++ class to a function by value? What is a deep vs shallow copy of a C++ object, and how does that work when you don't have an OS or MMU?

* Where is heap memory stored? Why do we have a heap and a stack? How do these work in the absence of an OS?

* The Program Counter? (PC register). What happens to this as program execution progresses?

* What happens when a processor boots, how does it start receiving instructions? (This is vague, you could read the datasheet for something like the STM32G0 microcontroller, or the general Arm Cortex M0 core.)

* How are data/instructions loaded from disk to memory to cache to register? What are these divisions and why do we have them?

* Basic assembly language, you should know how loads and stores work, basic arithmetic, checks/tests/comparisons, jump operations.

* How do interrupts work, what's an ISR, IRQ, IVT? How do peripherals like UART, I2C (also what are these?), handle incoming data when you have a main execution thread already running on a single core processor?

Some of this may be stuff you already know, or seem rudimentary and not exactly relevant, but they are things that have to be rock solid before you start thinking about how compilers for differently languages, like C++, create machine code that runs on a processor without an OS.

Assembly is often overlooked, but a critical skill here. It's really not that bad. Often when working with C++ (or Rust) on embedded systems, if I'm unsure of something, my first step is to decompile and dump the assembly to investigate, or step through the assembly with GDB via a JTAG probe on the target processor if the target was too small to hold all the debug symbols (very common).

Anyways, this may have been more than you were asking for. Just me typing out thoughts over my afternoon coffee.

skydhashtoday at 1:41 PM

I'm not a professional embedded engineer, but I do hack around it. Some books I collected:

- Applied Embedded Electronics: Design Essentials for Robust Systems by J. Twomey. It goes over the whole process making a device and what knowledge would be required for each. Making Embedded Systems, 2nd Edition by E. White is a nice complement.

- Embedded System Interfacing by M. Wolf describes the signals and protocols behind everything. It's not necessary as a book, but can help understand the datasheets and standards

- But you want to start with something like Computer Architecture by C. Fox or Write Great Code - Volume 1 - Understanding the Machine, 2nd Edition by R. Hyde. There are better textbooks out there, but those are nice introductions to the binary world.

The gist is that you don't have a lot of memory and CPU power (If you do, adapting Linux is a more practical option unless it's not suited for another reason). So all the nice abstractions provided by an OS is a no go, so you need to take care of the hardware and those are really finicky,