[bootloader] Use custom USB descriptor

This commit is contained in:
M4x1m3
2022-02-27 00:28:46 +01:00
parent 5a7b076ebe
commit dee783065b
7 changed files with 34 additions and 2 deletions

View File

@@ -8,6 +8,7 @@ bootloader_src += $(addprefix bootloader/,\
interface.cpp \
jump_to_firmware.s \
trampoline.cpp \
usb_desc.cpp \
)
bootloader_images = $(addprefix bootloader/, \
@@ -15,6 +16,6 @@ bootloader_images = $(addprefix bootloader/, \
computer.png \
)
bootloader_src += $(ion_src) $(kandinsky_src) $(liba_src) $(libaxx_src) $(bootloader_images)
bootloader_src += $(filter-out ion/src/device/shared/drivers/usb_desc.cpp,$(ion_src)) $(kandinsky_src) $(liba_src) $(libaxx_src) $(bootloader_images)
$(eval $(call depends_on_image,bootloader/interface.cpp,$(bootloader_images)))

12
bootloader/usb_desc.cpp Normal file
View File

@@ -0,0 +1,12 @@
namespace Ion {
namespace Device {
namespace USB {
const char* stringDescriptor() {
return "@Flash/0x90000000/08*004Kg,01*032Kg,63*064Kg,64*064Kg";
}
}
}
}

View File

@@ -25,5 +25,6 @@ ion_device_src += $(addprefix ion/src/device/shared/drivers/, \
swd.cpp \
timing.cpp \
usb.cpp \
usb_desc.cpp \
wakeup.cpp \
)

View File

@@ -12,6 +12,7 @@ void initGPIO();
void shutdownGPIO();
void initOTG();
void shutdownOTG();
const char* stringDescriptor();
}
}

View File

@@ -0,0 +1,15 @@
#include "usb.h"
#include <ion/usb.h>
#include <drivers/config/usb.h>
namespace Ion {
namespace Device {
namespace USB {
const char* stringDescriptor() {
return Config::InterfaceStringDescriptor;
}
}
}
}

View File

@@ -66,6 +66,7 @@ ion_device_dfu_src += $(addprefix ion/src/device/shared/drivers/, \
swd.cpp \
timing.cpp \
usb.cpp \
usb_desc.cpp \
wakeup.cpp \
)

View File

@@ -3,6 +3,7 @@
#include <stddef.h>
#include <assert.h>
#include <drivers/usb.h>
#include <drivers/config/usb.h>
#include "dfu_interface.h"
#include "stack/device.h"
@@ -94,7 +95,7 @@ public:
m_manufacturerStringDescriptor("NumWorks"),
m_productStringDescriptor("NumWorks Calculator"),
m_serialNumberStringDescriptor(serialNumber),
m_interfaceStringDescriptor(Config::InterfaceStringDescriptor),
m_interfaceStringDescriptor(stringDescriptor()),
//m_interfaceStringDescriptor("@SRAM/0x20000000/01*256Ke"),
/* Switch to this descriptor to use dfu-util to write in the SRAM.
* FIXME Should be an alternate Interface. */