Welcome to
Code Exchange

As embedded electronics continues to transform our lives, engineers around the globe are looking for ways to increase their coding chops. To help engineers meet this need, element14 has unveiled Code Exchange-- a place where engineers can help each other.

Blog - Post List
  • GCC 15.1 for Windows is available

    If you're interested to try out the latest C++26 options: The Windows port for GCC 15.1 is available for download.I installed GCC 15.1.0 (with POSIX threads) + MinGW-w64 13.0.0 UCRT - release 2. To install, download the zip file, ...
  • C++ friend functions

    For an embedded design, I made a featherweight class. A C++ construct that used no more data or code size than a traditional C design. class command { public: inline command(uint32_t steps, bool reverse) : cmd_(steps << 1 |...
  • New CMake library link option $<COMPILE_ONLY:LIB>

    CMake has an easy way to get access to libraries headers and source: target_link_libraries(your_lib, some_lib). Where your_lib is the library you are developing, and some_lib is a library you depend on. Ideal if you are using a library, and...
  • embedded C++: manage a resource with a tiny* object

    *tiny like in: 0 bits of data, 0 code instructions added, 0 clock ticks scenario: you have a resource that needs to be initialised before use, and deactivated when done. We usually do that by calling some code before the actions, and some code after ...
  • embedded C++: add cheap bitwise conversion to a register structure

    This blog is based on real world work. I'm controlling a TI DRV8711 stepper motor controller via SPI. I need to modify 16-bit registers of that IC. TI provided a header file with register definitions, and code to convert that struct to a 16 bit ...