Clang for P2
Clang is a well known C++ compiler front end for the LLVM compiler back end.
Many thanks to forum member n_ermosh for all the hard work on this and also iseries for testing
Update 16Apr2026: P2 forum member @Rogloh has made improvements so that Clang can compile Micropython
Here's a zip of Clang folder for Windows that can compile hello.c
Now includes fixes from Rogloh (so modulus operator won't break it). hello2.c tests this...
Compile using instructions in this thread (post #42), or see "build.bat" for example on how to build
Can run "build hello" to compile and build hello.c
Can use loadp2.exe to upload to P2 (see instructions in build.bat). Or, use tool like FlexProp to upload binary to P2.
NOTE: Things below are OLD (do not use)
Download a 600MB Clang folder for Windows, ready to go.
Just unzip somewhere and then update "start in" folder in command prompt and first line of build.bat with new path of the bin folder
Then, type "build serial" and then "load serial" to get Hello World Example run
Or, type "build test" and "load test"
To Build yourself: Recent posts in the C/C++ Parallax forum suggests it may be ready for use
Build instructions are given in post #133 in this thread
Note: Skip the "cd build" step.
Github source is here: GitHub - ne75/p2llvm: Contains Propeller 2 Library, C Standard Library, examples, and documentation for p2llvm
Prerequisites to build:
install git from here: https://git-scm.com/download/win (Use all default settings when installing)
get cmake latest releast from here and let it add cmake to the path: https://cmake.org/download/
download and install Python3 from here: https://www.python.org/downloads/ (let it add python to path)
Note: To actually compile, you also need libc.a and libp2.a and loadp2.exe
These can't currently be compiled with cmake, so need to get them some other way
Some versions of libc.a include debug code and produce large elf files.
Seems the elf file can be bigger than 512kB, but less actually gets loaded
To compile things with printf, you need to copy libc with stdio.h in it over to the build folder.