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

SDK code size reduction #90

Open
magnmaeh opened this issue May 5, 2024 · 0 comments
Open

SDK code size reduction #90

magnmaeh opened this issue May 5, 2024 · 0 comments

Comments

@magnmaeh
Copy link
Collaborator

magnmaeh commented May 5, 2024

Since FlexPRET has so little memory, it becomes especially important to keep the SDK's memory footprint low.

An immediate suggestion for optimization is __ie_jmp_buf and __ee_jmp_buf. Each takes up 1216B for four hardware threads; double that for eight hardware threads. It is large because it needs to save all registers so they can be restored later.

It is uncommon to use them all at the same time (and some application may not even use them, ever). Also, it does not make sense for a hardware thread to set up an interrupt on expire and exception on expire at the same time. Therefore, it might be a good idea to dynamically allocate these struct arrays when we want to use them. (As opposed to statically allocating them, which they are as of now.) In that case, the __ie_jmp_buf and __ee_jmp_buf arrays could maybe instead contain pointers to the jump buffer or NULL.

To find other candidates for optimization, a suggestion is to run nm <compiled program> --size-sort. This gives an overview of all symbols within the executable - and most importantly, their sizes.

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

No branches or pull requests

1 participant