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 LZSS encoding/decoding for MKRNB 1500 SBU #551

Merged
merged 5 commits into from
Jul 24, 2020

Conversation

giulcioffi
Copy link
Contributor

This PR provides the possibility to store a .lzss compressed binary in the SARA-R410M module and decode it back to a binary during the reboot by the SBU. The example SBU_LoadLZSS.ino allows to test it.
The lzss library is provided under /libraries/SBU/extras/SBUBoot with a symlink to /libraries/SBU/examples/SBU_LoadLZSS.
First of all, the function void lzss_init(uint32_t const sketch_start, bool LZSStoBIN) must be called. There are 2 possibilities:

  • lzss_init(0, false) : we want to perform a LZSS encoding (.H -> .LZSS);
  • lzss_init(SKETCH_START, true) : we want to perform a LZSS decoding (.LZSS -> .H), with SKETCH_START the address of the flash were the decoded file must be written.
    The function int lzss_encode(const char buf_in[], uint32_t size) reads the incoming buffer (from BINARY.H), performs the lzss encoding by chunks of 512 bytes and writes the obtained characters into the Sara modem in a file called "UPDATE.BIN.LZSS".
    On the other hand, the function void lzss_decode() reads the encoded "UPDATE.BIN.LZSS", decodes it back to a binary stream and writes it into the flash.

Copy link
Contributor

@aentinger aentinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 Successfully tested with MKR NB 1500 👍 Thank you @giulcioffi 🚀

@aentinger aentinger merged commit 71b410b into arduino:master Jul 24, 2020
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.

None yet

2 participants