Skip to content

Circuitpython nickzoic 1042 nrf nvm bytearray 2 #1768

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

Conversation

nickzoic
Copy link

@nickzoic nickzoic commented Apr 9, 2019

OK, so this is a new pull request at last for #1042, replacing #1610 which I've closed.

This version moves the code for flash access into ports/nrf/peripherals/nrf/nvm.c which is used by both ports/nrf/supervisor/internal_flash.c and by ports/nrf/common-hal/nvm/ByteArray.c.

The NVM store uses page(s) at the end of the FATFS page allocation, depending on the size of CIRCUITPY_INTERNAL_NVM_SIZE.

nickzoic added 8 commits April 9, 2019 10:54
import microcontroller

def dump(n = microcontroller.nvm):
    for i in range(0,len(n)):
        print ("%02X " % n[i], end="")
        if i % 16 == 15: print('')

microcontroller.nvm[0:4096] = bytes([1,2,3,4,5,6,7,8]) * 512
microcontroller.nvm[4096:8192] = bytes([16,17,18,19]) * 1024
microcontroller.nvm[4090:4101] = b'thisisatest'
microcontroller.nvm[100:105] = b'hello'
microcontroller.nvm[8000:8007] = b'goodbye'
dump()
@nickzoic nickzoic requested review from dhalbert and tannewt April 9, 2019 01:16
Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

See comments. Also BOARD=pca10059 doesn't build.

@dhalbert
Copy link
Collaborator

dhalbert commented Apr 9, 2019

Also, could you make similar changes to the pca10056 build so it can use nvm?

@nickzoic
Copy link
Author

nickzoic commented Apr 9, 2019

See comments. Also BOARD=pca10059 doesn't build.

Yep, I've added in a catch this so that if CIRCUITPY_INTERNAL_NVM_SIZE isn't defined it defaults to zero.

@nickzoic
Copy link
Author

nickzoic commented Apr 9, 2019

OK so I also modified your adafruit_ble.uart.UARTServer code to write to flash while it was talking and that passes tests too so hopefully ...

@nickzoic nickzoic requested a review from dhalbert April 10, 2019 11:09
@dhalbert
Copy link
Collaborator

@nickzoic - hi, I started reviewing this yesterday, but was getting errors when trying to subscript nvm on a Feather 52840. And then I ran into #1773, which interfered with debugging. Will go back to testing this todya.

@tannewt
Copy link
Member

tannewt commented Apr 12, 2019

Closing in favor of #1779. Thanks for getting us going!

@tannewt tannewt closed this Apr 12, 2019
tannewt added a commit that referenced this pull request Apr 15, 2019
nrf nvm: touchups to nickzoic PR #1768
tannewt added a commit that referenced this pull request Apr 16, 2019
tannewt added a commit that referenced this pull request Apr 16, 2019
Revert "nrf nvm: touchups to nickzoic PR #1768"
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