Resources for a computer programmer to get started with embedded programming?
Vito wrote 03/22/2016 at 16:17 • 3 pointsWhat reads / websites would you suggest to someone who want to start with embedded firmware programming and is already a skilled computer and mobile developer?
Talking specifically about ARM 32bit, such as Cortex M0
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
I wish I knew an easy answer to this one!
For hardware, it's hard to beat the ST Nucleo boards for price/performance at the moment. They've got a first-class programmer/debugger onboard, plus the chip of your choice, in an Arduino-compatible form factor (easier for noobs to plug in expansions) but also with rational pins on the outside.
ARM-0? Get the STM32F072 nucleo board. The 072 chip is rad. IMO.
If you want peripherals as well, the Discovery series are also a good value. I love the F4 Disco board -- has IMU and audio codecs and a microphone onboard. But that's a Cortex-M4.
If you want to start far from the hardware, there's mbed. If you want to start near, get the programmer's manual and CMSIS. Somewhere in the middle is ST's older SPL, the new Cube or the community-developed libopencm3 libraries. I've just started messing around with the latter, and it looks very nice to me. I may do a series of writeups focusing on it next month.
Are you sure? yes | no
Thanks to all!
I am actually (kind of) an ARM developer myself, so I know already many of the sources you mentioned.
Embed With Elliot is a good start! I had to learn those things the hard way :)
I want to introduce a friend of mine to embedded world, he comes from computer programming. I'd like him to gets hand dirty with bare-metal MCU programming in C. So, more or less in a professional way, with as little overhead as possible (no RTOs, no translation from higher-level language, little pre-configured libraries, etc...).
So I am looking for a book or something specifically targeted to computer programmer, that would focus on differences between the two styles of programming and how to mind the constraints that embedded systems have (rather than let the programmer keep his "computer" style).
I wonder if something like that exists?
Are you sure? yes | no
You would save everyone a lot of time stating out exactly what you want right from the beginning. Not making friends here by saying that you know it all already. Post your links at least.
Are you sure? yes | no
Sorry, could have been more clear.
ARM documentation is king, however not really easy to grasp at first attempt.
Good thing, all Cortex-M processors share the same software structure which they call CMSIS:
http://www.arm.com/products/processors/cortex-m/cortex-microcontroller-software-interface-standard.php
It is basically a collection of core files + optimized library + headers that map all the peripheral of the processor. Those headers make it easy to use mnemonic names to access all the functionalities.
Then there is Cortex-M0 doc http://www.arm.com/products/processors/cortex-m/cortex-m0.php, which btw is only the core: each company will configure the processor as they like it, so one must refer to vendor documentation (e.g. STM32xxx datasheet).
As IDE I started with Keil, which is easy, has debugging capabilities and not too much to configure, and gives you access to all packs and libraries with a click. But with the free version you get stuck to the 32kB limit, and they asked me something like 4k€ to get the full version. 32kB can be enough for a DIYer, but it's a waste to have a chip with 256kB of flash and only using 1/8th of it.
Eclipse has way more useful features while it is less responsive, it is less "integrated" with ARM chips and it has some quirks here and there. But it does the job, and it's free. It's a real pain to configure (at least it was for me). As already pointed out, there is a GCC-equivalent toolchain for it, pretty well developed and documented.
STM32 discovery boards are really nice in my opinion, some even have already a debugger on them.
This one is much cheaper than Arduino (about 10 bucks), lets you program like the "adults" do, has a debugger on the same board (which you could also use to program other ARM chips):
http://www.st.com/web/en/catalog/tools/FM116/SC959/SS1532/PF250863?sc=stm32-discovery
Something I don't understand about "educational" boards such as *duino and Teensy is why they don't have a debugger by default. For a beginner, I think it is *really* important to be able to see where your code is stuck, step into the code, read variables, registers, program counter etc.
mBed seems to be done to semplify the job and program at higher level. However it looks to me like yet another layer, and you don't get your hands dirty enough. And I also think too much abstraction makes you loose the view on memory (FLASH and RAM) consumption, which are important factor on lowest-series CPUs like the ones I am interested in.
Same thoughts about other similar things like javascript translator etc. Not saying they are evil or bad, just it's not what I am looking for.
That said, I can help my buddy with all the above stuff, like suggesting a board and a way to set up the IDE.
This link from post below, and other posts of same series, is something interesting: http://www.valvers.com/open-software/raspberry-pi/step01-bare-metal-programming-in-cpt1/
Are you sure? yes | no
I'm trying to do exactly the same myself. Right now I narrowed myself to the Raspberry Pi because there are a lot of resources, a good toolchain and you can even debug the ARM with openOCD and some cheap FTDI ICs.
Some resources
https://github.com/dwelch67/raspberrypi
http://wiki.osdev.org/Raspberry_Pi_Bare_Bones
http://www.valvers.com/open-software/raspberry-pi/step01-bare-metal-programming-in-cpt1/
http://blog.thiago.me/raspberry-pi-bare-metal-programming-with-rust/
http://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/
Are you sure? yes | no
Dang-near Zero ARM experience, here... but the latest Embed With Elliot seems useful beyond how to program makefiles...
http://hackaday.com/2016/03/22/embed-with-elliot-arm-makefile-madness/
Are you sure? yes | no
Currently I'm using Platformio (http://platformio.org/) to program a STM32F4 board using the mbed framework. With the Platformio IDE (Atom-based) it's really easy to write, compile and upload code.
Are you sure? yes | no
STM32F series is very well supported by the various free/open source RTOS. I actually find it easier to program in a RTOS (ChibiOS) as it is easier for me anyway to code in threads for more complex programs. Right now I am going the other direction learning to code bare metal by reading the reference manual directly.
I highly recommend getting a hardware debugger and a decent IDE that does source code level debugging.
Are you sure? yes | no
https://www.mbed.com/ is probably a good starting point. AFAIK it teaches you less bad habits than Arduino (which I'm *sure* someone will suggest). It's specifically targeted at ARM and now has some cool asynchronous features.
At the other end of the spectrum I would also look at http://www.espruino.com/, which uses JavaScript and as such, makes you think asynchronously out of the box.
Are you sure? yes | no
Tom Van den Bon mentioned to me the other day that Keil MDK is free for STM32F0 and STM32L0 parts. You'll need to fill out online form to install and get a node license.
http://www2.keil.com/stmicroelectronics-stm32/mdk
Keil also have a free/demo version of the compiler for the rest of the ARM chips.
Good enough to get started and you can also switch to GCC toolchain from the environment.
Are you sure? yes | no
As far as I know the toolchain for ARM processors is hard to get a grip on. Even as a embedded developer by day I struggled a bit. I went with the STM32 and cubeMX but I'm not sure if thats the easiest entry point. Listening in on this one!
Are you sure? yes | no