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

Add expression parser #104

Merged
merged 5 commits into from
Jan 8, 2025
Merged

Add expression parser #104

merged 5 commits into from
Jan 8, 2025

Conversation

jonathanpallant
Copy link
Contributor

@jonathanpallant jonathanpallant commented Jan 7, 2025

Now we use evalexpr to fully evaluate expressions for ORIGIN and LENGTH. This means that we handle subtraction and addition and brackets and whatever else someone might do.

Apparently subtraction is quite common when reserving some space for the nRF52 SoftRadio, like:

  RAM : ORIGIN = 0x20000000 + 32K, LENGTH = 256K - 32K

Fixes #66, #101 and #103

Now ORIGIN and LENGTH can use `(64K + 4K) - 8K` and it will just work.

Fixes #103
Fixes #101
Fixes #66
This makes it tolerate missing whitespace.
@jonathanpallant
Copy link
Contributor Author

Force pushed to remove redundant function now we're using evalexpr to handle, K, M and G.

The trick, it turns out, was just to replace K with *1024 (etc).

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
Cargo.toml Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
test-flip-link-app/examples/hello.rs Show resolved Hide resolved
jonathanpallant and others added 2 commits January 7, 2025 13:10
Co-authored-by: Johann Hemmann <johann.hemmann@ferrous-systems.com>
Minor tidy-ups and typos

Co-authored-by: Johann Hemmann <johann.hemmann@ferrous-systems.com>
@jonathanpallant
Copy link
Contributor Author

Good to go @Urhengulas ?

@Urhengulas Urhengulas added this pull request to the merge queue Jan 8, 2025
Merged via the queue into main with commit 8bcbe8b Jan 8, 2025
10 checks passed
@Urhengulas Urhengulas deleted the add-expr-parser branch January 8, 2025 11:55
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.

subtraction is handled incorrectly
2 participants