Skip to content

Instantly share code, notes, and snippets.

@foxtacles
Last active December 9, 2023 14:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save foxtacles/cbf11160ffd6152b48321c57143639f3 to your computer and use it in GitHub Desktop.
Save foxtacles/cbf11160ffd6152b48321c57143639f3 to your computer and use it in GitHub Desktop.
Some ideas for extra tooling

Names, syntax etc. are just placeholders for illustration.

interleave

This tool takes a .cpp file, finds the first and the last function annotation in the file, then searches the entire codebase and "interleaves" all functions that appear between the first/last function in the .cpp file, based on their offset/address.

Could optionally also prepend/append functions before/after the first/last function in case of "reasonable" offset gap.

The output is the .cpp file with "comment syntax"-style function annotations interleaved between the functions where they belong, so that checkorder would still pass on the .cpp file.

Run like: interleave LEGO1\mxstreamcontroller.cpp

Output: Same file with annotations interleaved, or alternatively a tabular summary of all function signatures + offsets

Bonus: Report likely dependencies, i.e. report the classes of functions that have been interleaved.

globalorder

This tool scans the entire codebase, obtaining the first address of each .cpp file, and then reports in which order the .cpp files appear based on ascending order of that first addresses.

This is useful to get a rough idea in which order we will have to lay out the units in our build.

Run like: globalorder LEGO1

Output: A table-like report or similar of .cpp files with initial offsets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment