Manual DFU related updates from sc_usb_audio

This commit is contained in:
xross
2017-11-01 11:01:12 +00:00
parent d14275e9e4
commit c9d6ca1f9d
10 changed files with 2030 additions and 15 deletions

View File

@@ -9,16 +9,19 @@ Set up the image loader
#. Open a terminal
#. Change directory to where the loader has been built
#. Run the command:
#. Point DYLD_LIBRARY_PATH to libusb/OSX64:
``source setup.sh``
``export DYLD_LIBRARY_PATH=$PWD/libusb/OSX64:$DYLD_LIBRARY_PATH``
Download new firmware
---------------------
To program the new firmware run the command:
``./xmosdfu --download new_firmware.bin``
``./xmosdfu XMOS_L2_AUDIO2_PID --download new_firmware.bin``
Replace ``XMOS_L2_AUDIO2_PID`` with product ID of your target device. Invoke
``xmosdfu`` with no arguments to get a list of all supported product IDs.
Note that once this is done the device restarts. The original factory default
application is still present but the device is now running the upgraded
@@ -32,7 +35,7 @@ present.
Run the command:
``./xmosdfu --upload currentfirmware.bin``
``./xmosdfu XMOS_L2_AUDIO2_PID --upload currentfirmware.bin``
The file ``currentfirmware.bin`` contains the latest upgrade image. This file is
an exact copy of the data from the flash and can be downloaded to the device
@@ -44,6 +47,6 @@ Reverting firmware to factory image
To revert the device back to its factory (i.e XFLASH) installed state from the
new firmware, run the command:
``./xmosdfu --revertfactory``
``./xmosdfu XMOS_L2_AUDIO2_PID --revertfactory``
The device will now be running, and only contain the factory firmware.

View File

@@ -1,2 +0,0 @@
all:
g++ -g -o xmosdfu xmosdfu.cpp -Ilibusb/OSX libusb/OSX/libusb-1.0.0.dylib -m32 -Wall

View File

@@ -0,0 +1,2 @@
all:
g++ -g -o xmosdfu xmosdfu.cpp -Ilibusb/OSX32 libusb/OSX32/libusb-1.0.0.dylib -m32 -Wall

View File

@@ -0,0 +1,2 @@
all:
g++ -g -o xmosdfu xmosdfu.cpp -Ilibusb/OSX64 libusb/OSX64/libusb-1.0.0.dylib -Wall

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -12,8 +12,21 @@ function usage {
#find out were we are running from so we only exec this programs
PROGDIR=`dirname $0`
if echo $OSTYPE | grep -q darwin ; then
platform=OSX64
elif echo $OSTYPE | grep -q abihf ; then
platform=Rasp
elif arch | grep -q x86_64 ; then
platform=Linux64
elif echo $OSTYPE | grep -q linux ; then
platform=Linux32
else
echo "Unknown OS $OSTYPE"
exit 1
fi
#setup environment
export DYLD_LIBRARY_PATH=$PROGDIR:$DYLD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=$PROGDIR/libusb/$platform:$DYLD_LIBRARY_PATH
if [ "$1" != "" ]; then
device_pid=$1

View File

@@ -87,7 +87,10 @@ static int find_xmos_device(unsigned int id, unsigned int pid, unsigned int list
else
{
struct libusb_config_descriptor *config_desc = NULL;
libusb_get_active_config_descriptor(dev, &config_desc);
int ret = libusb_get_active_config_descriptor(dev, &config_desc);
if (ret != 0) {
return -1;
}
if (config_desc != NULL)
{
//printf("bNumInterfaces: %d\n", config_desc->bNumInterfaces);
@@ -97,7 +100,7 @@ static int find_xmos_device(unsigned int id, unsigned int pid, unsigned int list
const struct libusb_interface_descriptor *inter_desc = ((struct libusb_interface *)&config_desc->interface[j])->altsetting;
if (inter_desc->bInterfaceClass == 0xFE && inter_desc->bInterfaceSubClass == 0x1)
{
XMOS_DFU_IF = j;
XMOS_DFU_IF = inter_desc->bInterfaceNumber;
}
}
}
@@ -372,11 +375,6 @@ static unsigned int select_pid(char *device_pid)
int main(int argc, char **argv)
{
unsigned char dfuState = 0;
unsigned char nextDfuState = 0;
unsigned int timeout = 0;
unsigned char strIndex = 0;
unsigned int download = 0;
unsigned int upload = 0;
unsigned int revert = 0;