MEGA65 / openFPGALoader-mega65

Universal utility for programming FPGA, minimisation and porting to MEGA65
https://trabucayre.github.io/openFPGALoader/
Apache License 2.0
0 stars 0 forks source link

Pare down to minimum size #1

Open gardners opened 3 months ago

gardners commented 3 months ago

We want to eventually port this to run natively on the MEGA65 for flashing the MEGA65 keyboard Lattice CPLD. I assume LLVM-MOS will be the compiler of choice, since we need C++

It needs to support only Lattice ICE40 parts, It should retain support for FTDI JTAG adaptors so that during testing we can continue to confirm function with a TE0790. But once we move forward, we will need only bit-bashing JTAG support, probably by greatly simplifying the libgpiod support.

gardners commented 3 months ago

Display symbols in binary sorted by size:

nm -S --size-sort -a openFPGALoader | c++filt

Can help target the things to remove to gain most size reduction

gardners commented 3 months ago

Linux binary reduced from ~4.2MB to ~1MB.

A lot of the binary now seems to be taken up with C++ __static_initialization_and_destruction_0(int,int) symbols. At least 20% and probably more of the remaining binary size is these.

gardners commented 3 months ago

Given the above, it might make sense to focus on "de-C++ing" what remains, starting with lattice.cpp, and making a lattice.c that can work with only a local bit-bashing JTAG interface, and recursively addressing dependencies to do that as we go.

The JED file parser would be nice to get rid of, too, by making a standalone tool that can turn a .JED file into whatever actually needs to be written to the CPLD via JTAG.