Skip to content

Commit dee8272

Browse files
committed
Minor header cleanups and ASM compatibility
1 parent 3708588 commit dee8272

File tree

4 files changed

+30
-24
lines changed

4 files changed

+30
-24
lines changed

src/common/boot_picoboot_headers/include/boot/picoboot_constants.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#define REBOOT2_TYPE_MASK 0x0f
1111

12-
// note these match REBOOT_TYPE in pico/bootrom_constants.h (also 0 is used for PC_SP for backwards compatibility with RP2040)
12+
// note these match REBOOT_TYPE in pico/bootrom_constants.h
1313
// values 0-7 are secure/non-secure
1414
#define REBOOT2_FLAG_REBOOT_TYPE_NORMAL 0x0 // param0 = diagnostic partition
1515
#define REBOOT2_FLAG_REBOOT_TYPE_BOOTSEL 0x2 // param0 = bootsel_flags, param1 = gpio_config

src/common/boot_uf2_headers/include/boot/uf2.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@
2020
#define UF2_MAGIC_START1 0x9E5D5157u
2121
#define UF2_MAGIC_END 0x0AB16F30u
2222

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
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
2728

2829
#define RP2040_FAMILY_ID 0xe48bff56u
2930
#define ABSOLUTE_FAMILY_ID 0xe48bff57u
@@ -33,6 +34,8 @@
3334
#define RP2350_ARM_NS_FAMILY_ID 0xe48bff5bu
3435
#define FAMILY_ID_MAX 0xe48bff5bu
3536

37+
// 04 e3 57 99
38+
#define UF2_EXTENSION_RP2_IGNORE_BLOCK 0x9957e304
3639

3740
struct uf2_block {
3841
// 32 byte header

src/rp2_common/boot_bootrom_headers/include/boot/bootrom_constants.h

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,12 @@ typedef int (*bootrom_api_callback_generic_t)(uint32_t r0, uint32_t r1, uint32_t
255255
#define BOOTROM_NS_API_get_b_partition 7
256256
#define BOOTROM_NS_API_COUNT 8
257257

258+
#define OTP_CMD_ROW_BITS 0x0000ffffu
259+
#define OTP_CMD_ROW_LSB _u(0)
260+
#define OTP_CMD_WRITE_BITS 0x00010000u
261+
#define OTP_CMD_WRITE_LSB _u(6)
262+
#define OTP_CMD_ECC_BITS 0x00020000u
263+
258264
#ifndef __ASSEMBLER__
259265

260266
typedef struct {
@@ -263,11 +269,6 @@ typedef struct {
263269
} resident_partition_t;
264270
static_assert(sizeof(resident_partition_t) == 8, "");
265271

266-
#define OTP_CMD_ROW_BITS 0x0000ffffu
267-
#define OTP_CMD_ROW_LSB 0u
268-
#define OTP_CMD_WRITE_BITS 0x00010000u
269-
#define OTP_CMD_ECC_BITS 0x00020000u
270-
271272
typedef struct otp_cmd {
272273
uint32_t flags;
273274
} otp_cmd_t;
@@ -304,37 +305,37 @@ typedef struct cflash_flags {
304305
uint32_t flags;
305306
} cflash_flags_t;
306307

308+
#endif
309+
307310
// Bits which are permitted to be set in a flags variable -- any other bits being set is an error
308311
#define CFLASH_FLAGS_BITS 0x00070301u
309312

310313
// Used to tell checked flash API which space a given address belongs to
311314
#define CFLASH_ASPACE_BITS 0x00000001u
312-
#define CFLASH_ASPACE_LSB 0u
313-
#define CFLASH_ASPACE_VALUE_STORAGE 0u
314-
#define CFLASH_ASPACE_VALUE_RUNTIME 1u
315+
#define CFLASH_ASPACE_LSB _u(0)
316+
#define CFLASH_ASPACE_VALUE_STORAGE _u(0)
317+
#define CFLASH_ASPACE_VALUE_RUNTIME _u(1)
315318

316319
// Used to tell checked flash APIs the effective security level of a flash access (may be forced to
317320
// one of these values for the NonSecure-exported version of this API)
318321
#define CFLASH_SECLEVEL_BITS 0x00000300u
319-
#define CFLASH_SECLEVEL_LSB 8u
322+
#define CFLASH_SECLEVEL_LSB _u(8)
320323
// Zero is not a valid security level:
321-
#define CFLASH_SECLEVEL_VALUE_SECURE 1u
322-
#define CFLASH_SECLEVEL_VALUE_NONSECURE 2u
323-
#define CFLASH_SECLEVEL_VALUE_BOOTLOADER 3u
324+
#define CFLASH_SECLEVEL_VALUE_SECURE _u(1)
325+
#define CFLASH_SECLEVEL_VALUE_NONSECURE _u(2)
326+
#define CFLASH_SECLEVEL_VALUE_BOOTLOADER _u(3)
324327

325328
#define CFLASH_OP_BITS 0x00070000u
326-
#define CFLASH_OP_LSB 16u
329+
#define CFLASH_OP_LSB _u(16)
327330
// Erase size_bytes bytes of flash, starting at address addr. Both addr and size_bytes must be a
328331
// multiple of 4096 bytes (one flash sector).
329-
#define CFLASH_OP_VALUE_ERASE 0u
332+
#define CFLASH_OP_VALUE_ERASE _u(0)
330333
// Program size_bytes bytes of flash, starting at address addr. Both addr and size_bytes must be a
331334
// multiple of 256 bytes (one flash page).
332-
#define CFLASH_OP_VALUE_PROGRAM 1u
335+
#define CFLASH_OP_VALUE_PROGRAM _u(1)
333336
// Read size_bytes bytes of flash, starting at address addr. There are no alignment restrictions on
334337
// addr or size_bytes.
335-
#define CFLASH_OP_VALUE_READ 2u
336-
#define CFLASH_OP_MAX 2u
337-
338-
#endif
338+
#define CFLASH_OP_VALUE_READ _u(2)
339+
#define CFLASH_OP_MAX _u(2)
339340

340341
#endif

src/rp2_common/pico_platform_compiler/include/pico/platform/compiler.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,12 @@ extern "C" {
150150
#define pico_default_asm(...) __asm (".syntax unified\n" __VA_ARGS__)
151151
#define pico_default_asm_volatile(...) __asm volatile (".syntax unified\n" __VA_ARGS__)
152152
#define pico_default_asm_goto(...) __asm goto (".syntax unified\n" __VA_ARGS__)
153+
#define pico_default_asm_volatile_goto(...) __asm volatile goto (".syntax unified\n" __VA_ARGS__)
153154
#else
154155
#define pico_default_asm(...) __asm (__VA_ARGS__)
155156
#define pico_default_asm_volatile(...) __asm volatile (__VA_ARGS__)
156157
#define pico_default_asm_goto(...) __asm goto (__VA_ARGS__)
158+
#define pico_default_asm_volatile_goto(...) __asm volatile goto (__VA_ARGS__)
157159
#endif
158160

159161
/*! \brief Ensure that the compiler does not move memory access across this method call

0 commit comments

Comments
 (0)