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

Evaluate memory region expressions #7

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

Conversation

xarantolus
Copy link

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 :)

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.

1 participant