Skip to content

Releases: llvm-mos/llvm-mos-sdk

SDK v0.2.2

31 Mar 00:34
Compare
Choose a tag to compare

New platforms

  • nes-nrom-128. Contains a simple PPU support library. Generates an iNES 2.0 file for the NES NROM-128 board.

New features

  • llvm-objdump -d disassembler now shows branch targets using absolute addresses.
  • __do_copy_data symbol reference emitted whenever .data section referenced.
  • copy-data optional library to copy .data segment from ROM to RAM if necessary.
  • exit-loop optional library to exit the program by entering an infinite loop.

Optimizations

  • Placed C runtime constants in .rodata, not .data. Keeps them from being copied.
  • Replaced runtime subtraction in .bss zeroing and .data copying with linker-computed size.

Bugfixes

  • Added barrym95838's BCD behavior corrections to the 6502 simulator.

Refactors

  • libstart renamed to libcrt0.

SDK v0.2.1

19 Mar 19:23
Compare
Choose a tag to compare

New features

Custom output formats in linker scripts

A new OUTPUT_FORMAT { } syntax was added to the linker script, and the SDK now takes advantage of it. This allows specifying directly what the bytes of the output file should contain: various header bytes, and portions of the linker's LMA (loaded memory address) space, either zero padded or trimmed to fit. This considerably simplifies defining custom file formats (XEX, iNES, PRG, etc.) over the LMA hacking previously done in the SDK. This mode also causes the corresponding ELF file to be generated with the .elf file extension.
https://llvm-mos.org/wiki/Linker_Script

mos-common target

mos-common was made into a real, but incomplete, target, with it's own library and object files. This makes it easier to port LLVM-MOS to new targets, as it's no longer necessary to hook into the SDK's CMake build system to do so; the common target can be used with crt0.s and C files stashed in a user directory. There's still work to be done to clean up and document the porting process using the common target; this should occur over the next few weeks after this release.

Bug fixes

  • When building the SDK on Mac OS, LLVM-MOS's llvm-ar and llvm-ranlib are now used instead of the system ones.

SDK v0.2.0

08 Mar 05:57
Compare
Choose a tag to compare

Breaking changes

  • Structs 4 bytes or smaller are passed and returned by value rather than by indirect pointer.
  • Renamed a800xl target to atari8

New features

  • C++ type_traits implementation

Optimizations

  • Reduced printf from ~12K to ~5K by replacing div/mod 10 with a simple BCD-like shift and add algorithm.

SDK v0.1.0

25 Feb 18:41
Compare
Choose a tag to compare

This is the first official release of the llvm-mos compiler and SDK.

Documentation for getting started.

What you get

  • Code generation for the Commodore 64, Atari 800, and an included 6502 simulator.
  • The high and low-level optimizations expected of a young-ish LLVM backend
    • Sophisticated register allocation over A, X, Y, and a field of 16 2-byte zero-page (imaginary) registers
    • The imaginary registers can be placed anywhere and need not be contiguous.
    • The calling convention passes through registers whenever possible.
    • Loop optimizations to select 6502 addressing modes
    • Whole program "static stack" optimization
      • Automatically identifies non-reentrant functions and allocates their frames as static globals
      • Programs without recursion or complex function pointers may not need a soft stack at all.
      • No manual annotations required
    • Link time inlining and optimization across the whole program
      • Includes SDK libraries. Library calls can be often optimized away completely!
  • Broad C99 and C++11 freestanding standards compatibility
    • Interrupt handling
    • C++ templates
    • C++ virtual functions
    • C++ new/delete
    • C++ Run-Time Type Information (dynamic_cast, typeid)
    • C++ static constructors/destructors (run before and after main)
    • C++ "magic" function local static constructors/destructors
  • Excellent compiler usability
    • Clang's world-class error messages
    • IDE integration through the included custom clangd's Language Server Protocol
    • Straigtforward invocations to compile for various targets: mos-c64-clang++ -Os -o game.prg game.cc
  • A small standard library sufficient to provide the above and a few extras
    • Simple printf
    • Simple malloc/free
    • exit, _Exit, and atexit
  • An ELF file format implementation
    • All the usual POSIX tools for working with object files: readelf, nm, etc.
    • A GAS-compatible assembler for the 6502 with a complete macro system
  • A lld linker implementation for the 6502
    • All the usual trimmings of an ELF lld backend
      • Link-time garbage collection
      • Symbol map exports
      • Linker scripts
      • GCC ld compatibility

What you don't get

  • C99 requires supporting 64KiB locals, sorry, no can do.
  • A hosted C with all the standard library bells and whistles.
  • Float/double
  • C++ Exceptions

Prerelease SDK

25 Feb 07:16
Compare
Choose a tag to compare
Prerelease SDK Pre-release
Pre-release

Prerelease llvm-mos SDK.