[raspi-internals] Working GNU toolchain for VC4

  • From: Julian Brown <julianbrown99@xxxxxxxxx>
  • To: raspi-internals@xxxxxxxxxxxxx
  • Date: Sat, 23 Apr 2016 14:25:44 +0100

Hi,

I'm not sure if there's still anyone out there interested in such things,
but here goes!

I've pulled together bits and pieces that various people have done towards
getting a working GNU toolchain (binutils, GCC, etc.) and fixed them up a
bit so that they all work together -- and possibly produce code that'll run
on a real VC4, although I've not been able to test that so far.

This has consisted of:

* Rewriting a bunch of the binutils code so it uses CGEN -- in retrospect,
not such a great idea, because CGEN is kind of lacking in various regards,
particularly with respect to variable-length instruction sets -- but never
mind...

* Hacking CGEN to fix the above lossage.

* Rebasing David Given's GCC bits onto a (then-) current trunk GCC -- a
snapshot from some time before GCC 6.0 forked, IIRC. Fixed a bunch of
things, and stripped some stuff out: the compiler supports basic scalar
instructions, but not some of the trickier ones (no conditional insns, no
ALU+shift insns, no pre/post increment/decrement insns, definitely no
vector insns...).

* Doing a basic Newlib port that supports console output over an (emulated)
mini-UART, startup code, and a few necessary stub functions.

* Tweaking Mathias Gottschlag's "resim" VC4 emulator to use with the GCC
testsuite.

Possible next steps for anyone with the motivation are probably:

* Getting code running on the real hardware! It'd be nice to get a real Pi
substituting for resim in GCC tests (downloading each test successively
over serial, and automatically rebooting on crashes). That means enabling
SDRAM and "pivoting" to a small monitor of some sort from there, I think.
(This is about where I've run out of steam.)

* Incrementally adding more instructions to GCC and (lesserly) binutils.

* Not sure, getting some kind of RTOS running on the VC4, and enabling the
ARM?

The code's on my GitHub account at:

https://github.com/puppeh/vc4-toolchain

Cheers,

Julian

Other related posts: