Skip to content

Conversation

@xarantolus
Copy link
Contributor

Hello,

I've recently been in the situation where I wanted to parse a linker script like the following:

MEMORY
{
  FLASH : ORIGIN = 0x08000000, LENGTH = 8K

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

The crate doesn't support evaluating expressions like in the origin and length field of RAM; the parse function returns an Ok result with an empty vector, which was unexpected for me.

I added code that directly calculates fields like LENGTH = 640K - 256K for memory regions. A lot of operators are not yet supported, because I wasn't quite sure how to handle their edge cases, but this provides a base that works for most expressions one would use in these memory declarations.

All tests continue to pass. Please feel free to point out any issues :)

@pftbest pftbest merged commit d749802 into pftbest:master Jun 7, 2025
@pftbest
Copy link
Owner

pftbest commented Jun 7, 2025

Thank you!

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