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

Memory Allocation issue on M0, others? #15

Open
caternuson opened this issue May 1, 2020 · 11 comments
Open

Memory Allocation issue on M0, others? #15

caternuson opened this issue May 1, 2020 · 11 comments
Labels
bug Something isn't working

Comments

@caternuson
Copy link

Re this thread:
https://forums.adafruit.com/viewtopic.php?f=19&t=164655

And my testing:

Adafruit CircuitPython 5.3.0 on 2020-04-29; Adafruit Metro M0 Express with samd21g18
>>> 
soft reboot

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Traceback (most recent call last):
  File "code.py", line 4, in <module>
  File "adafruit_lsm6ds.py", line 188, in <module>
  File "adafruit_lsm6ds.py", line 217, in LSM6DS
MemoryError: memory allocation failed, allocating 184 bytes
@ladyada
Copy link
Member

ladyada commented May 1, 2020

yeah its a large library - you'll need an M4/nRF for this.

that said, there are a few registers that are not used
https://github.com/adafruit/Adafruit_CircuitPython_LSM6DS/blob/master/adafruit_lsm6ds.py#L229
@siddacious please comment out unused registers

@tannewt
Copy link
Member

tannewt commented May 1, 2020

Are new libraries tested on M0s? Shouldn't we target the smallest platform for them? Making them small means they'll leave more room for user code on larger platforms as well.

It could be worth adding a memory size check to the library CI so it's prevalent how big each is.

@ladyada
Copy link
Member

ladyada commented May 1, 2020

this one was only tested on nrf52 (cause its used in the feather sense & clue) - a memory size check would be nice but not sure how we could calculate that?

@siddacious siddacious self-assigned this May 1, 2020
@tannewt
Copy link
Member

tannewt commented May 4, 2020

mpy size could be an approximation. I bet we could have mpy-cross actually output it since it loads everything into memory before writing it out to an mpy. Not a simple thing to do though.

@siddacious
Copy link
Contributor

I removed the unused registers but it still doesn't fit on the CPX. @ladyada lmk what if anything else you'd like me to do here

@ladyada
Copy link
Member

ladyada commented May 5, 2020

nope thats a good place to take a break, it may just not fit

@siddacious
Copy link
Contributor

@ladyada I'm un-assigning myself for now until there's something tangible for me to do

@siddacious siddacious removed their assignment Jun 6, 2020
@ladyada
Copy link
Member

ladyada commented Jun 6, 2020

kk

@evaherrada evaherrada added the bug Something isn't working label Jun 30, 2020
@jposada202020
Copy link
Contributor

Just wondering what we would like to do with this issue,I do not have a metro express but this test ok in a QT Py.

Adafruit CircuitPython 6.1.0 on 2021-01-21; Adafruit QT Py M0 with samd21e18
>>> import lsm6ds_lsm6ds33_simpletest
Acceleration: X:0.80, Y: 0.83, Z: 9.97 m/s^2
Gyro X:0.05, Y: -0.09, Z: -0.04 radians/s

Acceleration: X:0.81, Y: 0.84, Z: 9.96 m/s^2
Gyro X:0.05, Y: -0.09, Z: -0.04 radians/s

Acceleration: X:0.81, Y: 0.83, Z: 9.96 m/s^2
Gyro X:0.05, Y: -0.09, Z: -0.04 radians/s

@caternuson
Copy link
Author

Still hitting the issue on Metro M0 Express:

Adafruit CircuitPython 7.2.3 on 2022-03-16; Adafruit Metro M0 Express with samd21g18
>>> import lsm6ds_lsm6ds33_simpletest
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "lsm6ds_lsm6ds33_simpletest.py", line 6, in <module>
  File "adafruit_lsm6ds/__init__.py", line 158, in <module>
  File "adafruit_lsm6ds/__init__.py", line 190, in LSM6DS
MemoryError: memory allocation failed, allocating 184 bytes
>>> 

@ladyada
Copy link
Member

ladyada commented Mar 19, 2022

i think we just gotta update the readme and guide to say "SAMD21 can't use this advanced IMU"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants