Repository navigation
Releases
EmbCC 0.1.0
Install EmbCC 0.1.0 on Linux or macOS with
curl -fsSL https://raw.githubusercontent.com/EmbLinkOs/EmbCC/main/install.sh | sh -s -- --version v0.1.0
or download the tarball for your system and its .sha256 file,
check one against the other, and unpack it anywhere: bin/embcc
finds its headers and libraries relative to itself. The .deb
files install into /usr with sudo apt install ./FILE.deb.
EmbCC 0.0.1-beta
EmbCC 0.0.1-beta is the first public release of EmbCC, a C and C++ compiler for embedded systems, and of the Emb toolchain around it. It is a beta: test it on your projects, and expect rough edges. Please report what breaks in an issue.
What's in it
- One compiler binary for every target.
--target=TRIPLEpicks one of: Arm Cortex-M (ARMv6-M, v7-M, v7E-M, v8-M Baseline and Mainline) and ARMv7-A; RISC-V RV32 and RV64; AVR; Xtensa (ESP32 class); TriCore; RX; ColdFire; MIPS32/64 (including PIC32); PowerPC; SPARC V8 (LEON3); LoongArch64. For hosted programs: x86-64 and AArch64 Linux, macOS and Windows. - No other toolchain needed. The preprocessor, compiler, assemblers and linker all run inside
embcc. You don't needgcc,binutilsorarm-none-eabion your machine. - C11 with GNU extensions, plus C23 features, on every target. C++20 on every target except AVR, with exceptions on x86-64 and AArch64 and
-fno-exceptionson the embedded targets. - The tools around the compiler:
embld(linker),embdbg(debugger, speaks the GDB remote protocol),embsim(a board simulator),embflash,embtrace,embmap,embpack,embrt,embsvd, and theemblslanguage server. - EmbSim runs boards QEMU doesn't have, among them: Blue Pill, nRF52840-DK, Raspberry Pi Pico, Arduino Zero, ESP32-C3-DevKitM-1, Arduino Uno, Microchip's Explorer 16/32 (PIC32MZ, PIC32MX, PIC24, dsPIC33) and Curiosity PIC32MZ EF.
Install
Linux (x86-64, arm64; glibc 2.35 or newer) and macOS 11 or newer (Intel, Apple silicon):
curl -fsSL https://raw.githubusercontent.com/EmbLinkOs/EmbCC/main/install.sh | sh -s -- --version v0.0.1-beta
This is a pre-release, so --version v0.0.1-beta is required. You can also download the tarball for your system, check it against its .sha256 file, and unpack it anywhere: bin/embcc finds its headers and libraries relative to itself. On Debian and Ubuntu, sudo apt install ./embcc_0.0.1-beta_amd64.deb installs into /usr.
First steps
embcc builds for x86_64-elf unless you pass --target, so name the target:
embcc --target=thumbv7em-none-eabi --opt=size -c main.c # Cortex-M4
embcc --target=avr --mcu=atmega328p -Os -c main.c # Arduino Uno
embcc --target=riscv32-unknown-elf -O2 -c main.c # RV32
embcc --target=aarch64-apple-darwin hello.c -o hello && ./hello # Mac
embcc --help lists the options, and the tarball installs man embcc. The full manual is in docs/manual.
Known limitations
- C++ is refused on AVR. On the other embedded targets it needs
-fno-exceptions, because they have no unwind tables yet. - GNU vector types are computed lane by lane. On x86-64 and AArch64, a function that takes or returns a vector by value is not ABI-compatible with GCC-built code.
--isa=rv32imc(no A extension) is refused, because the C library's lock uses LR/SC.emblddoesn't link AArch64 Linux programs. Link those with the system'sld.
The road from here to 1.0.0, and what 1.0 will promise, is in docs/roadmap.md.