Skip to content

Commit

Permalink
nRF52: Write flash in 2k blocks (not 4k) as SD 6.1.1 can crash (proba…
Browse files Browse the repository at this point in the history
…bly good for earlier SD too)
  • Loading branch information
gfwilliams committed Feb 19, 2024
1 parent b551c92 commit 1cffe1b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
nRF52: Lower expected BLE XTAL accuracy to 50ppm (can improve BLE stability on some Bangle.js 2)
Emulator: force stack alignment of 'data' variable when accessing ArrayBuffers (fix #2463)
Swapped GCC version from 8.2.1 to 13.2.1 (fix #2455)
nRF52: Write flash in 2k blocks (not 4k) as SD 6.1.1 can crash (probably good for earlier SD too)

2v21 : nRF52: free up 800b more flash by removing vector table padding
Throw Exception when a Promise tries to resolve with another Promise (#2450)
Expand Down
4 changes: 2 additions & 2 deletions targets/nrf5x/jshardware.c
Original file line number Diff line number Diff line change
Expand Up @@ -2641,8 +2641,8 @@ void jshFlashWrite(void * buf, uint32_t addr, uint32_t len) {
uint32_t l = len;
#ifdef NRF51_SERIES
if (l>1024) l=1024; // max write size
#else
if (l>4096) l=4096; // max write size
#else // SD 6.1.1 doesn't like flash ops that take too long so we must not write the full 4096 (probably a good plan on older SD too)
if (l>2048) l=2048; // max write size
#endif
len -= l;
while ((err = sd_flash_write(((uint32_t*)addr)+wordOffset, ((uint32_t *)buf)+wordOffset, l>>2)) == NRF_ERROR_BUSY && !jspIsInterrupted());
Expand Down

0 comments on commit 1cffe1b

Please sign in to comment.