8000 ATECC and LSM6DS firmwares for Arduino Nano 33 IoT by fgallaire · Pull Request #2675 · adafruit/circuitpython · GitHub
[go: up one dir, main page]

Skip to content

ATECC and LSM6DS firmwares for Arduino Nano 33 IoT #2675

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

Closed
wants to merge 5 commits into from

Conversation

fgallaire
Copy link

No description provided.

@ladyada
Copy link
Member
ladyada commented Mar 2, 2020

the LSM6DS makes some sense but since we wont be getting the WiFi working, we don't know that the ATECC/binascii makes sense to include, there's not a lot of space on these SAMD21 chips :)

@fgallaire
Copy link
Author
fgallaire commented Mar 2, 2020

the LSM6DS makes some sense but since we wont be getting the WiFi working, we don't know that the ATECC/binascii makes sense to include, there's not a lot of space on these SAMD21 chips :)

Hello @ladyada, not sure if it's the best way to do multiple firmwares, but it's the simplest I found.

ATECC is a cryptochip, it can be use for other things that securing WiFi, like.. a cryptokey :-)

@ladyada
Copy link
Member
ladyada commented Mar 2, 2020

OK - we don't have U2F support at this time

@tannewt
Copy link
Member
tannewt commented Mar 3, 2020

Could you give some background why you are wanting this? I really dislike multiple board definitions for the same board because it is confusing.

@fgallaire
Copy link
Author

Hello @tannewt, I completely agree with you, I don't like the concept as it's the same board.
But CircuitPython lacks a way to generate "flavors" of one board.

Why I need it for the Nano IoT is because its RAM and Flash limitations.

Not possible to import all the libs needed to use LSM6DS in RAM, we need them as frozen modules.

But frozen module take place in the flash with few space left for user code, so LSM6DS + ATECC libs could not be the best thing for everybody.

My "vision" is:

  • LSM6DS libs for an IMU project
  • ATECC libs for a security project
  • LSM6DS + ATECC for easy to test/pedagogical purpose

The circuitpython website is generated from the boards, so all this flavors will be easily downloadable for users.

@tannewt
Copy link
Member
tannewt commented Mar 5, 2020

Hello @tannewt, I completely agree with you, I don't like the concept as it's the same board.
But CircuitPython lacks a way to generate "flavors" of one board.

It lacks flavors because we don't want to have different flavors for a single board. (The only one we do is the CircuitPlayground Express and it is hopefully the last one.)

Not possible to import all the libs needed to use LSM6DS in RAM, we need them as frozen modules.

But frozen module take place in the flash with few space left for user code, so LSM6DS + ATECC libs could not be the best thing for everybody.

How much space is left? I'd much rather make the libraries smaller than create different flavors of a single board. That way all users of the library will benefit.

One optimization of the LSM6DS would be to comment out all bits that are unused by the driver. For example, _sdo_pu_en is unused and could be commented out to save space.

@fgallaire
Copy link
Author

I tried stripped down the libs (by exemple remove spi_device.py from BusDevice as we just need i2c_device.py) , but we don't gain a lot, and will need to maintain and synchronize stripped-down lib forks just for this board, lots of work for tiny gains.

@tannewt
Copy link
Member
tannewt commented Mar 5, 2020

Did you try stripping down LSM6DS? I think there are a lot of unnecessary RWBits that can be commented out and merged into mainline.

@fgallaire
Copy link
Author

No I haven't tried it, as I'm not an Adafruit paid developer, I'm just looking for a working and simple solution

@tannewt
Copy link
Member
tannewt commented Mar 5, 2020

Ok, I've taken a glance this and I agree we need to freeze some of these libraries in. The SAMD21 is just too small to fit both ATECC and LSM6DS in memory.

I still don't want multiple versions for a single board. Multiple versions are a long term support burden that I'm not willing to commit to. So, my preference would be to always freeze these two libraries and bus device in because both chips are on the board.

There is no need to freeze the binascii library in because the built in version can be enabled with MICROPY_PY_UBINASCII and will definitely be smaller and faster.

Rotaryio, usb_hid and usb_midi could be turned off to make space in the build as well. I wouldn't reduce the filesystem size because it is already very small.

@fgallaire
Copy link
Author

I still don't want multiple versions for a single board. Multiple versions are a long term support burden that I'm not willing to commit to. So, my preference would be to always freeze these two libraries and bus device in because both chips are on the board.

I agree, if we should have only one board it's the best fit

There is no need to freeze the binascii library in because the built in version can be enabled with MICROPY_PY_UBINASCII and will definitely be smaller and faster.

I don't know about it, if it exists, is smaller and faster, why isn't it already enabled ?

Rotaryio, usb_hid and usb_midi could be turned off to make space in the build as well. I wouldn't reduce the filesystem size because it is already very small.

The documentation says that Rotayio doesn't support SAMD21

@tannewt
Copy link
Member
tannewt commented Mar 6, 2020

There is no need to freeze the binascii library in because the built in version can be enabled with MICROPY_PY_UBINASCII and will definitely be smaller and faster.

I don't know about it, if it exists, is smaller and faster, why isn't it already enabled ?

Because it still takes up space. For builds that don't use it, it is smaller to omit it. In this case we should enable it instead of freezing in the Python version since we want it.

Rotaryio, usb_hid and usb_midi could be turned off to make space in the build as well. I wouldn't reduce the filesystem size because it is already very small.

The documentation says that Rotayio doesn't support SAMD21

It's worth double checking. I'm not sure the docs are correct. I was basing its inclusion in small builds based on the line here: https://github.com/adafruit/circuitpython/blob/master/py/circuitpy_mpconfig.mk#L230

@tannewt
Copy link
Member
tannewt commented Apr 29, 2020

@fgallaire Want to try adding these as frozen soon? I fixed turning off USB_HID and USB_MIDI so they free up more space in my #2685 PR which will hopefully be 8000 merged soon.

@tannewt tannewt self-requested a review June 1, 2020 22:23
@tannewt
Copy link
Member
tannewt commented Jun 1, 2020

I looked into this again today and it simply can't be done easily. My changes are here: https://github.com/tannewt/circuitpython/tree/arduino_nano_atecc

I've also opened a PR to add a note on circuitpython.org about it. adafruit/circuitpython-org#487

@tannewt tannewt closed this Jun 1, 2020
@fgallaire
Copy link
Author

@tannewt why are you afraid by a fixed problem ?
Just add the right frozen modules to the iso and all works just great !

@tannewt
Copy link
Member
tannewt commented Jun 2, 2020

@fgallaire I'm not sure what you mean by it being fixed or "iso".

@fgallaire
Copy link
Author

@tannewt "iso" was the probably wrongly named generated firmware.
Being fixed is that there is just no RAM problems when using frozen modules, so just provide the firmwares with frozen modules !

@tannewt
Copy link
Member
tannewt commented Jun 3, 2020

@fgallaire I couldn't fit the libraries in the firmware. I didn't want to reduce the filesystem size because 64k is already very tight for user code.

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.

3 participants
0