Skip to content

Commit 3e367fe

Browse files
lurchkilograham
andauthored
Remove duplicated defines from bootrom.h (#2621)
* Remove duplicated defines from bootrom.h See #2619 for rationale * more rationalization of constant names * comment fix * Apply suggestions from code review Co-authored-by: Andrew Scheller <andrew.scheller@raspberrypi.com> --------- Co-authored-by: graham sanderson <graham.sanderson@raspberrypi.com>
1 parent eef0bc3 commit 3e367fe

3 files changed

Lines changed: 13 additions & 23 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@
99

1010
#define REBOOT2_TYPE_MASK 0x0f
1111

12-
// note these match REBOOT_TYPE in pico/bootrom_constants.h
12+
// --- note these match BOOT_TYPE_ constants 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 = gpio_pin_number, param1 = flags
1616
#define REBOOT2_FLAG_REBOOT_TYPE_RAM_IMAGE 0x3 // param0 = image_region_base, param1 = image_region_size
1717
#define REBOOT2_FLAG_REBOOT_TYPE_FLASH_UPDATE 0x4 // param0 = update_base
18-
1918
// values 8-15 are secure only
2019
#define REBOOT2_FLAG_REBOOT_TYPE_PC_SP 0xd
2120

2221
#define REBOOT2_FLAG_REBOOT_TO_ARM 0x10
2322
#define REBOOT2_FLAG_REBOOT_TO_RISCV 0x20
23+
// ---
2424

2525
#define REBOOT2_FLAG_NO_RETURN_ON_SUCCESS 0x100
2626

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,19 @@
7070
// note this is deliberately > MAX_PARTITIONs is likely to be, and also -1 as a signed byte
7171
#define PARTITION_TABLE_NO_PARTITION_INDEX 0xff
7272

73-
// todo these are duplicated in picoboot_constants.h
73+
// values returned from \ref rom_get_last_boot_type()
74+
// --- note these match the REBOOT2_FLAG_REBOOT_TYPE_ constants in pico/bootrom_constants.h
7475
// values 0-7 are secure/non-secure
7576
#define BOOT_TYPE_NORMAL 0
7677
#define BOOT_TYPE_BOOTSEL 2
7778
#define BOOT_TYPE_RAM_IMAGE 3
7879
#define BOOT_TYPE_FLASH_UPDATE 4
79-
8080
// values 8-15 are secure only
8181
#define BOOT_TYPE_PC_SP 0xd
8282

8383
// ORed in if a bootloader chained into the image
8484
#define BOOT_TYPE_CHAINED_FLAG 0x80
85+
// ---
8586

8687
// call from NS to S
8788
#ifndef __riscv

src/rp2_common/pico_bootrom/include/pico/bootrom.h

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -464,35 +464,35 @@ static inline int rom_set_bootrom_stack(bootrom_stack_t *stack) {
464464
*
465465
* The flags field contains one of the following values:
466466
*
467-
* REBOOT_TYPE_NORMAL - reboot into the normal boot path.
467+
* \ref REBOOT2_FLAG_REBOOT_TYPE_NORMAL - reboot into the normal boot path.
468468
*
469-
* REBOOT_TYPE_BOOTSEL - reboot into BOOTSEL mode.
469+
* \ref REBOOT2_FLAG_REBOOT_TYPE_BOOTSEL - reboot into BOOTSEL mode.
470470
* p0 - the GPIO number to use as an activity indicator (enabled by flag in p1).
471471
* p1 - a set of flags:
472472
* 0x01 : DISABLE_MSD_INTERFACE - Disable the BOOTSEL USB drive (see <<section_bootrom_mass_storage>>)
473473
* 0x02 : DISABLE_PICOBOOT_INTERFACE - Disable the {picoboot} interface (see <<section_bootrom_picoboot>>).
474474
* 0x10 : GPIO_PIN_ACTIVE_LOW - The GPIO in p0 is active low.
475475
* 0x20 : GPIO_PIN_ENABLED - Enable the activity indicator on the specified GPIO.
476476
*
477-
* REBOOT_TYPE_RAM_IMAGE - reboot into an image in RAM. The region of RAM or XIP RAM is searched for an image to run. This is the type
477+
* \ref REBOOT2_FLAG_REBOOT_TYPE_RAM_IMAGE - reboot into an image in RAM. The region of RAM or XIP RAM is searched for an image to run. This is the type
478478
* of reboot used when a RAM UF2 is dragged onto the BOOTSEL USB drive.
479479
* p0 - the region start address (word-aligned).
480480
* p1 - the region size (word-aligned).
481481
*
482-
* REBOOT_TYPE_FLASH_UPDATE - variant of REBOOT_TYPE_NORMAL to use when flash has been updated. This is the type
482+
* \ref REBOOT2_FLAG_REBOOT_TYPE_FLASH_UPDATE - variant of \ref REBOOT2_FLAG_REBOOT_TYPE_NORMAL to use when flash has been updated. This is the type
483483
* of reboot used after dragging a flash UF2 onto the BOOTSEL USB drive.
484484
* p0 - the address of the start of the region of flash that was updated. If this address matches the start address of a partition or slot, then that
485485
* partition or slot is treated preferentially during boot (when there is a choice). This type of boot facilitates TBYB and version downgrades.
486486
*
487-
* REBOOT_TYPE_PC_SP - reboot to a specific PC and SP. Note: this is not allowed in the ARM-NS variant.
487+
* \ref REBOOT2_FLAG_REBOOT_TYPE_PC_SP - reboot to a specific PC and SP. Note: this is not allowed in the ARM-NS variant.
488488
* p0 - the initial program counter (PC) to start executing at. This must have the lowest bit set for Arm and clear for RISC-V
489489
* p1 - the initial stack pointer (SP).
490490
*
491491
* All of the above, can have optional flags ORed in:
492492
*
493-
* REBOOT_TO_ARM - switch both cores to the Arm architecture (rather than leaving them as is). The call will fail with BOOTROM_ERROR_INVALID_STATE if the Arm architecture is not supported.
494-
* REBOOT_TO_RISCV - switch both cores to the RISC-V architecture (rather than leaving them as is). The call will fail with BOOTROM_ERROR_INVALID_STATE if the RISC-V architecture is not supported.
495-
* NO_RETURN_ON_SUCCESS - the watchdog h/w is asynchronous. Setting this bit forces this method not to return if the reboot is successfully initiated.
493+
* \ref REBOOT2_FLAG_REBOOT_TO_ARM - switch both cores to the Arm architecture (rather than leaving them as is). The call will fail with BOOTROM_ERROR_INVALID_STATE if the Arm architecture is not supported.
494+
* \ref REBOOT2_FLAG_REBOOT_TO_RISCV - switch both cores to the RISC-V architecture (rather than leaving them as is). The call will fail with BOOTROM_ERROR_INVALID_STATE if the RISC-V architecture is not supported.
495+
* \ref REBOOT2_FLAG_NO_RETURN_ON_SUCCESS - the watchdog h/w is asynchronous. Setting this bit forces this method not to return if the reboot is successfully initiated.
496496
*
497497
* \param flags the reboot flags, as detailed above
498498
* \param delay_ms millisecond delay before the reboot occurs
@@ -1010,17 +1010,6 @@ static inline intptr_t rom_set_rom_callback(uint callback_num, bootrom_api_callb
10101010
return func(callback_num, funcptr);
10111011
}
10121012

1013-
#define BOOT_TYPE_NORMAL 0
1014-
#define BOOT_TYPE_BOOTSEL 2
1015-
#define BOOT_TYPE_RAM_IMAGE 3
1016-
#define BOOT_TYPE_FLASH_UPDATE 4
1017-
1018-
// values 8-15 are secure only
1019-
#define BOOT_TYPE_PC_SP 0xd
1020-
1021-
// ORed in if a bootloader chained into the image
1022-
#define BOOT_TYPE_CHAINED_FLAG 0x80
1023-
10241013
/*!
10251014
* \brief Get system information
10261015
* \ingroup pico_bootrom

0 commit comments

Comments
 (0)