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

Incorrect static const data behavior in native module on esp32. #14429

Open
2 tasks done
BrianPugh opened this issue May 5, 2024 · 0 comments
Open
2 tasks done

Incorrect static const data behavior in native module on esp32. #14429

BrianPugh opened this issue May 5, 2024 · 0 comments
Labels

Comments

@BrianPugh
Copy link
Contributor

Checks

  • I agree to follow the MicroPython Code of Conduct to ensure a safe and respectful space for everyone.

  • I've searched for existing issues matching this bug, and didn't find any.

Port, board and/or hardware

esp32

MicroPython version

MicroPython v1.22.2 on 2024-02-22; Generic ESP32 module with ESP32

Reproduction

I have a medium-complex native module that performs lossless data compression/decompression.
My code as a native modules has been tested to work on x64 and armv6m. I'm currently testing on esp32 and my code is not longer working; I have narrowed it down to the following:

I have a few static const variables defined here. If I remove the static, the code works fine. However, I tried adding static to examples/natmod/features1, and that code works fine with a static. So I have no idea what's going on here.

I found this out because write_to_bit_buffer was being invoked with n_bits=32 at one point, and I traced this down to huffman_bits[0] == 32, but obviously the value should be the constant 0x2.

Expected behaviour

If my library is operating correctly, it should have the following behavior:

>>> import tamp
>>> tamp.compress(b"foo")
b'X\xb3\x04\x18'
>>> tamp.decompress(tamp.compress(b"foo"))
bytearray(b'foo')

Observed behaviour

Accessing the RO data results in incorrect values.

Additional Information

No, I've provided everything above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant