Skip to content

Commit e843045

Browse files
committed
Revert "always use/define CFG_UF2_BOARD_APP_ID"
This reverts commit aa8cd83, because the feather_nrf52832 does not define its own USB VID/PID.
1 parent aa8cd83 commit e843045

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

src/usb/uf2/ghostfat.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,12 @@ void read_block(uint32_t block_no, uint8_t *data) {
363363
bl->targetAddr = addr;
364364
bl->payloadSize = UF2_FIRMWARE_BYTES_PER_SECTOR;
365365
bl->flags = UF2_FLAG_FAMILYID;
366+
367+
#if defined(CFG_UF2_BOARD_APP_ID) && CFG_UF2_BOARD_APP_ID
366368
bl->familyID = CFG_UF2_BOARD_APP_ID;
369+
#else
370+
bl->familyID = CFG_UF2_FAMILY_APP_ID;
371+
#endif
367372
memcpy(bl->data, (void *)addr, bl->payloadSize);
368373
}
369374
}
@@ -390,8 +395,12 @@ int write_block (uint32_t block_no, uint8_t *data, WriteState *state)
390395

391396
switch ( bl->familyID )
392397
{
398+
399+
#if defined(CFG_UF2_BOARD_APP_ID) && CFG_UF2_BOARD_APP_ID
393400
case CFG_UF2_BOARD_APP_ID: // board-specific app ... may not be usable on other nrf52 boards
394-
case CFG_UF2_FAMILY_APP_ID: // family-specific app ... Legacy apps, or where the app uses bootloader configuration to discover pins
401+
#endif
402+
403+
case CFG_UF2_FAMILY_APP_ID: // legacy, or where app uses bootloader configuration to discover pins
395404
/* Upgrading Application
396405
*
397406
* SoftDevice is considered as part of application and can be (or not) included in uf2.

src/usb/uf2/uf2cfg.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
#include "boards.h"
22
#include "dfu_types.h"
33

4-
#if !defined(USB_DESC_VID) || !defined(USB_DESC_UF2_PID) || !USB_DESC_VID || !USB_DESC_UF2_PID
5-
#error "Per @hathach, 'This repo doesn't accept nrf52840/833 that doesn't have VID/PID'"
6-
#endif
7-
8-
9-
// Family ID for updating Application
4+
// Legacy Family ID for updating Application
105
#define CFG_UF2_FAMILY_APP_ID 0xADA52840
11-
// Board ID for board-specific Application
12-
#define CFG_UF2_BOARD_APP_ID ((USB_DESC_VID << 16) | USB_DESC_UF2_PID)
6+
7+
// Family ID for board-specific Application
8+
#if defined(USB_DESC_VID) && defined(USB_DESC_UF2_PID) && USB_DESC_VID && USB_DESC_UF2_PID
9+
#define CFG_UF2_BOARD_APP_ID ((USB_DESC_VID << 16) | USB_DESC_UF2_PID)
10+
#endif
1311

1412

1513
// Family ID for updating Bootloader

0 commit comments

Comments
 (0)