Skip to content

Commit

Permalink
tools/mpy-tool.py: Rework .mpy merging feature.
Browse files Browse the repository at this point in the history
Now that the native qstr link table is gone, merging a native .mpy file
with a bytecode .mpy file is not as simple as concatenating the .mpy data.
The qstr_table and obj_table tables from all merged .mpy files must now be
joined together, because they are global to the .mpy file (and hence global
to the merged .mpy file).  This means the bytecode needs to be be decoded,
qstr_table and obj_table indices updated to point to the correct entries in
the new tables, and then the bytecode re-encoded.

This commit makes this change to the merging feature in mpy-tool.py.  This
can now merge an arbitrary number of bytecode .mpy files, and up to one
native .mpy file.

Signed-off-by: Damien George <[email protected]>
  • Loading branch information
dpgeorge committed Jun 7, 2022
1 parent f506bf3 commit 599a22e
Showing 1 changed file with 252 additions and 67 deletions.
Loading

0 comments on commit 599a22e

Please sign in to comment.