Anyone know how to get started with embedded software?

I know it is at the opposite end of spectrum of a AArch64 server community, but at the ARM office hours, the question came up of how to get started with embedded systems. So I thought that I would the question here.

I used to do a bit of IoT at Intel. Competition was mbed https://os.mbed.com/
Or are you after bigger embedded systems?

I totally forgot about mbed…
I think that @mhall119 (who asked the question originally) is actually looking at lower level, where you would need a boot loader

One of my favorite topics :smiley:

It all depends on what level of abstraction you want to start at. For educational purposes it is ideal to learn from the bottom up especially if you are in no hurry or urgent need to build and ship something then starting with understanding instruction set architectures and working up from there with assembler as the lowest level of code abstraction is worth the time spent, then from there move on to C and C++. You will appreciate C and then C++ more if you go that route, also you will respect the need to optimize your code as embedded systems (in the sense of MCU’s are by their nature constrained) taking you back to the way programmers used to think about the hardware and memory underneath. The added bonus is that you will also really be greatful for higher level languages and garbage collection with C#, Java and even interpreted languages Python etc when you go this route.

You will most likely not use much assembler in the things you build and forget all the details you learned but the essence of the ISA stays with you and built into the way you code C.

Or you could start at a higher level with a specific manufacturer’s ecosystem, for example STM32 or NXP and these and other vendors add a lot of stuff to lift you higher up the abstraction ladder. Generally you code against HAL’s often at different levels and they often include GUI tools in their IDE’s to help with tasks like setting up your clock tree’s and of course your I/O pin configurations etc.

Otherwise you could go to what is possibly the highest level of abstraction where you still use code by using Arduino, which is not just a set of hardware boards but also a specification that includes a high level API and an IDE that lets you program at a very high level. Arduino does feel like you are at 30000ft above the actual hardware but its helpful for getting things done and seeing results quickly and may actually be fine for many cases.

Above that you have Micropython and then block languages I guess. There are other options to like Go or JS but these make you feel like you are far from the hardware. Theres even a growing fanbase of Rust which I have not touched yet so can’t comment on that.

With Embedded you are generally working directly on the hardware with no OS but you can of course utilize an RTOS which gives you basic multitasking with real time capabilities and often a HAL too.

Embedded consists of learning both software coding and hardware especially electronics interfacing. Trying to learn both together can also slow you down so its perhaps good to use Arduino to help learn the hardware interfacing part that way you can use many examples or work with code that is easy to right so you can focus on your wiring skills without wondering if the code is actually correctly setting the pin as the correct type of I/O and writing to the port.

This post is not exhaustive but the last part I want to tackle is which ISA do you start with? Well nowadays things are a bit more complicated which is perhaps where it seems hard to pick an inroad. Going back in time to the 90’s and 2010’s (thats the old days for me so I am skipping what happened before then) there were mostly 8bit MCU’s specifically the good old 8051 which was like the Arm core of its day. Lots of vendors backed the 8051 MCU core into their own products so that used to be one of the best ISA’s to start with. Also the PIC 16F was very popular and of of course the Atmel AVR’s all 8bit. Generally you picked what was popular in your region and went with that and these MCU’s were simple enough to figure out how to program just be using the datasheet if you were familiar with their architecture.

Today you should really be starting with 32bit as you can do so much more and its often cheaper than the old 8bits. A big win is that you can DSP and even ML on the 32bit stuff , btw that’s basically tinyML, running ML on MCU’s.

There are several architectures commonly used, for example ESP32 has its own Tensilica cores, there’s RISC-V cores and of course Arm cores. In the case of Arm Cores the Cortex M has actually become a defacto standard so I would recommend learning on the Cortex architecture. While the implementations across different silicon vendors differs in terms of peripherals etc, the core architecture is the same and thanks to CMSIS you can move between vendors with the same understanding of the core. I am not saying Arm just because we are an Arm community, there is a reason why so many vendors use Arm MCU’s. The latest generation of Cortex M55 and up and the Ethos NPU for examples of highly performant low power systems that can do ML workloads something you perhaps only find in the ML accelerators but not necessarily in the other architectures yet. The more standard Armv7 and Armv8 Cortex M’s can do a lot of work on a good power budget etc. You are actually spoiled for choice.

With that in mind I recommend the RP2040 which is Raspberry Pi’s MCU and the Raspberry Pi Pico which is a decent and well priced product that you can tackle using a lower level approach using the arm-gcc compiler and then use with Arduino and even with MicroPython. The RP2040 is also a dual core device. I have not had time to mess with it at a low level but when I took a glance at the docs I was impressed as you have a product you can use to teach at different levels.

Otherwise if you want to learn at a bit of a higher level and be productive and perhaps work on projects used in real production grade systems the STM32 and the Cube ecosystem is perhaps a good way to get started and a balance of features and abstraction levels to work at.

Oh and as far as RTOS’s go there are lots of options out there but mBed is really great its actually a RTOS and a HAL in one and its so great that Arduino uses it behind the scenes to support many of the the 32bit Arm MCU’s.

There is a lot I skipped over and a lot more to be said but that’s just a rusty guide and there may be another MCU product suite that is the ultimate one to start learning on that I am not aware of.

wow thanks for the great answer. I will have to go through it a couple of times…