Vladimirtrif / Team-949z_Pelmen_Vex_21-22

0 stars 0 forks source link

Improve build times #6

Closed vladsud closed 2 years ago

vladsud commented 2 years ago

This change includes the following changes:

  1. Removes okapi lib from list of libs included in linking. Instead of linking all libs in firmware folder, list specific libs (libc.a, libm.a, libpros.a) and by doing so exclude humongous okapilib.a (28Mb!). It's not used right now in the project, so no need to pay the cost of linker to consider it and not use anything from it.
  2. Currently, there are two files compiled in the project - main.cpp, and one created on the fly (let's call it _pros_ld_timestamp.c, but there is no file on disk, content is created on the fly and piped to compiler). These steps are synchronous, i.e., go one after another, so it slows down build (you can see it in console - it prints "Adding timestamp"). If you look at common.mk, the only thing in that second file - two _PROSCOMPILE* variables that record current date-time and path to project. We can do same think in main.cpp, and thus eliminate that extra step and speed up the build process.
  3. There are a ton of headers (.h) included that compiler needs to parse. Each header in api.h includes other headers, so number is really large - you can see it by examining .d\main.cpp.d file - after this change it shrunk like 10x, maybe even 50x.
    • biggest offender is LCD includes, so for now I commented out all LCD code as realistically we do not use it yet.

Note that either of these steps could be undone in the future if we have a need in a feature that is turned off. I.e., if we start using okapi lib, or LCD, we will undo appropriate step, of figure out how to enable it in more efficient way. The purpose of this change is to optimize process given what we use today.