Skip to content

Commit aa8cd83

Browse files
committed
always use/define CFG_UF2_BOARD_APP_ID
1 parent dc90457 commit aa8cd83

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

src/usb/uf2/ghostfat.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -363,12 +363,7 @@ 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
368366
bl->familyID = CFG_UF2_BOARD_APP_ID;
369-
#else
370-
bl->familyID = CFG_UF2_FAMILY_APP_ID;
371-
#endif
372367
memcpy(bl->data, (void *)addr, bl->payloadSize);
373368
}
374369
}
@@ -395,12 +390,8 @@ int write_block (uint32_t block_no, uint8_t *data, WriteState *state)
395390

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

src/usb/uf2/uf2cfg.h

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

4-
// Legacy Family ID for updating Application
5-
#define CFG_UF2_FAMILY_APP_ID 0xADA52840
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)
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'"
106
#endif
117

128

9+
// Family ID for updating Application
10+
#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)
13+
14+
1315
// Family ID for updating Bootloader
1416
#define CFG_UF2_FAMILY_BOOT_ID 0xd663823c
1517

0 commit comments

Comments
 (0)