8000 stm32/uart_repl: Disable irq flash erase/write if uart repl enabled. by andrewleech · Pull Request #8645 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content

stm32/uart_repl: Disable irq flash erase/write if uart repl enabled. #8645

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 1 commit into from

Conversation

andrewleech
Copy link
Contributor
@andrewleech andrewleech commented May 9, 2022

Uart repl stdin loses data when the background flash erase / cache flush happens during communication.

This change forces all erase / write operations to happen during file sync/close instead.

This change can be overridden by defining MICROPY_HW_FLASH_BACKGROUND_CACHE (1) in board config.

For more details see: mpremote cannot cp files to stm32wb55 nucleo on stlink/com port. #8386

I'm not sure if there are likely to be other unintended side-effects of disabling this flash irq however?

@@ -64,7 +64,9 @@ void storage_init(void) {
// Enable the flash IRQ, which is used to also call our storage IRQ handler
// It must go at the same priority as USB (see comment in irq.h).
NVIC_SetPriority(FLASH_IRQn, IRQ_PRI_FLASH);
#if (MICROPY_HW_FLASH_BACKGROUND_CACHE) || defined(MICROPY_HW_BDEV2_IOCTL)
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is needed, it can enable the IRQ unconditionally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I figured with this enabled all the time, there's an unneccesary (albeit miniscule) cpu overhead of having the now-empty irq function running on a regular basis.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, OK. Then maybe it's even better to just disable this line:

systick_enable_dispatch(SYSTICK_DISPATCH_STORAGE, storage_systick_callback);

Then you don't need to touch anything in flashbdev.c.

Ultimately I want to switch to a soft-timer based implementation for this storage flushing callback... but that can wait.

Uart repl stdin loses data when the background flash erase / cache flush
happens during communication.

This change forces all erase / write operations to happen during file
sync/close instead.

This change can be overridden in board config etc. with:
#define MICROPY_HW_FLASH_BACKGROUND_CACHE (1)

For more details see micropython#8386
@dpgeorge
Copy link
Member
dpgeorge commented Aug 8, 2022

Closing in favour of #8713.

@dpgeorge dpgeorge closed this Aug 8, 2022
tannewt pushed a commit to tannewt/circuitpython that referenced this pull request Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0