Skip to content

CE C Toolchain (LLVM-based)

Compare
Choose a tag to compare
@mateoconlechuga mateoconlechuga released this 26 Dec 21:40
· 1363 commits to master since this release

(A minor linker bug + a compiler bug were found and fixed since that release, please make sure to download the latest toolchain version!)

This is a major release, please read the sections below.

Getting Started

Read the Getting Started Guide.

Downloads

Windows: windows_CEdev.exe
Linux: linux_CEdev.zip
macOS: mac_CEdev.dmg

CE Libraries

The CE C Toolchain can use the 'Standard' CE Libraries.
These libraries add runtime support for fast graphics, file access, keypad integration, and more.
Download them at the above link, and add the appropriate headers in your source to use the supplied functions.
Documentation for the libraries can be found here.

The major upgrade from ZDS to LLVM

The toolchain is from now on based on LLVM, an open-source retargetable compiler infrastructure, and @jacobly0 created an (e)z80 backend!
This is a major milestone as it allows the CE toolchain to move away from using the legacy Zilog ZDS compiler, which is closed-source, proprietary, only worked on Windows, and contained numerous bugs.
Thanks to LLVM, later standards of the C and C++ languages are supported (you're not stuck with C89 anymore!), code optimization actually works, and the compiler is able to run natively across multiple platforms. The fact that it is open-source and community-maintained means that bugs can actually be fixed and improvements/feedback can come from anyone.

Note: No STL is provided for C++ source code (i.e. no std::string, no std::vector, etc.). Currently only language support is offered.

Updating your projects for this new toolchain version

In programs you build with this new toolchain, you should notice performance or speed improvements, depending on the optimization level you choose ... or even both :)

But the massive internal changes in the toolchain do mean that some programs might not compile right away anymore.
In fact, first, after installing the new toolchain, you'll have to update your projects' makefile. It's only a few lines, and a template makefile can be found here.

Regarding potential source code related migration, don't worry, it shouldn't be too difficult to fix your code. Here are some differences:

  • Old-style inline assembly will most likely not work, you'd have to write it like the compiler outputs it, in the format fasmg-ez80 expects. Update any assembly source modules with the guide described here.
  • Many new errors and warnings may be generated as the compiler is able to better infer. These should be fixed, and programs should compile without any warnings.
  • If your program was using 64-bit types (for instance long long), it may not build (link, more specifically) anymore. In fact, the ZDS compiler even made those 32-bit. If there's enough justified demand for actually supporting 64-bit types properly, we may work on it.
  • The convimg project has been updated to support a new YAML format that is easier for beginners and tooling. The previous toolchain release (v8.8) also used a YAML format, however some slight modifications were made in order to make it standard-compliant. Example convimg.yaml conversion files can be found in the examples.

Other changes and improvements

You can find the a more detailed list of changes (and a link to the commits) in the changelog file, but here are the other important changes in addition to the compiler change:

  • Lots of cleanup and improvements to the standard includes and headers in general, made possible by the compiler change mentioned above.
  • New fileioc function: ti_SetGCBehavior to set routines to run before and after a garbage collect would be triggered.
  • New keypadc defines: many keypad key defines corresponding to the TI-83 Premium CE keypad were added for easier coding.
  • New usb.h function: usb_BatteryCharging to check if the battery is currently charging.
  • Revamped v/s/printf functions, now available if needed thanks to a light third-party library, see docs.
  • New: fileioc-powered (by default) implementation for file IO functions, see docs.
  • New C++ header-only "library" for easily manipulating "TI real" numbers (see this PR), making some math operations easier. See examples.
  • abort() doesn't generate code that would make CEmu open its debugger anymore - you can use the specific debug functions for that now.
  • Documentation improved and revamped. Available on online here, which replaces the repo's wiki.

Let's thank once again @jacobly0 for his spectacular work (years in the making), as well as everybody who contributed in one way or another, to this release 🥂

Happy coding!