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

-ffixed is no longer needed? #160

Open
WestfW opened this issue Sep 25, 2024 · 4 comments
Open

-ffixed is no longer needed? #160

WestfW opened this issue Sep 25, 2024 · 4 comments

Comments

@WestfW
Copy link

WestfW commented Sep 25, 2024

platform.txt contains:

# fixed registers: r4 = isr_tmp, r3:r2 = WDT counter for millis
#compiler.optimize_flags=-Os -flto -fno-move-loop-invariants -fno-reorder-blocks -ffixed-r2 -ffixed-r3 -ffixed-r4
compiler.optimize_flags=-Os -flto -fno-reorder-blocks -ffixed-r2 -ffixed-r3 -ffixed-r4

However, it looks like the nerdRalph millis code no longer keeps stuff in registers; I can't find any actual used of r2-r4 anywhere in the current source code.

(it is unlikely that this will change anything in any program small enough to fit in a tiny13, but...)

@MCUdude
Copy link
Owner

MCUdude commented Sep 25, 2024

To be honest, I don't know for sure. I was struggling to get the size of a compiled, blank sketch down to the same size as @nerdralph's picoCore would achieve. I asked him what the secret sauce was, and I was allowed to borrow code (and platform.txt data) to achieve similar results.

Can you try to remove the -ffixed flags and see how/if it makes a difference?

@WestfW
Copy link
Author

WestfW commented Sep 25, 2024

It looks like picoCore uses an entirely register-based WDT/millis implementation: https://github.com/nerdralph/picoCore/blob/master/avr/cores/picocore/millis.S#L23
While microCore has the somewhat bigger NerdRalph Memory-based millis() (when it's turned on.) ( https://github.com/MCUdude/MicroCore/blob/master/avr/cores/microcore/millis.S#L46 )

@MCUdude
Copy link
Owner

MCUdude commented Sep 25, 2024

Not sure why I haven't caught the change. Would you like to submit a PR for it? I'm all for saving every bit of memory on these tiny AVRs!

@nerdralph
Copy link
Contributor

nerdralph commented Sep 25, 2024 via email

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

3 participants