Skip to content

Commit

Permalink
Merge pull request #91 from mossmann/vidpid
Browse files Browse the repository at this point in the history
Use pid.codes test VID/PID for non-Cynthion boards
  • Loading branch information
mossmann authored Jul 4, 2024
2 parents b064724 + 10b2985 commit 0a6fe99
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 14 deletions.
10 changes: 7 additions & 3 deletions apollo_fpga/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,17 @@ class ApolloDebugger:
""" Class representing a link to an Apollo Debug Module. """

# VID/PID pairs for Apollo and gateware.
APOLLO_USB_IDS = [(0x1d50, 0x615c)]
APOLLO_USB_IDS = [(0x1d50, 0x615c), (0x1209, 0x0010)]
LUNA_USB_IDS = [(0x1d50, 0x615b)]

# Add pid.codes VID/PID pairs with PID from 0x0001 to 0x0010
for i in range(16):
# Add pid.codes test VID/PID pairs with PID from 0x0001 to 0x0005 used in
# LUNA example gateware.
for i in range(5):
LUNA_USB_IDS += [(0x1209, i+1)]

# Add pid.codes test VID/PID used by flash bridge.
LUNA_USB_IDS += [(0x1209, 0x000f)]

# If we have a LUNA_USB_IDS variable, we can use it to find the LUNA device.
if os.getenv("LUNA_USB_IDS"):
LUNA_USB_IDS += [tuple([int(x, 16) for x in os.getenv("LUNA_USB_IDS").split(":")])]
Expand Down
2 changes: 1 addition & 1 deletion firmware/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ BUILD := _build

# Flashing using Saturn-V.
dfu: _build/$(BOARD)/firmware.bin
dfu-util -a 0 -d 1d50:615c -D $< || dfu-util -a 0 -d 16d0:05a5 -D $<
dfu-util -a 0 -d 1d50:615c -D $< || dfu-util -a 0 -d 1209:0010 -D $<


# Flashing using the Black Magic Probe,
Expand Down
3 changes: 3 additions & 0 deletions firmware/src/boards/cynthion_d11/apollo_board.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
#include <hal/include/hal_gpio.h>
#include <stdbool.h>

#define USB_VID 0x1d50
#define USB_PID 0x615c

#define BOARD_HAS_PROGRAM_BUTTON
#define BOARD_HAS_SHARED_USB

Expand Down
3 changes: 3 additions & 0 deletions firmware/src/boards/cynthion_d21/apollo_board.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
#include <hal/include/hal_gpio.h>
#include <stdbool.h>

#define USB_VID 0x1d50
#define USB_PID 0x615c

//#define BOARD_HAS_SHARED_USB

// Indicate that this board features a configuration flash.
Expand Down
4 changes: 4 additions & 0 deletions firmware/src/boards/daisho/apollo_board.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
#ifndef __APOLLO_BOARD_H__
#define __APOLLO_BOARD_H__

/* pid.codes test VID/PID */
#define USB_VID 0x1209
#define USB_PID 0x0010

#define _BOARD_HAS_DEBUG_SPI

#include <chip.h>
Expand Down
7 changes: 3 additions & 4 deletions firmware/src/boards/daisho/usb_descriptors.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/

#include "tusb.h"
#include "apollo_board.h"

#define SERIAL_NUMBER_STRING_INDEX 3

Expand All @@ -44,10 +45,8 @@ tusb_desc_device_t const desc_device =

.bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,

// These are a unique VID/PID for Apollo on Daisho.
// TODO: should we replace these with an OpenMoko VID/PID pair, to match other GSG products?
.idVendor = 0x16d0,
.idProduct = 0x05a5,
.idVendor = USB_VID,
.idProduct = USB_PID,
.bcdDevice = (_BOARD_REVISION_MAJOR_ << 8) | _BOARD_REVISION_MINOR_,

.iManufacturer = 0x01,
Expand Down
4 changes: 4 additions & 0 deletions firmware/src/boards/qtpy/apollo_board.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
#include <hal/include/hal_gpio.h>
#include <stdbool.h>

/* pid.codes test VID/PID */
#define USB_VID 0x1209
#define USB_PID 0x0010

/**
* TODO: the qtpy board has a single RGB neopixel.
*/
Expand Down
4 changes: 4 additions & 0 deletions firmware/src/boards/raspberry_pi_pico/apollo_board.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
#include "hardware/sync.h"


/* pid.codes test VID/PID */
#define USB_VID 0x1209
#define USB_PID 0x0010

#define __NOP() {asm volatile("nop");}


Expand Down
3 changes: 3 additions & 0 deletions firmware/src/boards/samd11_xplained/apollo_board.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
#include <hal/include/hal_gpio.h>
#include <stdbool.h>

/* pid.codes test VID/PID */
#define USB_VID 0x1209
#define USB_PID 0x0010


/**
Expand Down
6 changes: 3 additions & 3 deletions firmware/src/mcu/rp2040/usb_descriptors.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
*/

#include "tusb.h"
#include "apollo_board.h"

#include "pico.h"
#include "pico/unique_id.h"
Expand Down Expand Up @@ -61,9 +62,8 @@ tusb_desc_device_t const desc_device =

.bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,

// These are a unique VID/PID for Apollo.
.idVendor = 0x1d50,
.idProduct = 0x615c,
.idVendor = USB_VID,
.idProduct = USB_PID,
.bcdDevice = (_BOARD_REVISION_MAJOR_ << 8) | _BOARD_REVISION_MINOR_,

.iManufacturer = 0x01,
Expand Down
6 changes: 3 additions & 3 deletions firmware/src/mcu/samd11/usb_descriptors.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "tusb.h"
#include "board_rev.h"
#include "usb/usb_protocol.h"
#include "apollo_board.h"

enum
{
Expand Down Expand Up @@ -56,9 +57,8 @@ tusb_desc_device_t desc_device =

.bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,

// These are a unique VID/PID for Apollo.
.idVendor = 0x1d50,
.idProduct = 0x615c,
.idVendor = USB_VID,
.idProduct = USB_PID,

.iManufacturer = STRING_INDEX_MANUFACTURER,
.iProduct = STRING_INDEX_PRODUCT,
Expand Down
2 changes: 2 additions & 0 deletions misc/54-apollo.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SUBSYSTEM=="usb", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="000f", SYMLINK+="flash-bridge-%k", TAG+="uaccess"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="0010", SYMLINK+="apollo-%k", TAG+="uaccess"

0 comments on commit 0a6fe99

Please sign in to comment.