Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pare down to minimum size #1

Open
gardners opened this issue Jun 2, 2024 · 3 comments
Open

Pare down to minimum size #1

gardners opened this issue Jun 2, 2024 · 3 comments

Comments

@gardners
Copy link

gardners commented Jun 2, 2024

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 pushed a commit that referenced this issue Jun 2, 2024
@gardners
Copy link
Author

gardners commented Jun 2, 2024

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 pushed a commit that referenced this issue Jun 2, 2024
gardners pushed a commit that referenced this issue Jun 2, 2024
gardners pushed a commit that referenced this issue Jun 2, 2024
gardners pushed a commit that referenced this issue Jun 2, 2024
gardners pushed a commit that referenced this issue Jun 2, 2024
@gardners
Copy link
Author

gardners commented Jun 2, 2024

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
Copy link
Author

gardners commented Jun 2, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant