Skip to content

Commit 5e40d2e

Browse files
authored
Add 'best and worst mcu sdks post' (#153)
1 parent 680acf3 commit 5e40d2e

File tree

6 files changed

+341
-0
lines changed

6 files changed

+341
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
_site
44
vendor
55
example/*/build
6+
.venv
Lines changed: 340 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,340 @@
1+
---
2+
title: The Best and Worst MCU SDKs
3+
description:
4+
A detailed comparison of ARM Cortex-M Microcontroller SDKs and BSPs, from best
5+
to worst.
6+
author: francois
7+
---
8+
9+
In 2020, an MCU is much more than a hunk of silicon. Indeed, it comes with a
10+
whole ecosystem including a BSP, integrated third party libraries, tooling,
11+
field application support, and more.
12+
13+
As firmware engineers, we are often handed down an MCU selection as a fait
14+
accompli. Cost concerns, peripheral, or pinout requirements often take precedent
15+
over the SDK.
16+
17+
Yet we are allowed to have an opinion. So here for you today is my first post in
18+
a new “comparing MCU SDKs” series.
19+
20+
<!-- excerpt start -->
21+
22+
In this post, I download SDKs for 10 popular Cortex-M4 microcontrollers, and
23+
evaluate how straightforward it is to get a simple example compiling. I include
24+
some step by step instructions to get started, a rating out of 10, and a few
25+
comments.
26+
27+
<!-- excerpt end -->
28+
29+
It goes without saying that this is an opinion based on my own very specific
30+
setup (MacOS, vim). Your mileage may vary!
31+
32+
{% include newsletter.html %}
33+
34+
{% include toc.html %}
35+
36+
## What I’m looking for in a chip SDK
37+
38+
My ideal chip SDK provides for a way to build and flash projects using tools of
39+
my choosing. This seems like a low bar, but few meet it. Here are things chip
40+
SDKs should **not** do.
41+
42+
### Don’t choose my laptop OS for me!
43+
44+
I left Windows behind when I worked at Sun Microsystems, and I have not looked
45+
back. Today, my daily driver is a MacBook Air. Unfortunately, some chip vendors
46+
require that you use their Windows-based tools to setup and build your projects.
47+
Now that most compilers are cross-platform, there is no excuse for it.
48+
49+
### Don’t chose my IDE for me!
50+
51+
I’ve been using `vim` since college, and you can take it from my cold, dead
52+
hands. I love `vim`! I have it configured just saw. It’s lightweight, it’s fast,
53+
and modal editing is the way to work (prove me wrong!). So you’ll understand my
54+
dismay at the spate of Eclipse-based IDEs chip vendors want to foist upon me. I
55+
want nothing to do with their boated, Java environments.
56+
57+
Instead of Eclipse-based IDE, I suggest SDKs provide Makefiles. `make` is the
58+
lowest common denominator build system, and is well supported by many tools.
59+
Bonus points for project files for IAR and Keil, since many of you like those
60+
tools.
61+
62+
### Do include some examples
63+
64+
If a picture is worth a thousand words, then a working code example is worth a
65+
million. Give me one example of each of the main use cases for your MCU. Bonus
66+
points if you give me an example for each peripheral.
67+
68+
## Ten Popular Chip SDKs, Ranked
69+
70+
### Nordic Semi nRF5-SDK - 10/10
71+
72+
Nordic semiconductor’s line of Cortex-M4 MCUs includes the nRF52810, nRF52810,
73+
and nRF52840. All feature a 2.4GHz radio, which may deter you if all you want is
74+
an MCU.
75+
76+
The nRF5-SDK (soon to be replaced by the equally excellent nRF-Connect-SDK), is
77+
in my view the best chip SDK out there.
78+
79+
#### Why the rating
80+
81+
* Cross-platform ✅
82+
* Supports armcc/Keil, IAR, and Makefiles ✅
83+
* Lots of bundled examples ✅
84+
* Single zip, no install needed ✅
85+
86+
The nRF5 SDK does everything right. No registration, no install, no online
87+
configurator. It even is distributed under a BSD license!
88+
89+
#### Compiling a Blinky example
90+
1. Download the nRF5 SDK from [nRF5 SDK downloads - nordicsemi.com](https://www.nordicsemi.com/Software-and-tools/Software/nRF5-SDK/Download#infotabs)
91+
2. Unzip the resulting `DeviceDownload.zip` file
92+
3. Unzip the SDK archive contained within. In my case that’s `nRF5SDK1702d674dde.zip`
93+
4. `cd` to the example you are interested in. Examples are contained within the `example` folder. In my case, `examples/peripheral/blinky/pca10040/blank`.
94+
5. `cd` to the build system folder of your choice, in my case `armgcc`
95+
6. Build the example, in my case by invoking `GNU_INSTALL_ROOT= make`
96+
97+
This will generate a `bin`, `elf`, and `hex` file (among others) under `_build`.
98+
99+
### Texas Instruments TivaWare - 9/10
100+
101+
The Tiva C series is the latest entry in Texas Instruments’s line of Cortex-M
102+
microcontrollers. I do not have a lot of experience with them, but they seem
103+
like solid microcontrollers with a broad range of peripherals (including USB).
104+
105+
#### Why the rating
106+
107+
* Cross-platform ✅
108+
* Supports armcc/Keil, IAR, and Makefiles ✅
109+
* Lots of bundled examples ✅
110+
* Single zip, no install needed ✅
111+
112+
Like Nordic, Texas Instruments gets a lot right: single-zip download, multi-IDE
113+
support (including Makefiles), and lots of examples. I knocked off a point for
114+
the wonky `exe` file (see below) and the more complicated license.
115+
116+
#### Compiling a Blinky example
117+
118+
1. Download TiWare SDK from [SW-TM4C_2.2.0.295, TI.com](https://www.ti.com/tool/download/SW-TM4C)
119+
2. Rename the downloaded file from `exe` to `zip`
120+
3. Unzip it
121+
4. `cd` to the example you are interested in. In my case `examples/boards/dk-tm4c129x/blinky`.
122+
5. Run `make`, or open the IDE-specific folder of your choice.
123+
124+
You’ll be left with an `axf` (aka an ELF) and a `bin` file in the `gcc` folder.
125+
126+
### NXP MCUXpresso - 9/10
127+
128+
![](img/best-and-worst-mcu-sdks/E2992448-AC4D-4A31-9B86-E4806F729E51.png)
129+
130+
NXP Kinetis traces its lineage to Motorola via Freescale. It is one of two
131+
Cortex-M lines from NXP (the other being the LPC). Like many MCU vendors, NXP
132+
generates their SDK via a configurator and provide an Eclipse-based IDE, both
133+
under the “MCUXpresso” brand.
134+
135+
#### Why the rating
136+
137+
* Cross-platform ✅
138+
* Supports armcc/Keil, IAR, and Makefiles ✅
139+
* Lots of bundled examples ✅
140+
* Single zip, no install needed ⚠️
141+
142+
I found the online MCUXpresso SDK builder a breeze to use. It is snappy,
143+
straightforward, and it keeps track of all your previously configured SDKs.
144+
Great job, NXP! The only downside of the tool is that it requires you to
145+
register on their website.
146+
147+
I still have a preference for the monolithic SDK with all examples and targets
148+
in one place, but you could argue that this generates a smaller, more
149+
streamlined SDK.
150+
151+
Best of all, the SDK uses `cmake` to generate build files. `cmake` is arguably
152+
more portable than `make`, as it is supported natively on Windows.
153+
154+
#### Compiling a hello world example
155+
156+
1. Go to the MCUXpresso SDK builder and create an account: [MCUXpresso SDK Builder](https://mcuxpresso.nxp.com/)
157+
2. Once logged in, click on “Select Board” in the sidebar
158+
3. Enter the name of your MCU. In my case, a Kinetic K21
159+
4. Click on “Build MCUXpresso SDK” on the right
160+
5. Name your project, select a toolchain, and some third party software like FreeRTOS or mbedTLS.
161+
6. Click on “Download SDK” at the bottom
162+
7. After a bit, the SDK will be ready for download
163+
8. Unzip the SDK
164+
9. `cd` to the example of your choice, in my case `boards/twrk21d50m/demo_apps/hello_world/`
165+
10. `cd` to build system folder, in my case `armgcc`
166+
11. Use the `build_debug.sh` build script and specify the`ARMGCC_DIR` environment variable:
167+
e.g. `ARMGCC_DIR=/usr/local/Cellar/arm-none-eabi-gcc/9-2019-q4-major sh build_debug.sh`
168+
169+
This will generate an ELF file.
170+
171+
### STM32 Cube - 8/10
172+
173+
![](img/best-and-worst-mcu-sdks/6DA202F6-ED4E-4FFE-94B7-3A549D0F212F.png)
174+
175+
ST has gone through multiple iterations of the SDK for the STM32 family of ICs.
176+
The latest is called STM32 Cube, which replaces the venerable Standard
177+
Peripheral Library. While Cube introduces a lot of complexity, it does so for a
178+
good reason: the STM32 family has grown to include 14 distinct series of MCUs
179+
from the very low power L0 to the very high performance H7.
180+
181+
#### Why the rating
182+
183+
* Cross-platform ✅
184+
* Supports armcc/Keil, IAR, and Makefiles ✅
185+
* Lots of bundled examples ✅
186+
* Single zip, no install needed ❌
187+
188+
While Cube comes with support for many IDEs, and more examples than any other
189+
MCU SDK, it wraps it all in a clunky desktop app. I had a terrible time using
190+
STM32CubeMX: I had to install it on my laptop, it’s slow, it’s large, it’s
191+
clunky. I do not like it.
192+
193+
STM32CubeMX generates a “project” directory based on your configuration. This
194+
means that you won’t have all the example code in one folder, and instead will
195+
need to generate different projects for different examples.
196+
197+
Necessary complexity? Perhaps. But I miss the simpler Peripheral Library which
198+
came as a single archive.
199+
200+
#### Compiling a Hello World example
201+
202+
1. Download and install CubeMX: [STM32CubeMX - STM32Cube initialization code generator - STMicroelectronics](https://www.st.com/en/development-tools/stm32cubemx.html). Note: this requires registration on ST’s website
203+
204+
3. Select “ACCESS TO MCU SELECTOR”
205+
4. Select the part you are using. In my case “STM32F429IE”
206+
5. In the Configuration view, click on the “Project Manager” tab
207+
6. Enter a project name, a path, and select a toolchain. In my case “Makefile”
208+
7. Click on “Generate Code” at the top right
209+
8. `cd` to the generated project directory
210+
9. Compile the project with your build system. In my case with `make`.
211+
212+
### Atmel START for SAMD - 7/10
213+
214+
![](img/best-and-worst-mcu-sdks/83E37D9A-5975-4815-8937-437DA8675C0D.png)
215+
216+
Recently acquired by Microchip, Atmel has been making SAM-family MCUs for a long
217+
time. The SAMD21 is well liked in hobbyist circles and is featured in several
218+
Arduino and Adafruit designs. Atmel’s peripheral library, AXF, went through a
219+
similar transformation to ST’s: it went from a single zip archive to a
220+
configurator.
221+
222+
#### Why the rating
223+
224+
* Cross-platform ✅
225+
* Supports armcc/Keil, IAR, and Makefiles ✅
226+
* Lots of bundled examples ✅
227+
* Single zip, no install needed ❌
228+
229+
Atmel’s configurator is web based, and a tad more ergonomic than ST’s. However,
230+
the resulting Makefiles are much worse and even feature a bug (I had to fix OS
231+
detection).
232+
233+
#### Compiling a hello world example
234+
235+
1. Go to start.atmel.com
236+
2. Click on “Create New Project”
237+
3. Select your MCU. In my case a SAMD51 Chip.
238+
4. Click on “Export Project” at the top right
239+
5. Give it a name, and tick the check-box for your IDE (for me: Makefile)
240+
6. Click on “Download Pack”
241+
7. Rename resulting file from `.azip` to `.zip`
242+
8. Extract it
243+
9. `cd` to into IDE folder, in my case `gcc`
244+
10. Fix Makefile OS detection:
245+
```diff
246+
@@ -22,7 +22,7 @@ else
247+
MK_DIR = mkdir -p
248+
endif
249+
250+
+ ifeq ($(shell uname | cut -d _ -f 1), Darwin)
251+
- ifeq ($(shell uname | cut -d _ -f 1), DARWIN)
252+
MK_DIR = mkdir -p
253+
endif
254+
endif
255+
```
256+
11. Run `make`
257+
258+
### Silabs Simplicy Studio - 5/10
259+
260+
![](img/best-and-worst-mcu-sdks/3F4AD307-656B-4664-B988-4F5A301BD771.png)
261+
262+
Silabs Cortex-M MCU come from its acquisition of Energy Micro who was famous for
263+
the very low power consumption of their MCUs. Silabs now makes a range of
264+
Cortex-M based MCUs, some with 2.4GHz radios.
265+
266+
Like many of the vendors in the lower half of this list, Silabs distributes
267+
their SDK alongside an Eclipse-based IDE. In their case they call it “Simplicity
268+
Studio”. While Simplicity is the best of those IDEs, it does leaves those of us
269+
who do not love Eclipse with few solutions. Here, I chose to use Eclipse to
270+
generate Makefiles.
271+
272+
#### Why the rating
273+
274+
* Cross-platform ✅
275+
* Supports armcc/Keil, IAR, and Makefiles ❌ (only IAR and GCC are supported by simplicity studio)
276+
* Lots of bundled examples ✅
277+
* Single zip, no install needed ❌
278+
279+
Simplicity studio is huge (~1GB), slow, and complicated. Like all Eclipse-based
280+
IDEs, it generates poor Makefiles with hardcoded paths everywhere.
281+
282+
#### Step by step hello world example
283+
284+
1. Register at silabs.com
285+
2. Download and install Simplicity Studio: [Simplicity Studio - Silicon Labs](https://www.silabs.com/products/development-tools/software/simplicity-studio)
286+
3. Setup SDKs on first run
287+
4. Click on File -> New -> Silicon Labs Project Wizard
288+
5. Under “Target Device”, select your MCU
289+
6. Click “Next”
290+
7. Select “Empty C project”
291+
8. Click “Next”
292+
9. Give the project a name, and select “Copy contents” under “With project files”
293+
10. Once the project is created, build it with Project -> Build Project
294+
11. Use the generated makefiles in the project folder
295+
296+
297+
### Infineon XMC4000, Renesas RA4 3/10
298+
299+
Infineon and Renesas MCUs are popular for industrial applications and in the
300+
automative industry. In both cases, the standard setup is a Windows executable
301+
which installs an eclipse-based IDE.
302+
303+
All is not lost however, as they also provide a peripheral library which can be downloaded standalone.:
304+
* Infineon calls theirs XMC Lib: http://dave.infineon.com/Libraries/XMCLib/XMC_Peripheral_Library_v2.1.24.zip
305+
* Renesas has the “Example Project Bundle”: [Download Detail Page, Renesas Electronics](https://www.renesas.com/us/en/software/D6004702.html)
306+
307+
Unfortunately, neither of them offers Makefiles, so this is where my
308+
investigation ended. I did give them a few points for offering IAR and Keil.
309+
310+
#### Why the rating
311+
312+
* Cross-platform ❌
313+
* Supports armcc/Keil, IAR, and Makefiles ⚠️ (only IAR and GCC are supported by simplicity studio)
314+
* Lots of bundled examples ✅
315+
* Single zip, no install needed ❌
316+
317+
### Cypress PSoC6, Maxim DARWIN 0/10
318+
Cypress and Maxim both make interesting chips: the former has a popular family
319+
of BLE MCUs under its PSoC brand, the latter makes MCUs with very large flash or
320+
RAM which can be put to good use.
321+
322+
Unfortunately, I could not get anywhere with either. It seems PSoC creator is
323+
required to setup a PSoC6 project, but the app is windows-only. Meanwhile all I
324+
could find from Maxim is a Windows installer for the “ARM Cortex toolchain.
325+
326+
## Conclusion
327+
328+
I hope you came away from this post with a better understanding of the different
329+
setup steps required for different MCU SDKs.
330+
331+
You will note that I only looked at setup in this post. In the future, I intend
332+
to compare APIs, ecosystem, and tools.
333+
334+
Do you have a favorite MCU SDK? We'd love to hear about it in the comments!
335+
336+
<!-- Interrupt Keep START -->
337+
{% include newsletter.html %}
338+
339+
{% include submit-pr.html %}
340+
<!-- Interrupt Keep END -->
854 KB
Loading
678 KB
Loading
367 KB
Loading
357 KB
Loading

0 commit comments

Comments
 (0)