My turmoil clone uses GCC to build the cartridge ROM, mostly as an learning exercise. The source code is here. I didn't use any external libraries, because I like having total control of the computer, and wrote my own functions to access the VDP in a way that is similar to what I'm familiar with in assembly language. Here's a description of the files:
Makefile: this locates the compiler programs and options that are passed to it, and provides list of inputs and outputs to the compiler, and their dependencies. This is used by the "make" command to build the cartridge binary. The .asm and .c files get compiled to .o files, and the .o files get linked into a .elf file, which gets converted to the .bin file (which also gets zip'd with layout.xml into a .rpk file.)
cart_header.asm: this is the assembly source code for the cartridge header required for all cartridge programs running in the >6000 space.
crt0.c: this is the C runtime supporting the main program, responsible for turning off interrupts, initializing the workspace pointer and stack pointer, copying non-constant data from ROM to RAM, initializing variables to zero, and then calling the main() function.
linkfile: a linker script that lays out where things will end up in memory, and sets up some labels that the C runtime will use to copy data or zero-initialize variables.
main.c: this contains the void main() function, and all the rest of the supporting game functions. Some inline assembly is also used to read the joystick, wait for the VDP interrupt, and low-overhead VDP set address and copy data.
graphics.h: a C header file containing the graphics data generated from the Magellan file using the gawk command.