Home‎ > ‎

Embedded C compiler


It's possible to have an embedded C compiler, and fit it in 8MB flash (probably a lot less).  This is useful for people who don't have access to a 32-bit Linux machine or OpenWrt cross-compilation environment.  They could use this to compile their own simple C programs and run them on the board.

You can obtain the pts-tcc binary from here.  If you copy this on to the Bifferboard (or any other RDC-based router) you can compile basic programs like:

int main()
{
    printf("Hello world\n");
    return 0;
}

I haven't investigated use of more advanced stuff like network sockets and so on.

You can also use tcc as a script interpreter, which will compile and run C programs on-the-fly.  Handy if you need to write some really fast-executing programs.  Typical applications might include a network JTAG 'pod' where you can download bit-twiddling algorithms and subsequently communicate with them over the network.


Building under OpenWrt

OK, so I cheated.  I haven't bothered to build from source, but if you drop the attached Makefile.tcc into the OpenWrt source directory trunk/packages/tcc and rename it to 'Makefile' then tcc becomes a selectable option for the OpenWrt build under 'utils'.  Just a convenient way of downloading it from SVN and adding it to your firmware before flashing it to the board.


ċ
Makefile.tcc
(1k)
Biff Eros,
Aug 10, 2010, 2:40 PM
Comments