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

De-string variable-length memory addresses correctly from JSON #26

Open
thanasipantazides opened this issue Jul 18, 2023 · 1 comment
Open

Comments

@thanasipantazides
Copy link
Contributor

The trouble

In *_commands.json command files, there are fields like this:

"address":"0x00"

When they are parsed into a std::vector<uint8_t> by string_to_chars(std::string hex_str), the written string length in the JSON will be preserved. The problem is that this length passes directly to the SpaceWire packet constructing functions, and results in a too-short SpaceWire address field if the JSON addresses are not explicitly written 4 B long.

Fix

When parsing out the command file JSON, guarantee the result stored in Command is 4 B long. This is done in CommandDeck::add_commands().

@thanasipantazides
Copy link
Contributor Author

For now, this is mitigated by writing all memory addresses in the source .xlsx files (in foxsi4-commands) as 4 byte long.

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

1 participant