Jozef Lawrynowicz

Software engineer with over 5 years of experience of GNU toolchain development

Quick Links

Mitto Systems and MSP430-GCC

I founded Mitto Systems in January 2018, and through this company worked on the Texas Instruments MSP430-GCC project, a downstream fork of the MSP430 GNU toolchain. Over the 3 years I led the project, I delivered 9 releases to TI, spanning GCC versions 7 to 9. Each release of MSP430-GCC was available standalone or alongside the TI toolchain in the Code Composer Studio IDE.

The goals of the project were to improve code generation, with a focus on reducing the size of generated code, whilst keeping the toolchain up to date with the latest versions of upstream GCC, Binutils, and GDB. Regular contact with customers on the TI e2e forums helped me stay up to date with issues faced by them, helping to prioritize tasks for releases.

Code generation improvements and optimizations across the compiler, linker and runtime libraries delivered an average code size reduction of 35%, achieved with the final release. Performance, as measured by EEMBC CoreMark score, increased by 10%.

Coding and Open Source Contributions

MSP430-LLVM is a fork of LLVM used as a staging area for MSP430-specific patches I developed, whilst they await review for inclusion into the upstream LLVM project. I implemented:

  • a new method for efficiently extracting the CPU and hardware multiply version supported by specific MSP430 MCUs
  • a series of patches to add codegen and assembler support for MSP430X shift instructions
  • a patch to add codegen and assembler support for MSP430X push/pop instructions.

My GCC contributions include improvements to instruction selection in the MSP430 backend, development of a new MSP430 data model, and the implementation of highly-optimized MSP430 assembly code library routines for performing 64-bit shifts and multiplication.

My Binutils contributions include the design and implementation of the SHF_GNU_RETAIN ELF section flag and fixes to MSP430 linker relocation processing.

My GDB contributions include a fix to the MSP430 simulator’s execution of hardware multiplication routines.

My Newlib contributions include the implementation of a reduced code-size “tiny printf” for MSP430, refactoring libm to remove legacy math library configurations, and optimization of the MSP430 CRT library.

Technical Writing

As part of my work on the MSP430-GCC project, I maintained the MSP430-GCC User’s Guide. Active monitoring of the TI e2e forums gave me a good idea of issues faced by users, and common questions, which helped me to identify functionality that needed better documentation. I added “Section 5 - MSP430-GCC Features”, which describes the unique features of the toolchain in detail, and helps users make the most of the available optimizations.

One of the most significant tasks assigned by Texas Instruments was not directly related to the MSP430-GCC project. TI tasked me with adapting an ELF extension developed for their proprietary ARM toolchain, so it could be upstreamed into the GNU toolchain. The extension was called “Symbol Meta-Information”, and was intended to enable new types of information to be described about ELF symbols and propagated between toolchain components.

I developed a proposal (PDF) and technical specification (PDF), but the functionality was ultimately rejected by the upstream community. However, the whole process was a valuable experience, from writing the proposal and discussing it upstream, to learning the importance of RFCs in keeping the upstream community abreast of significant out-of-tree development work. It also solidified my understanding of the value in breaking large changes down into smaller parts, to make it easier to understand their impact on the broader ecosystem.

To address the key requirement of one of the Symbol Meta-Information types, I developed a new ELF section flag, called SHF_GNU_RETAIN. After writing a new proposal and submitting a new RFC upstream, this flag was accepted as a GNU extension to the ELF ABI. I implemented it in Binutils, and it now facilitates the C/C++ “retain” attribute available in GCC and LLVM/Clang.