mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-19 05:40:38 +01:00
[ion] DFU leave instruction triggers a core reset on N0101 and a soft
reset on N0100 (to avoid booting on ST bootloader as the device is plugged)
This commit is contained in:
@@ -2,4 +2,6 @@ ion_device_src += $(addprefix ion/src/device/n0100/drivers/, \
|
||||
board.cpp \
|
||||
)
|
||||
|
||||
ion_device_src += ion/src/device/n0101/usb/stack/device.cpp
|
||||
|
||||
LDSCRIPT ?= ion/src/device/n0100/flash.ld
|
||||
|
||||
20
ion/src/device/n0100/usb/stack/device.cpp
Normal file
20
ion/src/device/n0100/usb/stack/device.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <usb/stack/device.h>
|
||||
#include <drivers/reset.h>
|
||||
|
||||
namespace Ion {
|
||||
namespace Device {
|
||||
namespace USB {
|
||||
|
||||
void Device::leave() {
|
||||
/* We don't perform a core reset because at this point in time the USB cable
|
||||
* is most likely plugged in. Doing a full core reset would be the clean
|
||||
* thing to do but would therefore result in the device entering the ROMed
|
||||
* DFU bootloader, which we want to avoid. By performing a jump-reset, we
|
||||
* will enter the newly flashed firmware. */
|
||||
Ion::Device::Reset::jump();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,6 @@ ion_device_src += $(addprefix ion/src/device/n0101/drivers/, \
|
||||
cache.cpp \
|
||||
)
|
||||
|
||||
ion_device_src += ion/src/device/n0101/usb/stack/device.cpp
|
||||
|
||||
LDSCRIPT ?= ion/src/device/n0101/flash.ld
|
||||
|
||||
16
ion/src/device/n0101/usb/stack/device.cpp
Normal file
16
ion/src/device/n0101/usb/stack/device.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#include <usb/stack/device.h>
|
||||
#include <drivers/reset.h>
|
||||
|
||||
namespace Ion {
|
||||
namespace Device {
|
||||
namespace USB {
|
||||
|
||||
void Device::leave() {
|
||||
Ion::Device::Reset::core();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ 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 += ion/src/device/$(MODEL)/usb/stack/device.cpp
|
||||
dfu_src += $(addprefix ion/src/device/shared/drivers/, \
|
||||
base64.cpp \
|
||||
external_flash.cpp \
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "calculator.h"
|
||||
#include <ion/usb.h>
|
||||
#include <drivers/keyboard.h>
|
||||
#include <drivers/reset.h>
|
||||
#include <drivers/serial_number.h>
|
||||
|
||||
namespace Ion {
|
||||
@@ -30,12 +29,7 @@ void Calculator::PollAndReset(bool exitWithKeyboard) {
|
||||
c.detach();
|
||||
}
|
||||
if (c.resetOnDisconnect()) {
|
||||
/* We don't perform a core reset because at this point in time the USB cable
|
||||
* is most likely plugged in. Doing a full core reset would be the clean
|
||||
* thing to do but would therefore result in the device entering the ROMed
|
||||
* DFU bootloader, which we want to avoid. By performing a jump-reset, we
|
||||
* will enter the newly flashed firmware. */
|
||||
Ion::Device::Reset::jump();
|
||||
c.leave();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ public:
|
||||
void poll();
|
||||
bool isSoftDisconnected() const;
|
||||
void detach();
|
||||
void leave();
|
||||
bool resetOnDisconnect() { return m_resetOnDisconnect; }
|
||||
void setResetOnDisconnect(bool reset) { m_resetOnDisconnect = reset; }
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user