Ask Hackaday: What’s Your Favourite Build Tool? Can Make Ever Be Usurped?

What do you do whilst your code’s compiling? Pull up Hackaday? Check Elon Musk’s net worth? Research the price of a faster PC? Or do you wonder what’s taking so long, and decide to switch out your build system?

Clamber aboard for some musings on Makefiles, monopolies, and the magic of Ninja. I want to hear what you use to build your software. Should we still be using make in 2021? Jump into the fray in the comments.

Continue reading “Ask Hackaday: What’s Your Favourite Build Tool? Can Make Ever Be Usurped?”

Arduino Gets Command Line Interface Tools That Let You Skip The IDE

Arduino now has an officially supported command-line interface. The project, called arduino-cli, is the first time that the official toolchain has departed from the Java-based editor known as the Arduino IDE. You can see the official announcement video below.

Obviously this isn’t a new idea. Platform IO and other command-line driven tools exist. But official support means even if you don’t want to use the command line yourself, this should open up a path to integrate the Arduino build process to other IDEs more easily.

The code is open source, but they do mention in their official announcement that you can license it for commercial use. We assume that would mean if you wanted to build it into a product, not just provide an interface to it. This seems like something Arduino expects, because a lot of the command line tools can produce json which is a fair way to send information to another application for parsing.

The command line interface doesn’t just build a sketch. You can do things like install and manage libraries. For example, to create a new sketch:

Continue reading “Arduino Gets Command Line Interface Tools That Let You Skip The IDE”

STM32CubeMX Makes Makefiles

When hardware manufacturers make GUI code-generation tools, the resulting files often look like a canned-spaghetti truck overturned on the highway — there’s metaphorical overcooked noodles and red sauce all over the place. Sometimes we think they’re doing this willfully to tie you into their IDE. Not so the newest version of ST’s graphical STM32CubeMX, which guides you through a pleasant pin-allocation procedure and then dumps out, as of the latest version, a clean Makefile.

Yes, that’s right. This is a manufacturer software suite that outputs something you can actually use with whatever editor, GUI, compiler, or environment that you wish — even the command line. Before this release, you had to go through a hacky but functional script to get a Makefile out of the CubeMX. Now there’s official support for real hackers. Thanks, ST!

If you’re compiling on your own, you’ll need to update the BINPATH variable to point to your compiler. (We use the excellent GNU ARM Embedded Toolchain ourselves, which is super-easy to install on almost any Linux.) If you want to use STM32CubeMX with the Eclipse IDE, [kali prasad yadav] sent us PDF instructions — it’s not hard.

If you doubt that the availability of a free, open, and non-constraining toolchain can matter for a silicon vendor, we’d point to AVR and the Arduino platform that spun off of their support of GCC. Sure, Atmel still pushes their all-in-one wonder, Atmel Studio, which is better than the Arduino IDE by most any metric. But Studio is closed, and Arduino is open. We’d love to see the number of Studio users compared with Arduino users.

Congratulations to ST for taking a big step in the right, open-toolchain, direction.

A Real Hacker’s IDE

We don’t use a GUI IDE, but if we did, it would most certainly be something along the lines of [Martin]’s embedded-IDE project. We’ve always felt that most IDEs are just fancy wrappers around all the tools that we use anyway: Makefiles, diff, git, ctags, and an editor. [Martin]’s project makes them less fancy, more transparent, and more customizable, while retaining the functionality. That’s the hacker’s way — putting together proven standard tools that already work.

The code editor he uses is QScintilla, which uses clang for code completion. The “template” system for new projects? He uses diff and patch to import and export project templates. Because it uses standard tools all along the way, you can install the entire toolchain with sudo apt-get install clang diffutils patch ctags make on an Ubuntu-like system. Whatever compiler you want to use is supported, naturally.

We can’t see a debugger interface, so maybe that’s something for the future? Anyway, if you want a minimalistic IDE, or one that exposes the inner workings of what it’s doing rather than hiding them, then give [Martin]’s IDE a try. If you want more bells and whistles that you’re not going to use anyway, and don’t mind a little bloat and obscuration, many of our writers swear by Eclipse, both for Arduino and for ARM platforms. We’ll stick to our butterflies.

Embed With Elliot: ARM Makefile Madness

To wrap up my quick tour through the wonderland of make and makefiles, we’re going to look at a pair of possible makefiles for building ARM projects. Although I’m specifically targeting the STM32F407, the chip on a dev board that I have on my desk, it’s reasonably straightforward to extend these to any of the ST ARM chips, and only a bit more work to extend it to any ARM processor.

If you followed along in the first two installments of this series, I demonstrated some basic usages of make that heavily leveraged the built-in rules. Then, we extended these rules to cross-compile for the AVR series of microcontrollers. Now we’re going to tackle a more complicated chip, and that’s going to mean compiling with support libraries. While not required, it’s a lot easier to get an LED blinking on the ARM platforms with some additional help.

One of the main contributions of an IDE like Arduino or mbed or similar is the ease of including external libraries through pull-down menus. If you’ve never built a makefile-based project before, you might be surprised how it’s not particularly more difficult to add libraries to your project.
Continue reading “Embed With Elliot: ARM Makefile Madness”

Embed With Elliot: Microcontroller Makefiles

Last time on Embed with Elliot, I began my celebration of the make command’s 40th birthday next month. We discussed using the default rules and how to augment them with your own variables defined in a makefile. Next, I’ll walk you through some makefiles that can be used for real-world microcontroller code development. This week, we’ll focus on one for the AVR platform, and later on, I’ll run through a slightly more complicated version for the ST32M series of ARM Cortex micros.

Along the way, we’ll pick up a couple of tricks, but the aim is to keep the makefiles minimal, readable, and easily extensible. Once you get a little taste of the power of writing your own makefiles, you probably won’t be able to stop adding bells and whistles — custom routines for flashing, checking the size of binaries, generating assembly listings, etc. I’ll leave the extras up to you, but you’ll eventually find that anything you do can be automated with a makefile.

Continue reading “Embed With Elliot: Microcontroller Makefiles”

Embed With Elliot: March Makefile Madness

The make tool turns the big 4-0 next month, and we thought we’d start up the festivities early. In a two-part series, I’ll cover some of the make background that I think is particularly useful, and then focus on microcontroller-specific applications. If you’re still cut-and-pasting a general purpose makefile to run your toolchain, hopefully you’ll get enough insight here to start rolling your own. It can be a lot simpler than it appears!

Just as soon as the C programming language was invented, and projects started to get a little bit bigger than a “hello world”, it became obvious that some tool was needed to organize and automate compilation. After all, if you’ve got a program that’s spread over a number of files, modules, or libraries, it’s a hassle to have to re-compile them all any time you make a change to just a single section of code. If some parts haven’t changed, you’re just wasting time by re-compiling them. But who can keep track of all of this? Make can!

Continue reading “Embed With Elliot: March Makefile Madness”