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

Merge 7.1 fixes back into main #5686

Merged
merged 31 commits into from
Dec 9, 2021
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
80abd2d
Use a longer clock stretching timeout for RP2040 zero-byte I2C writes
dhalbert Dec 3, 2021
d486284
Merge pull request #5657 from pewpew-game/pygamer-pybadge-lite
dhalbert Dec 4, 2021
f49271b
disable interrupts inside of ports raspberrypi common hal
FoamyGuy Dec 4, 2021
5e7c132
disable interrupts inside of write_page and erase_write_sector
FoamyGuy Dec 4, 2021
fa37ee6
limit disable interrupts to flash calls
FoamyGuy Dec 4, 2021
36c1e8c
Merge pull request #5663 from FoamyGuy/rp2040_nvm_fix
dhalbert Dec 5, 2021
4de6c7c
Merge pull request #5656 from dhalbert/rp2040-i2c-zero-write-bitbang-…
dhalbert Dec 5, 2021
92bb909
add a frequencyin_reset() for VM restart
dhalbert Dec 5, 2021
5fe4c3b
fix mistaken use of PWM channel for slice
dhalbert Dec 6, 2021
4a4c5d7
formatting updates for updated black
dhalbert Dec 6, 2021
da1c330
formatting updates for updated black
dhalbert Dec 6, 2021
c43e0bd
uncrustify fixes
dhalbert Dec 6, 2021
ee1987d
Added Maker Nano RP2040 to branch 7.1.x.
waiweng83 Dec 6, 2021
d02ea88
empty commit
dhalbert Dec 6, 2021
be1d1d2
Merge pull request #5667 from dhalbert/rp2-pwmout-counter-fix
tannewt Dec 6, 2021
8d406e0
Merge pull request #5670 from dhalbert/fix-blacken-update-formatting-…
tannewt Dec 6, 2021
7e21344
fix FrequencyIn for crystalless boards and simplify clock logic
dhalbert Dec 7, 2021
6413e49
empty commit
dhalbert Dec 7, 2021
e0e3224
forgot a check for BOARD_HAS_CRYSTAL
dhalbert Dec 7, 2021
5740393
Merge pull request #5665 from dhalbert/frequencyio-fix
tannewt Dec 7, 2021
981e370
Pass ci_fetch_deps.py the sha rather than ref
tannewt Dec 7, 2021
474986f
restore BLEIO HCI background task
dhalbert Dec 8, 2021
637cc23
Merge pull request #5681 from tannewt/fix_ci_versioning
dhalbert Dec 8, 2021
5756eaf
empty commit
waiweng83 Dec 8, 2021
7bcfbe3
shrink some boards
dhalbert Dec 8, 2021
bf08f62
Merge pull request #5683 from dhalbert/restore-bleio-hci-background
tannewt Dec 8, 2021
3c8a05e
Merge pull request #5673 from CytronTechnologies/add-maker-nano-rp204…
tannewt Dec 8, 2021
b12d206
Merge remote-tracking branch 'adafruit/7.1.x' into merge_7.1
tannewt Dec 8, 2021
a06e41a
Three more sha spots for CI
tannewt Dec 8, 2021
cd47941
Merge pull request #5687 from tannewt/more_shas
tannewt Dec 8, 2021
89ce4d6
Merge remote-tracking branch 'adafruit/7.1.x' into merge_7.1
tannewt Dec 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
limit disable interrupts to flash calls
  • Loading branch information
FoamyGuy committed Dec 4, 2021
commit fa37ee64844fefc770fca3f4a5a7c1253c8e580a
15 changes: 8 additions & 7 deletions ports/raspberrypi/common-hal/nvm/ByteArray.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,31 +43,32 @@ uint32_t common_hal_nvm_bytearray_get_length(const nvm_bytearray_obj_t *self) {
}

static void write_page(uint32_t page_addr, uint32_t offset, uint32_t len, uint8_t *bytes) {
// disable interrupts to prevent core hang on rp2040
common_hal_mcu_disable_interrupts();

// Write a whole page to flash, buffering it first and then erasing and rewriting it
// since we can only write a whole page at a time.
if (offset == 0 && len == FLASH_PAGE_SIZE) {
// disable interrupts to prevent core hang on rp2040
common_hal_mcu_disable_interrupts();
flash_range_program(RMV_OFFSET(page_addr), bytes, FLASH_PAGE_SIZE);
common_hal_mcu_enable_interrupts();
} else {
uint8_t buffer[FLASH_PAGE_SIZE];
memcpy(buffer, (uint8_t *)page_addr, FLASH_PAGE_SIZE);
memcpy(buffer + offset, bytes, len);
common_hal_mcu_disable_interrupts();
flash_range_program(RMV_OFFSET(page_addr), buffer, FLASH_PAGE_SIZE);
common_hal_mcu_enable_interrupts();
}
common_hal_mcu_enable_interrupts();

}

static void erase_and_write_sector(uint32_t address, uint32_t len, uint8_t *bytes) {
// disable interrupts to prevent core hang on rp2040
common_hal_mcu_disable_interrupts();

// Write a whole sector to flash, buffering it first and then erasing and rewriting it
// since we can only erase a whole sector at a time.
uint8_t buffer[FLASH_SECTOR_SIZE];
memcpy(buffer, (uint8_t *)CIRCUITPY_INTERNAL_NVM_START_ADDR, FLASH_SECTOR_SIZE);
memcpy(buffer + address, bytes, len);
// disable interrupts to prevent core hang on rp2040
common_hal_mcu_disable_interrupts();
flash_range_erase(RMV_OFFSET(CIRCUITPY_INTERNAL_NVM_START_ADDR), FLASH_SECTOR_SIZE);
flash_range_program(RMV_OFFSET(CIRCUITPY_INTERNAL_NVM_START_ADDR), buffer, FLASH_SECTOR_SIZE);
common_hal_mcu_enable_interrupts();
Expand Down