Menu Toggle
v2.3.1 (RP2350)
Toggle main menu visibility
Loading...
Searching...
No Matches
uf2.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
3
*
4
* SPDX-License-Identifier: BSD-3-Clause
5
*/
6
7
#ifndef _BOOT_UF2_H
8
#define _BOOT_UF2_H
9
10
#include <stdint.h>
11
#include <assert.h>
12
18
19
#define UF2_MAGIC_START0 0x0A324655u
20
#define UF2_MAGIC_START1 0x9E5D5157u
21
#define UF2_MAGIC_END 0x0AB16F30u
22
23
#define UF2_FLAG_NOT_MAIN_FLASH 0x00000001u
24
#define UF2_FLAG_FILE_CONTAINER 0x00001000u
25
#define UF2_FLAG_FAMILY_ID_PRESENT 0x00002000u
26
#define UF2_FLAG_MD5_PRESENT 0x00004000u
27
#define UF2_FLAG_EXTENSION_FLAGS_PRESENT 0x00008000u
28
29
// Extra family IDs
30
#define CYW43_FIRMWARE_FAMILY_ID 0xe48bff55u
31
32
// Bootrom supported family IDs
33
#define RP2040_FAMILY_ID 0xe48bff56u
34
#define ABSOLUTE_FAMILY_ID 0xe48bff57u
35
#define DATA_FAMILY_ID 0xe48bff58u
36
#define RP2350_ARM_S_FAMILY_ID 0xe48bff59u
37
#define RP2350_RISCV_FAMILY_ID 0xe48bff5au
38
#define RP2350_ARM_NS_FAMILY_ID 0xe48bff5bu
39
#define BOOTROM_FAMILY_ID_MIN RP2040_FAMILY_ID
40
#define BOOTROM_FAMILY_ID_MAX RP2350_ARM_NS_FAMILY_ID
41
42
// Defined for backwards compatibility
43
#define FAMILY_ID_MAX BOOTROM_FAMILY_ID_MAX
44
45
// 04 e3 57 99
46
#define UF2_EXTENSION_RP2_IGNORE_BLOCK 0x9957e304
47
54
struct
uf2_block
{
55
// 32 byte header
56
uint32_t
magic_start0
;
57
uint32_t
magic_start1
;
58
uint32_t
flags
;
59
uint32_t
target_addr
;
60
uint32_t
payload_size
;
61
uint32_t
block_no
;
62
uint32_t
num_blocks
;
63
uint32_t
file_size
;
64
uint8_t
data
[476];
65
uint32_t
magic_end
;
66
};
67
68
static_assert
(
sizeof
(
struct
uf2_block
) == 512,
"uf2_block not sector sized"
);
69
70
#endif
uf2_block
A single 512-byte UF2 block as written to a RP2xxx device in BOOTSEL mode.
Definition
uf2.h:54
uf2_block::file_size
uint32_t file_size
When UF2_FLAG_FAMILY_ID_PRESENT is set in flags, this contains the UF2 family ID.
Definition
uf2.h:63
uf2_block::block_no
uint32_t block_no
Zero-based index of this block within the UF2 file.
Definition
uf2.h:61
uf2_block::magic_end
uint32_t magic_end
Magic number marking the end of the block (UF2_MAGIC_END).
Definition
uf2.h:65
uf2_block::target_addr
uint32_t target_addr
Address in flash or memory at which to write this block's payload.
Definition
uf2.h:59
uf2_block::flags
uint32_t flags
Block flags (e.g. UF2_FLAG_FAMILY_ID_PRESENT).
Definition
uf2.h:58
uf2_block::magic_start0
uint32_t magic_start0
First magic number identifying a UF2 block (UF2_MAGIC_START0).
Definition
uf2.h:56
uf2_block::magic_start1
uint32_t magic_start1
Second magic number identifying a UF2 block (UF2_MAGIC_START1).
Definition
uf2.h:57
uf2_block::payload_size
uint32_t payload_size
Number of valid data bytes in the payload field.
Definition
uf2.h:60
uf2_block::data
uint8_t data[476]
Raw payload data written to target_addr.
Definition
uf2.h:64
uf2_block::num_blocks
uint32_t num_blocks
Total number of blocks in the UF2 file.
Definition
uf2.h:62