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

machine: compute rp2 clock dividers from crystal and target frequency #4747

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

eliasnaur
Copy link
Contributor

Follow-up to #4728 which implemented the algorithm for finding the dividers.

The calculation is computed at compile time by interp, as verified by the unchanging size for example/blinky1 for -target pico.

@soypat you mentioned that you couldn't get TinyGo to compute the dividers at compile time. However, this PR doesn't change the size of the blinky1 example for -target pico1. What did I miss?

Follow-up to tinygo-org#4728 which implemented the algorithm for finding the
dividers.

The calculation is computed at compile time by interp, as verified by
building example/blinky1 for -target pico.
@soypat
Copy link
Contributor

soypat commented Feb 22, 2025

Interesting you got the same size. I tried something similar, but instead of using init I tried directly initializing the variable at package level var pllSys, pll... = pllSearch{...}.CalcDiv(...) and I actually got a smaller binary size than the blinky example which told me something was VERY wrong. sure enough when flashing a RP2040 the light would not light up, presumably having crashed/panicked in calculation.

Will try to test it

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