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

Debug tools #118

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft

Debug tools #118

wants to merge 9 commits into from

Conversation

szszszsz
Copy link
Member

@szszszsz szszszsz commented Nov 26, 2022

Some debug tools for determining the code size and static memory usage.
To do:

  • select the best representation
  • ideally diff with the latest release

Reports example:
extra-lpc55-nk3xn.zip

Example:

==================================================================== RAM =====================================================================
Symbol                                                                                                                      Size        %     
==============================================================================================================================================
?                                                                                                                            93.1 KiB   100.00
  embedded_runner_lib::init_alloc::HEAP::h71f6c3eded142d29                                                                   32.0 KiB    34.36
  trussed::pipe::TrussedInterchange::split::INTERCHANGES::had41e9affdcc3b86                                                  11.8 KiB    12.63
  embedded_runner_lib::types::VOLATILE_STORAGE::h3eee3a3e6699a4c7                                                             8.0 KiB     8.59
  lpc55_runner::app::__rtic_internal_shared_resource_apdu_dispatch::h6da4b5818387e48b                                         7.5 KiB     8.05
  ctaphid_dispatch::types::HidInterchange::split::INTERCHANGES::h0f01a8b21cc4ed18                                             7.4 KiB     7.99
  lpc55_runner::app::__rtic_internal_shared_resource_usb_classes::hb66322c405820469                                           6.9 KiB     7.42
  lpc55_runner::app::__rtic_internal_shared_resource_contactless::h51e1aecd5103c4a9                                           3.3 KiB     3.54
  apdu_dispatch::interchanges::Contact::split::INTERCHANGES::h5c77c9dc592475e9                                                3.0 KiB     3.23
  apdu_dispatch::interchanges::Contactless::split::INTERCHANGES::h71b7b2f8c5d013a0                                            3.0 KiB     3.23
  lpc55_runner::app::__rtic_internal_shared_resource_trussed::haab7366e7e1bd2ec                                               2.4 KiB     2.63
  lpc55_runner::app::__rtic_internal_shared_resource_apps::hd6cdd94f003a70d9                                                  2.3 KiB     2.46
  embedded_runner_lib::types::INTERNAL_FS_ALLOC::ha7d8fed65128cab2                                                            1.3 KiB     1.35
  embedded_runner_lib::types::EXTERNAL_FS_ALLOC::h52478b942e961a3c                                                            1.2 KiB     1.29
  embedded_runner_lib::types::VOLATILE_FS_ALLOC::h3f05f595c1f2da7c                                                            1.2 KiB     1.29
  embedded_runner_lib::types::EXTERNAL_STORAGE::hc21e2a19264981f3                                                             1.0 KiB     1.07
  embedded_runner_lib::soc::init::USBD::h933e8090cc446e58                                                                   272.0 B       0.29
  <num_bigint_dig::bigrand::SMALL_PRIMES_PRODUCT as core::ops::deref::Deref>::deref::__stability::LAZY::hef6177eb95dac0d5    56.0 B       0.06
  <num_bigint_dig::prime::BIG_1 as core::ops::deref::Deref>::deref::__stability::LAZY::hd1781078a6380c8c                     56.0 B       0.06
  <num_bigint_dig::prime::BIG_2 as core::ops::deref::Deref>::deref::__stability::LAZY::h07a7a00c7a642059                     56.0 B       0.06
  <num_bigint_dig::prime::BIG_3 as core::ops::deref::Deref>::deref::__stability::LAZY::hf98bb04bed7fef71                     56.0 B       0.06
  <num_bigint_dig::prime::BIG_64 as core::ops::deref::Deref>::deref::__stability::LAZY::h7b5c9c488747da28                    56.0 B       0.06
  lpc55_runner::app::__rtic_internal_TQ_Monotonic::hfbf28f49d3dd1529                                                         52.0 B       0.05

Add cargo-bloat calls to monitor code size per function and crate
Sort non-text symbols according to the size
@szszszsz
Copy link
Member Author

Any thoughts @robin-nitrokey ?

@szszszsz
Copy link
Member Author

@robin-nitrokey friendly ping!

@szszszsz szszszsz requested review from robin-nitrokey and removed request for robin-nitrokey May 11, 2023 18:04
Copy link
Member

@robin-nitrokey robin-nitrokey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay.

  1. Rebase needed.
  2. I think the comments regarding .gitlab-ci.yml are addressed in the current main branch.
  3. make build should not run cargo install. Instead, we should document it as a dev dependency and add it to the Dockerfile. If we want to automate it, I’d introduce a make install target.
  4. Maybe we should move the size analysis to a separate target? It’s probably not necessary for every development build.
  5. I think the functionality from Robin-scripts is now available in utils/lpc55-runner and can be removed here.

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

Successfully merging this pull request may close these issues.

2 participants