implemennt uf2 family option #10
This commit is contained in:
parent
31e5f77af8
commit
c176894075
@ -297,6 +297,11 @@ int write_block(uint32_t block_no, uint8_t *data, bool quiet/*, WriteState *stat
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// only accept block with same family id
|
||||||
|
if ( UF2_FAMILY_ID && !((bl->flags & UF2_FLAG_FAMILYID) && (bl->familyID == UF2_FAMILY_ID)) ) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if ((bl->flags & UF2_FLAG_NOFLASH) || bl->payloadSize > 256 || (bl->targetAddr & 0xff) ||
|
if ((bl->flags & UF2_FLAG_NOFLASH) || bl->payloadSize > 256 || (bl->targetAddr & 0xff) ||
|
||||||
bl->targetAddr < USER_FLASH_START || bl->targetAddr + bl->payloadSize > USER_FLASH_END) {
|
bl->targetAddr < USER_FLASH_START || bl->targetAddr + bl->payloadSize > USER_FLASH_END) {
|
||||||
#if USE_DBG_MSC
|
#if USE_DBG_MSC
|
||||||
|
@ -51,6 +51,7 @@ extern bool sdRunning;
|
|||||||
|
|
||||||
// If set, the block is "comment" and should not be flashed to the device
|
// If set, the block is "comment" and should not be flashed to the device
|
||||||
#define UF2_FLAG_NOFLASH 0x00000001
|
#define UF2_FLAG_NOFLASH 0x00000001
|
||||||
|
#define UF2_FLAG_FAMILYID 0x00002000
|
||||||
|
|
||||||
#define MAX_BLOCKS (FLASH_SIZE / 256 + 100)
|
#define MAX_BLOCKS (FLASH_SIZE / 256 + 100)
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -68,7 +69,7 @@ typedef struct {
|
|||||||
uint32_t payloadSize;
|
uint32_t payloadSize;
|
||||||
uint32_t blockNo;
|
uint32_t blockNo;
|
||||||
uint32_t numBlocks;
|
uint32_t numBlocks;
|
||||||
uint32_t reserved;
|
uint32_t familyID;
|
||||||
|
|
||||||
// raw data;
|
// raw data;
|
||||||
uint8_t data[476];
|
uint8_t data[476];
|
||||||
|
@ -13,3 +13,5 @@
|
|||||||
#define USER_FLASH_END 0xAD000 // Fat Fs start here
|
#define USER_FLASH_END 0xAD000 // Fat Fs start here
|
||||||
|
|
||||||
#define FLASH_PAGE_SIZE 4096
|
#define FLASH_PAGE_SIZE 4096
|
||||||
|
|
||||||
|
#define UF2_FAMILY_ID 0xADA52840
|
||||||
|
Loading…
Reference in New Issue
Block a user