diff --git a/src/usb/uf2/ghostfat.c b/src/usb/uf2/ghostfat.c index 5c7b6c9..9c63ddf 100644 --- a/src/usb/uf2/ghostfat.c +++ b/src/usb/uf2/ghostfat.c @@ -363,12 +363,7 @@ void read_block(uint32_t block_no, uint8_t *data) { bl->targetAddr = addr; bl->payloadSize = UF2_FIRMWARE_BYTES_PER_SECTOR; bl->flags = UF2_FLAG_FAMILYID; - -#if defined(CFG_UF2_BOARD_APP_ID) && CFG_UF2_BOARD_APP_ID bl->familyID = CFG_UF2_BOARD_APP_ID; -#else - bl->familyID = CFG_UF2_FAMILY_APP_ID; -#endif memcpy(bl->data, (void *)addr, bl->payloadSize); } } @@ -395,12 +390,8 @@ int write_block (uint32_t block_no, uint8_t *data, WriteState *state) switch ( bl->familyID ) { - -#if defined(CFG_UF2_BOARD_APP_ID) && CFG_UF2_BOARD_APP_ID case CFG_UF2_BOARD_APP_ID: // board-specific app ... may not be usable on other nrf52 boards -#endif - - case CFG_UF2_FAMILY_APP_ID: // legacy, or where app uses bootloader configuration to discover pins + case CFG_UF2_FAMILY_APP_ID: // family-specific app ... Legacy apps, or where the app uses bootloader configuration to discover pins /* Upgrading Application * * SoftDevice is considered as part of application and can be (or not) included in uf2. diff --git a/src/usb/uf2/uf2cfg.h b/src/usb/uf2/uf2cfg.h index 3d1bffa..8faab22 100644 --- a/src/usb/uf2/uf2cfg.h +++ b/src/usb/uf2/uf2cfg.h @@ -1,15 +1,17 @@ #include "boards.h" #include "dfu_types.h" -// Legacy Family ID for updating Application -#define CFG_UF2_FAMILY_APP_ID 0xADA52840 - -// Family ID for board-specific Application -#if defined(USB_DESC_VID) && defined(USB_DESC_UF2_PID) && USB_DESC_VID && USB_DESC_UF2_PID - #define CFG_UF2_BOARD_APP_ID ((USB_DESC_VID << 16) | USB_DESC_UF2_PID) +#if !defined(USB_DESC_VID) || !defined(USB_DESC_UF2_PID) || !USB_DESC_VID || !USB_DESC_UF2_PID + #error "Per @hathach, 'This repo doesn't accept nrf52840/833 that doesn't have VID/PID'" #endif +// Family ID for updating Application +#define CFG_UF2_FAMILY_APP_ID 0xADA52840 +// Board ID for board-specific Application +#define CFG_UF2_BOARD_APP_ID ((USB_DESC_VID << 16) | USB_DESC_UF2_PID) + + // Family ID for updating Bootloader #define CFG_UF2_FAMILY_BOOT_ID 0xd663823c