I’m using Eclipse-based IDEs to develop and debug my embedded applications. This works great, as Eclipse has all the necessary tools to edit, build and debug it. But when it comes just to downloading/flashing a binary to the board, then things are pretty much specific to the tools used. With the advent of the new MCUXpresso IDE, here is how that Eclipse IDE can be used for this.
The normal way in Eclipse to download a binary to the target is to use the debugger with a so-called launch (or debug) configuration. That launch configuration needs a ‘project’, so programming a board without a project is not the usual thing. But there are ways to download and program an application without a project. I show this here using the NXP MCUXpresso IDE (V10.0.0), but some ways are applicable to, say, using the Kinetis Design Studio (V3.2.0) or if using the GNU ARM Eclipse plugins.
There are different file formats that can be used to program a microcontroller:
- ELF/Dwarf: This is the normal output format of the linker. Typical extensions are .elf, .abs, or .afx. This file format has the code and data, plus the debug information (which is *not* downloaded to the target and is only used for debugging).
That ELF/Dwarf file usually gets converted into different binary formats more suitable for programmers or boot loaders, and they do not include the debug information:
- S19/S-Record: textual file format (type, address, size, code, checksum). Typical extensions are .s19, .srec or .sx.
- Intel Hex: textual file format (similar representation as S19). Typical extension is .hex.
- Binary: In this format, the data is written in binary form, without address information. It is basically a ‘memory dump’.
Each format has its own pros and cons, see S-Record, Intel Hex, and Binary Files for a more detailed overview.
To generate the different formats:
- MCUXpresso IDE: see MCUXpresso IDE: S-Record, Intel Hex, and Binary Files
- Kinetis Design Studio or using GNU ARM Eclipse: see Binary (and S19) Files for the mbed Bootloader with Eclipse and GNU ARM Eclipse Plugins
- Converting, merging, and manipulating binary files: I use the SRecord tool (for all kind of other formats, too!), see CRC Checksum Generation with ‘SRecord’ Tools for GNU and Eclipse and Merging S19 Files
With using the MCUXpresso IDE, there is a LinkServer GUI Flash Programmer (see Using the LPCXpresso V2/V3 Boards to Debug an external Board):
In that dialog, I can simply specify the binary I want to download. But there are the following restrictions:
- Only ELF/Dwarf and binary files supported (e.g. no S19 or Intel Hex files).
- Only works with the NXP LinkServer debug connection (LPC-Link, LPC-Link2, CMSIS-DAP) (e.g. no support for Segger J-Link or P&E Multilink).
Using Launch Configuration
The other approach is to use a launch configuration. This actually would be the same as using a normal debug session.
In Kinetis Design Studio V3.2.0, there is a ‘Flash from file’ toolbar button. It is basically the same as using a special launch configuration. As it might interfere with the normal Eclipse launch configuration, I’m not using that way anymore.
To create a new launch/debug configuration, I can duplicate an existing one (matching my device):
For a P&E debug connection (MCUXpresso IDE or e.g. Kinetis Design Studio), specify a dummy project and the binary to download (use the ‘Browse’ button):
All types of files (ELF/Dwarf, S19, Binary, and Intel Hex) are supported by the P&E launch configuration.
In the startup options, I have to disable the debug (symbols) usage. Alternatively, I could specify the binary file here, too:
Then I can use the normal ‘debug’, which will use that binary file specified to be programmed. If I want only to download and skip the ‘debug’ step, then I can use the approach described in Emulating Eclipse ‘Run’ with ‘Debug’ Configuration.
The same approach is used for the Segger J-Link debug connection (Kinetis Design Studio, or with the GNU ARM Eclipse plugins installed in MCUXpresso IDE, see MCUXpresso IDE: Importing Kinetis Design Studio Projects).
Specify the binary file in the Main tab:
The following files are supported: ELF/Dwarf, S19, and Intel Hex. Binary files (at least at the time of this article) are not supported.
In the ‘Startup’ settings, disable loading the symbols:
Currently, users of the GNU ARM Eclipse plugins (e.g. Kinetis Design Studio, or if you install them into MCUXpresso IDE) have the most flexible options to download binaries to the target. For the GNU ARM Eclipse plugins and the P&E plugin, all I need is to specify the binary file, and P&E is able to handle ELF/Dwarf, S19, Binary, and Intel Hex, while Segger is behind with supporting Binary.
If using the standard MCUXpresso IDE V10.0.0, then there is the LinkServer dialog, which supports the LPC-Link2/Link connections. For P&E, the support is the same as with the GNU ARM Eclipse Plugins. For Segger, I can install the GNU ARM Eclipse plugins or use the Segger external tools to download binaries.
Because ‘programming binary files’ is not a standard feature of Eclipse, every vendor comes up with its own ways. If such an option or extension is not present, you still can try using a normal launch configuration, but the debug plugin has to accept a binary without debug information. Or use an external tool outside Eclipse.