lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-asf4-dfu/+/42322?usp=email )
Change subject: dfu: download: make variables between IRQ and main loop volatile ......................................................................
dfu: download: make variables between IRQ and main loop volatile
Both are access by IRQ and mainloop and are written by the IRQ handler.
Change-Id: Ic3dccd77eff7feb164f9f07047680eef3f7c2516 --- M usb/class/dfu/device/dfudf.c M usb/class/dfu/device/dfudf.h 2 files changed, 4 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-asf4-dfu refs/changes/22/42322/1
diff --git a/usb/class/dfu/device/dfudf.c b/usb/class/dfu/device/dfudf.c index 389f07f..7388060 100644 --- a/usb/class/dfu/device/dfudf.c +++ b/usb/class/dfu/device/dfudf.c @@ -43,8 +43,8 @@ volatile enum usb_dfu_status dfu_status = USB_DFU_STATUS_OK;
uint8_t dfu_download_data[512]; -uint16_t dfu_download_length = 0; -size_t dfu_download_offset = 0; +volatile uint16_t dfu_download_length = 0; +volatile size_t dfu_download_offset = 0;
/* buffer the first block, to write it last */ uint8_t dfu_download_data_first[512]; diff --git a/usb/class/dfu/device/dfudf.h b/usb/class/dfu/device/dfudf.h index 390aace..15d6ad3 100644 --- a/usb/class/dfu/device/dfudf.h +++ b/usb/class/dfu/device/dfudf.h @@ -48,9 +48,9 @@ */ extern uint8_t dfu_download_data[512]; /** Length of downloaded data in bytes */ -extern uint16_t dfu_download_length; +extern volatile uint16_t dfu_download_length; /** Offset of where the downloaded data should be flashed in bytes */ -extern size_t dfu_download_offset; +extern volatile size_t dfu_download_offset;
extern uint8_t dfu_download_data_first[512]; extern volatile uint16_t dfu_download_length_first;