mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-19 05:40:38 +01:00
[ion] DFU reallocation: clean DCache after copying the DFU bootloader to the RAM
This commit is contained in:
@@ -47,6 +47,7 @@ dfu_src += liba/src/memset.c
|
||||
dfu_src += liba/src/memcpy.c
|
||||
dfu_src += libaxx/src/cxxabi/pure_virtual.cpp
|
||||
dfu_src += ion/src/device/shared/usb/boot.cpp
|
||||
dfu_src += ion/src/device/$(MODEL)/drivers/cache.cpp
|
||||
dfu_src += $(addprefix ion/src/device/shared/drivers/, \
|
||||
base64.cpp \
|
||||
external_flash.cpp \
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <ion/usb.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <drivers/cache.h>
|
||||
#include "../drivers/timing.h"
|
||||
|
||||
extern char _stack_end;
|
||||
@@ -47,6 +48,12 @@ void DFU() {
|
||||
/* 3- Copy the DFU bootloader from Flash to RAM. */
|
||||
|
||||
memcpy(dfu_bootloader_ram_start, &_dfu_bootloader_flash_start, dfu_bootloader_size);
|
||||
/* The DFU bootloader might have been copied in the DCache. However, when we
|
||||
* run the instructions from the DFU bootloader, the CPU looks for
|
||||
* instructions in the ICache and then in the RAM. We thus need to flush the
|
||||
* DCache to update the RAM. */
|
||||
// Flush data cache
|
||||
Device::Cache::cleanDCache();
|
||||
|
||||
/* 4- Disable all interrupts
|
||||
* The interrupt service routines live in the Flash and could be overwritten
|
||||
|
||||
Reference in New Issue
Block a user