Tutorial: Creating and using ROM Libraries with GNU Build Tools

You might never heard about ROM Libraries, and you are probably not alone. Some might thing that this refers to the boot ROM modern MCUs have built in, which is kinda close. But the thing here is about to build your own (possibly constant) ROM library, program it to your device of choice, and then use it from the application running on the device.

So the concept is to have a (fixed, stable) part with code and data on your device, which can be used by a (possibly changing) application: Think about a stable LoRaWAN network stack in the ROM, with a changing application using it: Would that not be cool?

ROM Library Concept

This not only adds flexibility, but as well allows smaller updates, as only a part of the program has to be changed or updated.

The question is: how to create and use such a ROM Library with the normal GNU build tools?

Continue reading

Placing Code in Sections with managed GNU Linker Scripts

Managed linker scripts are great on one side: the simplify the otherwise complex GNU linker script handling. On the other side it requires knowledge how to tweak them in case ‘non-standard’ behavior is needed.

Continue reading

Linking Bootloader Applications with Eclipse and FreeMarker Scripts

Bootloaders are a fine thing: With this I can load any applications I like. Power comes with some complexity, and a bootloader alone is a complex thing already. But this applies to the application part too: I need to link the application to a certain offset in the memory space so it can be loaded by the bootloader, plus the application typically needs to add some extra information to be used by the bootloader. This article describes how to build a bootloader application with Eclipse (MCUXpresso IDE) using the MCUXpresso SDK.

Build Configuration for Bootloader Application

Continue reading

Solving Problem with GNU Linker and “referenced in section, defined in discarded section ” Error Message

I have been running recently into an interesting case where the GNU ARM Linker failed to link an application with strange error messages:

referenced in section, defined in discarded section

referenced in section, defined in discarded section

Continue reading

Using the GNU Linker Script to know the FLASH and RAM Areas in the Application

Sometimes it is handy to know in the running application the start address, end address and the size of a linked section, e.g. to know the boundaries of RAM or FLASH areas. This means that from the application code I can get access to knowledge of the GNU linker:

Information about Linker Sections

Information about Linker Sections

Continue reading

How to use Custom Library Names with GNU Linker and Eclipse

By default, the GNU Linker expects a very special naming scheme for the libraries: the library name has to be surrounded by “lib” and the “.a” extension:

lib<NAME>.a

But what if the library I want to use does not conform to that naming standard?

Non-conforming Library Naming

Non-conforming Library Naming

Continue reading

Tutorial: Makefile Projects with Eclipse

The benefit of an IDE like Eclipse is: it makes working with projects very easy, as generates make files and it takes and automatically manages the make file(s). But sometimes this might not be what I want because I need greater flexibility and control, or I want to use the same make files for my continues integration and automated testing system. In that case a hand crafted make file is the way to go.

One thing does not exclude the other: This article explains how to use make files with Eclipse with similar comfort as the managed build system in Eclipse, but with the unlimited power of make files:

Makefile Project with Eclipse

Makefile Project with Eclipse

Continue reading

Accessing GNU Linker Script Symbols from C/C++

With the GNU compiler and linker I can place variables into custom sections (see “Defining Variables at Absolute Addresses with gcc“). This article is about how to get the section start and end address so I can for example access that range in my code. Or in general ways: how to use symbols defined in the linker script accessible in the C source code.

Using Linker Script Symbols in Source Code

Using Linker Script Symbols in Source Code

Continue reading