objc

objc runtime

This is a minimal Objective C runtime written in C, designed to be portable across different platforms, including ARM and x86 architectures, mostly targeting embedded systems. It uses the "gcc" ABI for the moment, as that is the most portable across different platforms.

Requirements

You will minimally need the following tools to build the runtime:

ARM Toolchain

For cross-compilation for embedded systems based on some ARM variant, get the ARM LLVM toolchain:\ https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases

Install this to the /opt directory.

Building the runtime

Download the source code from GitHub:

git clone git@github.com:djthorpe/objc.git
cd objc

The TOOLCHAIN_PATH environment variable should point to the directory where the toolchain is installed. For example,

# Compile with GCC 15 for MacOS
brew install gcc@15
TOOLCHAIN_PATH=/opt/homebrew CC=gcc-15 make

Use the make tests target to run the unit .tests

For the RP2040 Pico board, you can use the clang compiler with the ARM toolchain. The TARGET environment variable should be set to the target architecture, such as armv6m-none-eabi for the RP2040 Pico board:

# Compile for the RP2040 Pico board
CC=clang TARGET=armv6m-none-eabi TOOLCHAIN_PATH=/opt/LLVM-ET-Arm-19.1.5-Darwin-universal make

Current status

References

Here are some references that may be useful for understanding the Objective C runtime and its implementation: