lib: Update pico-sdk to v2.2.0

The new rp2350 chips with A4 stepping require pico-sdk v2.2.0 .

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor committed 2025-12-17 10:12:52 -05:00
1 parent 867d73f0b8
commit d92dda439e
34 files changed
+662 -499

No files matched your search

+1 -1
View File
@@ -107,7 +107,7 @@ taken from the Drivers/CMSIS/Device/ST/STM32H7xx/ directory.
The pico-sdk directory contains code from the pico sdk:
https://github.com/raspberrypi/pico-sdk.git
version 2.0.0 (efe2103f9b28458a1615ff096054479743ade236). It has been
version 2.2.0 (a1438dff1d38bd9c65dbd693f0e5db4b9ae91779). It has been
modified so that it can build outside of the pico sdk. See
pico-sdk.patch for the modifications.
+344
View File
@@ -0,0 +1,344 @@
/*
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef _BOOT_BOOTROM_CONSTANTS_H
#define _BOOT_BOOTROM_CONSTANTS_H
#ifndef NO_PICO_PLATFORM
#include "pico/platform.h"
#endif
// ROOT ADDRESSES
#define BOOTROM_MAGIC_OFFSET 0x10
#define BOOTROM_FUNC_TABLE_OFFSET 0x14
#if PICO_RP2040
#define BOOTROM_DATA_TABLE_OFFSET 0x16
#endif
#if PICO_RP2040
#define BOOTROM_VTABLE_OFFSET 0x00
#define BOOTROM_TABLE_LOOKUP_OFFSET 0x18
#else
#define BOOTROM_WELL_KNOWN_PTR_SIZE 2
#if defined(__riscv)
#define BOOTROM_ENTRY_OFFSET 0x7dfc
#define BOOTROM_TABLE_LOOKUP_ENTRY_OFFSET (BOOTROM_ENTRY_OFFSET - BOOTROM_WELL_KNOWN_PTR_SIZE)
#define BOOTROM_TABLE_LOOKUP_OFFSET (BOOTROM_ENTRY_OFFSET - BOOTROM_WELL_KNOWN_PTR_SIZE*2)
#else
#define BOOTROM_VTABLE_OFFSET 0x00
#define BOOTROM_TABLE_LOOKUP_OFFSET (BOOTROM_FUNC_TABLE_OFFSET + BOOTROM_WELL_KNOWN_PTR_SIZE)
#endif
#endif
#if !PICO_RP2040 || PICO_COMBINED_DOCS
#define BOOTROM_OK 0
//#define BOOTROM_ERROR_TIMEOUT (-1)
//#define BOOTROM_ERROR_GENERIC (-2)
//#define BOOTROM_ERROR_NO_DATA (-3) // E.g. read from an empty buffer/FIFO
#define BOOTROM_ERROR_NOT_PERMITTED (-4) // Permission violation e.g. write to read-only flash partition
#define BOOTROM_ERROR_INVALID_ARG (-5) // Argument is outside of range of supported values`
//#define BOOTROM_ERROR_IO (-6)
//#define BOOTROM_ERROR_BADAUTH (-7)
//#define BOOTROM_ERROR_CONNECT_FAILED (-8)
//#define BOOTROM_ERROR_INSUFFICIENT_RESOURCES (-9) // Dynamic allocation of resources failed
#define BOOTROM_ERROR_INVALID_ADDRESS (-10) // Address argument was out-of-bounds or was determined to be an address that the caller may not access
#define BOOTROM_ERROR_BAD_ALIGNMENT (-11) // Address modulo transfer chunk size was nonzero (e.g. word-aligned transfer with address % 4 != 0)
#define BOOTROM_ERROR_INVALID_STATE (-12) // Something happened or failed to happen in the past, and consequently we (currently) can't service the request
#define BOOTROM_ERROR_BUFFER_TOO_SMALL (-13) // A user-allocated buffer was too small to hold the result or working state of this function
#define BOOTROM_ERROR_PRECONDITION_NOT_MET (-14) // This call failed because another ROM function must be called first
#define BOOTROM_ERROR_MODIFIED_DATA (-15) // Cached data was determined to be inconsistent with the full version of the data it was calculated from
#define BOOTROM_ERROR_INVALID_DATA (-16) // A data structure failed to validate
#define BOOTROM_ERROR_NOT_FOUND (-17) // Attempted to access something that does not exist; or, a search failed
#define BOOTROM_ERROR_UNSUPPORTED_MODIFICATION (-18) // Write is impossible based on previous writes; e.g. attempted to clear an OTP bit
#define BOOTROM_ERROR_LOCK_REQUIRED (-19) // A required lock is not owned
#define BOOTROM_ERROR_LAST (-19)
#define RT_FLAG_FUNC_RISCV 0x0001
#define RT_FLAG_FUNC_RISCV_FAR 0x0003
#define RT_FLAG_FUNC_ARM_SEC 0x0004
// reserved for 32-bit pointer: 0x0008
#define RT_FLAG_FUNC_ARM_NONSEC 0x0010
// reserved for 32-bit pointer: 0x0020
#define RT_FLAG_DATA 0x0040
// reserved for 32-bit pointer: 0x0080
#define PARTITION_TABLE_MAX_PARTITIONS 16
// note this is deliberately > MAX_PARTITIONs is likely to be, and also -1 as a signed byte
#define PARTITION_TABLE_NO_PARTITION_INDEX 0xff
// todo these are duplicated in picoboot_constants.h
// values 0-7 are secure/non-secure
#define BOOT_TYPE_NORMAL 0
#define BOOT_TYPE_BOOTSEL 2
#define BOOT_TYPE_RAM_IMAGE 3
#define BOOT_TYPE_FLASH_UPDATE 4
// values 8-15 are secure only
#define BOOT_TYPE_PC_SP 0xd
// ORed in if a bootloader chained into the image
#define BOOT_TYPE_CHAINED_FLAG 0x80
// call from NS to S
#ifndef __riscv
#define BOOTROM_API_CALLBACK_secure_call 0
#endif
#define BOOTROM_API_CALLBACK_COUNT 1
#define BOOTROM_LOCK_SHA_256 0
#define BOOTROM_LOCK_FLASH_OP 1
#define BOOTROM_LOCK_OTP 2
#define BOOTROM_LOCK_MAX 2
#define BOOTROM_LOCK_ENABLE 7
#define BOOT_PARTITION_NONE (-1)
#define BOOT_PARTITION_SLOT0 (-2)
#define BOOT_PARTITION_SLOT1 (-3)
#define BOOT_PARTITION_WINDOW (-4)
#define BOOT_DIAGNOSTIC_WINDOW_SEARCHED 0x01
// note if both BOOT_DIAGNOSTIC_INVALID_BLOCK_LOOP and BOOT_DIAGNOSTIC_VALID_BLOCK_LOOP then the block loop was valid
// but it has a PARTITION_TABLE which while it passed the initial verification (and hash/sig) had invalid contents
// (discovered when it was later loaded)
#define BOOT_DIAGNOSTIC_INVALID_BLOCK_LOOP 0x02
#define BOOT_DIAGNOSTIC_VALID_BLOCK_LOOP 0x04
#define BOOT_DIAGNOSTIC_VALID_IMAGE_DEF 0x08
#define BOOT_DIAGNOSTIC_HAS_PARTITION_TABLE 0x10
#define BOOT_DIAGNOSTIC_CONSIDERED 0x20
#define BOOT_DIAGNOSTIC_CHOSEN 0x40
#define BOOT_DIAGNOSTIC_PARTITION_TABLE_LSB 7
#define BOOT_DIAGNOSTIC_PARTITION_TABLE_MATCHING_KEY_FOR_VERIFY 0x80
#define BOOT_DIAGNOSTIC_PARTITION_TABLE_HASH_FOR_VERIFY 0x100
#define BOOT_DIAGNOSTIC_PARTITION_TABLE_VERIFIED_OK 0x200
#define BOOT_DIAGNOSTIC_IMAGE_DEF_LSB 10
#define BOOT_DIAGNOSTIC_IMAGE_DEF_MATCHING_KEY_FOR_VERIFY 0x400
#define BOOT_DIAGNOSTIC_IMAGE_DEF_HASH_FOR_VERIFY 0x800
#define BOOT_DIAGNOSTIC_IMAGE_DEF_VERIFIED_OK 0x1000
#define BOOT_DIAGNOSTIC_LOAD_MAP_ENTRIES_LOADED 0x2000
#define BOOT_DIAGNOSTIC_IMAGE_LAUNCHED 0x4000
#define BOOT_DIAGNOSTIC_IMAGE_CONDITION_FAILURE 0x8000
#define BOOT_PARSED_BLOCK_DIAGNOSTIC_MATCHING_KEY_FOR_VERIFY 0x1 // if this is present and VERIFIED_OK isn't the sig check failed
#define BOOT_PARSED_BLOCK_DIAGNOSTIC_HASH_FOR_VERIFY 0x2 // if this is present and VERIFIED_OL isn't then hash check failed
#define BOOT_PARSED_BLOCK_DIAGNOSTIC_VERIFIED_OK 0x4
#define BOOT_TBYB_AND_UPDATE_FLAG_BUY_PENDING 0x1
#define BOOT_TBYB_AND_UPDATE_FLAG_OTP_VERSION_APPLIED 0x2
#define BOOT_TBYB_AND_UPDATE_FLAG_OTHER_ERASED 0x4
#ifndef __ASSEMBLER__
// Limited to 3 arguments in case of varm multiplex hint (trashes Arm r3)
typedef int (*bootrom_api_callback_generic_t)(uint32_t r0, uint32_t r1, uint32_t r2);
// Return negative for error, else number of bytes transferred:
//typedef int (*bootrom_api_callback_stdout_put_blocking_t)(const uint8_t *buffer, uint32_t size);
//typedef int (*bootrom_api_callback_stdin_get_t)(uint8_t *buffer, uint32_t size);
//typedef void (*bootrom_api_callback_core1_security_setup_t)(void);
#endif
#endif
/*! \brief Return a bootrom lookup code based on two ASCII characters
* \ingroup pico_bootrom
*
* These codes are uses to lookup data or function addresses in the bootrom
*
* \param c1 the first character
* \param c2 the second character
* \return the 'code' to use in rom_func_lookup() or rom_data_lookup()
*/
#define ROM_TABLE_CODE(c1, c2) ((c1) | ((c2) << 8))
// ROM FUNCTIONS
// RP2040 & RP2350
#define ROM_DATA_SOFTWARE_GIT_REVISION ROM_TABLE_CODE('G', 'R')
#define ROM_FUNC_FLASH_ENTER_CMD_XIP ROM_TABLE_CODE('C', 'X')
#define ROM_FUNC_FLASH_EXIT_XIP ROM_TABLE_CODE('E', 'X')
#define ROM_FUNC_FLASH_FLUSH_CACHE ROM_TABLE_CODE('F', 'C')
#define ROM_FUNC_CONNECT_INTERNAL_FLASH ROM_TABLE_CODE('I', 'F')
#define ROM_FUNC_FLASH_RANGE_ERASE ROM_TABLE_CODE('R', 'E')
#define ROM_FUNC_FLASH_RANGE_PROGRAM ROM_TABLE_CODE('R', 'P')
#if PICO_RP2040
// RP2040 only
#define ROM_FUNC_MEMCPY44 ROM_TABLE_CODE('C', '4')
#define ROM_DATA_COPYRIGHT ROM_TABLE_CODE('C', 'R')
#define ROM_FUNC_CLZ32 ROM_TABLE_CODE('L', '3')
#define ROM_FUNC_MEMCPY ROM_TABLE_CODE('M', 'C')
#define ROM_FUNC_MEMSET ROM_TABLE_CODE('M', 'S')
#define ROM_FUNC_POPCOUNT32 ROM_TABLE_CODE('P', '3')
#define ROM_FUNC_REVERSE32 ROM_TABLE_CODE('R', '3')
#define ROM_FUNC_MEMSET4 ROM_TABLE_CODE('S', '4')
#define ROM_FUNC_CTZ32 ROM_TABLE_CODE('T', '3')
#define ROM_FUNC_RESET_USB_BOOT ROM_TABLE_CODE('U', 'B')
#endif
#if !PICO_RP2040 || PICO_COMBINED_DOCS
// RP2350 only
#define ROM_FUNC_PICK_AB_PARTITION ROM_TABLE_CODE('A', 'B')
#define ROM_FUNC_CHAIN_IMAGE ROM_TABLE_CODE('C', 'I')
#define ROM_FUNC_EXPLICIT_BUY ROM_TABLE_CODE('E', 'B')
#define ROM_FUNC_FLASH_RUNTIME_TO_STORAGE_ADDR ROM_TABLE_CODE('F', 'A')
#define ROM_DATA_FLASH_DEVINFO16_PTR ROM_TABLE_CODE('F', 'D')
#define ROM_FUNC_FLASH_OP ROM_TABLE_CODE('F', 'O')
#define ROM_FUNC_GET_B_PARTITION ROM_TABLE_CODE('G', 'B')
#define ROM_FUNC_GET_PARTITION_TABLE_INFO ROM_TABLE_CODE('G', 'P')
#define ROM_FUNC_GET_SYS_INFO ROM_TABLE_CODE('G', 'S')
#define ROM_FUNC_GET_UF2_TARGET_PARTITION ROM_TABLE_CODE('G', 'U')
#define ROM_FUNC_LOAD_PARTITION_TABLE ROM_TABLE_CODE('L', 'P')
#define ROM_FUNC_OTP_ACCESS ROM_TABLE_CODE('O', 'A')
#define ROM_DATA_PARTITION_TABLE_PTR ROM_TABLE_CODE('P', 'T')
#define ROM_FUNC_FLASH_RESET_ADDRESS_TRANS ROM_TABLE_CODE('R', 'A')
#define ROM_FUNC_REBOOT ROM_TABLE_CODE('R', 'B')
#define ROM_FUNC_SET_ROM_CALLBACK ROM_TABLE_CODE('R', 'C')
#define ROM_FUNC_SECURE_CALL ROM_TABLE_CODE('S', 'C')
#define ROM_FUNC_SET_NS_API_PERMISSION ROM_TABLE_CODE('S', 'P')
#define ROM_FUNC_BOOTROM_STATE_RESET ROM_TABLE_CODE('S', 'R')
#define ROM_FUNC_SET_BOOTROM_STACK ROM_TABLE_CODE('S', 'S')
#define ROM_DATA_SAVED_XIP_SETUP_FUNC_PTR ROM_TABLE_CODE('X', 'F')
#define ROM_FUNC_FLASH_SELECT_XIP_READ_MODE ROM_TABLE_CODE('X', 'M')
#define ROM_FUNC_VALIDATE_NS_BUFFER ROM_TABLE_CODE('V', 'B')
#endif
// these form a bit set
#define BOOTROM_STATE_RESET_CURRENT_CORE 0x01
#define BOOTROM_STATE_RESET_OTHER_CORE 0x02
#define BOOTROM_STATE_RESET_GLOBAL_STATE 0x04 // reset any global state (e.g. permissions)
// partition level stuff is returned first (note PT_INFO flags is only 16 bits)
// 3 words: pt_count, unpartitioned_perm_loc, unpartioned_perm_flags
#define PT_INFO_PT_INFO 0x0001
#define PT_INFO_SINGLE_PARTITION 0x8000 // marker to just include a single partition in the results)
// then in order per partition selected
// 2 words: unpartitioned_perm_loc, unpartioned_perm_flags
#define PT_INFO_PARTITION_LOCATION_AND_FLAGS 0x0010
// 2 words: id lsb first
#define PT_INFO_PARTITION_ID 0x0020
// n+1 words: n, family_id...
#define PT_INFO_PARTITION_FAMILY_IDS 0x0040
// (n+3)/4 words... bytes are: n (len), c0, c1, ... cn-1 padded to word boundary with zeroes
#define PT_INFO_PARTITION_NAME 0x0080
// items are returned in order
// 3 words package_id, device_id_lo, device_id_hi
#define SYS_INFO_CHIP_INFO 0x0001
// 1 word: chip specific critical bits
#define SYS_INFO_CRITICAL 0x0002
// 1 word: bytes: cpu_type, supported_cpu_type_bitfield
#define SYS_INFO_CPU_INFO 0x0004
// 1 word: same as FLASH_DEVINFO row in OTP
#define SYS_INFO_FLASH_DEV_INFO 0x0008
// 4 words
#define SYS_INFO_BOOT_RANDOM 0x0010
// 2 words lsb first
#define SYS_INFO_NONCE 0x0020
// 4 words boot_info, boot_diagnostic, boot_param0, boot_param1
#define SYS_INFO_BOOT_INFO 0x0040
#define BOOTROM_NS_API_get_sys_info 0
#define BOOTROM_NS_API_checked_flash_op 1
#define BOOTROM_NS_API_flash_runtime_to_storage_addr 2
#define BOOTROM_NS_API_get_partition_table_info 3
#define BOOTROM_NS_API_secure_call 4
#define BOOTROM_NS_API_otp_access 5
#define BOOTROM_NS_API_reboot 6
#define BOOTROM_NS_API_get_b_partition 7
#define BOOTROM_NS_API_COUNT 8
#define OTP_CMD_ROW_BITS _u(0x0000ffff)
#define OTP_CMD_ROW_LSB _u(0)
#define OTP_CMD_WRITE_BITS _u(0x00010000)
#define OTP_CMD_WRITE_LSB _u(16)
#define OTP_CMD_ECC_BITS _u(0x00020000)
#define OTP_CMD_ECC_LSB _u(17)
#ifndef __ASSEMBLER__
static_assert(OTP_CMD_WRITE_BITS == (1 << OTP_CMD_WRITE_LSB), "");
static_assert(OTP_CMD_ECC_BITS == (1 << OTP_CMD_ECC_LSB), "");
typedef struct {
uint32_t permissions_and_location;
uint32_t permissions_and_flags;
} resident_partition_t;
static_assert(sizeof(resident_partition_t) == 8, "");
typedef struct otp_cmd {
uint32_t flags;
} otp_cmd_t;
typedef enum {
BOOTROM_XIP_MODE_03H_SERIAL = 0,
BOOTROM_XIP_MODE_0BH_SERIAL,
BOOTROM_XIP_MODE_BBH_DUAL,
BOOTROM_XIP_MODE_EBH_QUAD,
BOOTROM_XIP_MODE_N_MODES
} bootrom_xip_mode_t;
// The checked flash API wraps the low-level flash routines from generic_flash, adding bounds
// checking, permission checking against the resident partition table, and simple address
// translation. The low-level API deals with flash offsets (i.e. distance from the start of the
// first flash device, measured in bytes) but the checked flash API accepts one of two types of
// address:
//
// - Flash runtime addresses: the address of some flash-resident data or code in the currently
// running image. The flash addresses your binary is "linked at" by the linker.
// - Flash storage addresses: a flash offset, plus the address base where QSPI hardware is first
// mapped on the system bus (XIP_BASE constant from addressmap.h)
//
// These addresses are one and the same *if* the currently running program is stored at the
// beginning of flash. They are different if the start of your image has been "rolled" by the flash
// boot path to make it appear at the address it was linked at even though it is stored at a
// different location in flash, which is necessary when you have A/B images for example.
//
// The address translation between flash runtime and flash storage addresses is configured in
// hardware by the QMI_ATRANSx registers, and this API assumes those registers contain a valid
// address mapping which it can use to translate runtime to storage addresses.
typedef struct cflash_flags {
uint32_t flags;
} cflash_flags_t;
#endif // #ifdef __ASSEMBLER__
// Bits which are permitted to be set in a flags variable -- any other bits being set is an error
#define CFLASH_FLAGS_BITS 0x00070301u
// Used to tell checked flash API which space a given address belongs to
#define CFLASH_ASPACE_BITS 0x00000001u
#define CFLASH_ASPACE_LSB _u(0)
#define CFLASH_ASPACE_VALUE_STORAGE _u(0)
#define CFLASH_ASPACE_VALUE_RUNTIME _u(1)
// Used to tell checked flash APIs the effective security level of a flash access (may be forced to
// one of these values for the NonSecure-exported version of this API)
#define CFLASH_SECLEVEL_BITS 0x00000300u
#define CFLASH_SECLEVEL_LSB _u(8)
// Zero is not a valid security level:
#define CFLASH_SECLEVEL_VALUE_SECURE _u(1)
#define CFLASH_SECLEVEL_VALUE_NONSECURE _u(2)
#define CFLASH_SECLEVEL_VALUE_BOOTLOADER _u(3)
#define CFLASH_OP_BITS 0x00070000u
#define CFLASH_OP_LSB _u(16)
// Erase size_bytes bytes of flash, starting at address addr. Both addr and size_bytes must be a
// multiple of 4096 bytes (one flash sector).
#define CFLASH_OP_VALUE_ERASE _u(0)
// Program size_bytes bytes of flash, starting at address addr. Both addr and size_bytes must be a
// multiple of 256 bytes (one flash page).
#define CFLASH_OP_VALUE_PROGRAM _u(1)
// Read size_bytes bytes of flash, starting at address addr. There are no alignment restrictions on
// addr or size_bytes.
#define CFLASH_OP_VALUE_READ _u(2)
#define CFLASH_OP_MAX _u(2)
#endif
+4 -4
View File
@@ -9,11 +9,11 @@
#define REBOOT2_TYPE_MASK 0x0f
// note these match REBOOT_TYPE in pico/bootrom_constants.h (also 0 is used for PC_SP for backwards compatibility with RP2040)
// note these match REBOOT_TYPE in pico/bootrom_constants.h
// values 0-7 are secure/non-secure
#define REBOOT2_FLAG_REBOOT_TYPE_NORMAL 0x0 // param0 = diagnostic partition
#define REBOOT2_FLAG_REBOOT_TYPE_BOOTSEL 0x2 // param0 = bootsel_flags, param1 = gpio_config
#define REBOOT2_FLAG_REBOOT_TYPE_RAM_IMAGE 0x3 // param0 = image_base, param1 = image_end
#define REBOOT2_FLAG_REBOOT_TYPE_BOOTSEL 0x2 // param0 = gpio_pin_number, param1 = flags
#define REBOOT2_FLAG_REBOOT_TYPE_RAM_IMAGE 0x3 // param0 = image_region_base, param1 = image_region_size
#define REBOOT2_FLAG_REBOOT_TYPE_FLASH_UPDATE 0x4 // param0 = update_base
// values 8-15 are secure only
@@ -39,4 +39,4 @@
#define UF2_STATUS_ABORT_BAD_ADDRESS 0x20
#define UF2_STATUS_ABORT_WRITE_ERROR 0x40
#define UF2_STATUS_ABORT_REBOOT_FAILED 0x80
#endif
#endif
+16 -5
View File
@@ -20,19 +20,30 @@
#define UF2_MAGIC_START1 0x9E5D5157u
#define UF2_MAGIC_END 0x0AB16F30u
#define UF2_FLAG_NOT_MAIN_FLASH 0x00000001u
#define UF2_FLAG_FILE_CONTAINER 0x00001000u
#define UF2_FLAG_FAMILY_ID_PRESENT 0x00002000u
#define UF2_FLAG_MD5_PRESENT 0x00004000u
#define UF2_FLAG_NOT_MAIN_FLASH 0x00000001u
#define UF2_FLAG_FILE_CONTAINER 0x00001000u
#define UF2_FLAG_FAMILY_ID_PRESENT 0x00002000u
#define UF2_FLAG_MD5_PRESENT 0x00004000u
#define UF2_FLAG_EXTENSION_FLAGS_PRESENT 0x00008000u
// Extra family IDs
#define CYW43_FIRMWARE_FAMILY_ID 0xe48bff55u
// Bootrom supported family IDs
#define RP2040_FAMILY_ID 0xe48bff56u
#define ABSOLUTE_FAMILY_ID 0xe48bff57u
#define DATA_FAMILY_ID 0xe48bff58u
#define RP2350_ARM_S_FAMILY_ID 0xe48bff59u
#define RP2350_RISCV_FAMILY_ID 0xe48bff5au
#define RP2350_ARM_NS_FAMILY_ID 0xe48bff5bu
#define FAMILY_ID_MAX 0xe48bff5bu
#define BOOTROM_FAMILY_ID_MIN RP2040_FAMILY_ID
#define BOOTROM_FAMILY_ID_MAX RP2350_ARM_NS_FAMILY_ID
// Defined for backwards compatibility
#define FAMILY_ID_MAX BOOTROM_FAMILY_ID_MAX
// 04 e3 57 99
#define UF2_EXTENSION_RP2_IGNORE_BLOCK 0x9957e304
struct uf2_block {
// 32 byte header
+3
View File
@@ -15,6 +15,9 @@
#define NUM_ALARMS 4u
#define NUM_IRQS 32u
#define NUM_USER_IRQS 6u
#define FIRST_USER_IRQ (NUM_IRQS - NUM_USER_IRQS)
#define VTABLE_FIRST_IRQ 16
#define NUM_SPIN_LOCKS 32u
+26
View File
@@ -1,3 +1,29 @@
This file summarizes the local changes from the upstream pico-sdk
repository (version 2.2.0). In brief, the following steps can be used
to recreate the code here from the main pico-sdk code:
cp /pico-sdk/src/common/boot_uf2_headers/include/boot/*.h boot/
cp /pico-sdk/src/common/boot_picoboot_headers/include/boot/*.h boot/
cp /pico-sdk/src/rp2_common/boot_bootrom_headers/include/boot/*.h boot/
cp /pico-sdk/src/rp2_common/hardware_base/include/hardware/*.h hardware/
cp /pico-sdk/src/host/pico_platform/include/hardware/*.h hardware/
cp /pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom_constants.h pico/
cp /pico-sdk/src/host/pico_platform/include/pico/*.h pico/
cp -a /pico-sdk/src/rp2040/boot_stage2/ rp2040/
cp /pico-sdk/src/rp2_common/cmsis/stub/CMSIS/Device/RP2040/Include/*.h rp2040/cmsis_include/
cp -a /pico-sdk/src/rp2040/hardware_regs/include/hardware rp2040/
cp -a /pico-sdk/src/rp2040/hardware_structs/include/hardware rp2040/
cp /pico-sdk/src/rp2040/pico_platform/include/pico/*.S rp2040/pico/
cp /pico-sdk/src/rp2_common/cmsis/stub/CMSIS/Device/RP2350/Include/*.h rp2350/cmsis_include/
cp /pico-sdk/src/rp2350/hardware_regs/include/hardware/regs/*.h rp2350/hardware/regs/
cp /pico-sdk/src/rp2350/hardware_structs/include/hardware/structs/*.h rp2350/hardware/structs/
patch -p3 < pico-sdk.patch
diff --git a/lib/pico-sdk/hardware/address_mapped.h b/lib/pico-sdk/hardware/address_mapped.h
index b384f5572..635a275b5 100644
--- a/lib/pico-sdk/hardware/address_mapped.h
+2 -336
View File
@@ -4,339 +4,5 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef _PICO_BOOTROM_CONSTANTS_H
#define _PICO_BOOTROM_CONSTANTS_H
#ifndef NO_PICO_PLATFORM
#include "pico/platform.h"
#endif
// ROOT ADDRESSES
#define BOOTROM_MAGIC_OFFSET 0x10
#define BOOTROM_FUNC_TABLE_OFFSET 0x14
#if PICO_RP2040
#define BOOTROM_DATA_TABLE_OFFSET 0x16
#endif
#if PICO_RP2040
#define BOOTROM_VTABLE_OFFSET 0x00
#define BOOTROM_TABLE_LOOKUP_OFFSET 0x18
#else
// todo remove this (or #ifdef it for A1/A2)
#define BOOTROM_IS_A2() ((*(volatile uint8_t *)0x13) == 2)
#define BOOTROM_WELL_KNOWN_PTR_SIZE (BOOTROM_IS_A2() ? 2 : 4)
#if defined(__riscv)
#define BOOTROM_ENTRY_OFFSET 0x7dfc
#define BOOTROM_TABLE_LOOKUP_ENTRY_OFFSET (BOOTROM_ENTRY_OFFSET - BOOTROM_WELL_KNOWN_PTR_SIZE)
#define BOOTROM_TABLE_LOOKUP_OFFSET (BOOTROM_ENTRY_OFFSET - BOOTROM_WELL_KNOWN_PTR_SIZE*2)
#else
#define BOOTROM_VTABLE_OFFSET 0x00
#define BOOTROM_TABLE_LOOKUP_OFFSET (BOOTROM_FUNC_TABLE_OFFSET + BOOTROM_WELL_KNOWN_PTR_SIZE)
#endif
#endif
#if !PICO_RP2040 || PICO_COMBINED_DOCS
#define BOOTROM_OK 0
//#define BOOTROM_ERROR_TIMEOUT (-1)
//#define BOOTROM_ERROR_GENERIC (-2)
//#define BOOTROM_ERROR_NO_DATA (-3) // E.g. read from an empty buffer/FIFO
#define BOOTROM_ERROR_NOT_PERMITTED (-4) // Permission violation e.g. write to read-only flash partition
#define BOOTROM_ERROR_INVALID_ARG (-5) // Argument is outside of range of supported values`
//#define BOOTROM_ERROR_IO (-6)
//#define BOOTROM_ERROR_BADAUTH (-7)
//#define BOOTROM_ERROR_CONNECT_FAILED (-8)
//#define BOOTROM_ERROR_INSUFFICIENT_RESOURCES (-9) // Dynamic allocation of resources failed
#define BOOTROM_ERROR_INVALID_ADDRESS (-10) // Address argument was out-of-bounds or was determined to be an address that the caller may not access
#define BOOTROM_ERROR_BAD_ALIGNMENT (-11) // Address modulo transfer chunk size was nonzero (e.g. word-aligned transfer with address % 4 != 0)
#define BOOTROM_ERROR_INVALID_STATE (-12) // Something happened or failed to happen in the past, and consequently we (currently) can't service the request
#define BOOTROM_ERROR_BUFFER_TOO_SMALL (-13) // A user-allocated buffer was too small to hold the result or working state of this function
#define BOOTROM_ERROR_PRECONDITION_NOT_MET (-14) // This call failed because another ROM function must be called first
#define BOOTROM_ERROR_MODIFIED_DATA (-15) // Cached data was determined to be inconsistent with the full version of the data it was calculated from
#define BOOTROM_ERROR_INVALID_DATA (-16) // A data structure failed to validate
#define BOOTROM_ERROR_NOT_FOUND (-17) // Attempted to access something that does not exist; or, a search failed
#define BOOTROM_ERROR_UNSUPPORTED_MODIFICATION (-18) // Write is impossible based on previous writes; e.g. attempted to clear an OTP bit
#define BOOTROM_ERROR_LOCK_REQUIRED (-19) // A required lock is not owned
#define BOOTROM_ERROR_LAST (-19)
#define RT_FLAG_FUNC_RISCV 0x0001
#define RT_FLAG_FUNC_RISCV_FAR 0x0003
#define RT_FLAG_FUNC_ARM_SEC 0x0004
// reserved for 32-bit pointer: 0x0008
#define RT_FLAG_FUNC_ARM_NONSEC 0x0010
// reserved for 32-bit pointer: 0x0020
#define RT_FLAG_DATA 0x0040
// reserved for 32-bit pointer: 0x0080
#define PARTITION_TABLE_MAX_PARTITIONS 16
// note this is deliberately > MAX_PARTITIONs is likely to be, and also -1 as a signed byte
#define PARTITION_TABLE_NO_PARTITION_INDEX 0xff
// todo these are duplicated in picoboot_constants.h
// values 0-7 are secure/non-secure
#define BOOT_TYPE_NORMAL 0
#define BOOT_TYPE_BOOTSEL 2
#define BOOT_TYPE_RAM_IMAGE 3
#define BOOT_TYPE_FLASH_UPDATE 4
// values 8-15 are secure only
#define BOOT_TYPE_PC_SP 0xd
// ORed in if a bootloader chained into the image
#define BOOT_TYPE_CHAINED_FLAG 0x80
// call from NS to S
#ifndef __riscv
#define BOOTROM_API_CALLBACK_secure_call 0
#endif
#define BOOTROM_API_CALLBACK_COUNT 1
#define BOOTROM_LOCK_SHA_256 0
#define BOOTROM_LOCK_FLASH_OP 1
#define BOOTROM_LOCK_OTP 2
#define BOOTROM_LOCK_MAX 2
#define BOOTROM_LOCK_ENABLE 7
#define BOOT_PARTITION_NONE (-1)
#define BOOT_PARTITION_SLOT0 (-2)
#define BOOT_PARTITION_SLOT1 (-3)
#define BOOT_PARTITION_WINDOW (-4)
#define BOOT_DIAGNOSTIC_WINDOW_SEARCHED 0x01
// note if both BOOT_DIAGNOSTIC_INVALID_BLOCK_LOOP and BOOT_DIAGNOSTIC_VALID_BLOCK_LOOP then the block loop was valid
// but it has a PARTITION_TABLE which while it passed the initial verification (and hash/sig) had invalid contents
// (discovered when it was later loaded)
#define BOOT_DIAGNOSTIC_INVALID_BLOCK_LOOP 0x02
#define BOOT_DIAGNOSTIC_VALID_BLOCK_LOOP 0x04
#define BOOT_DIAGNOSTIC_VALID_IMAGE_DEF 0x08
#define BOOT_DIAGNOSTIC_HAS_PARTITION_TABLE 0x10
#define BOOT_DIAGNOSTIC_CONSIDERED 0x20
#define BOOT_DIAGNOSTIC_CHOSEN 0x40
#define BOOT_DIAGNOSTIC_PARTITION_TABLE_LSB 7
#define BOOT_DIAGNOSTIC_PARTITION_TABLE_MATCHING_KEY_FOR_VERIFY 0x80
#define BOOT_DIAGNOSTIC_PARTITION_TABLE_HASH_FOR_VERIFY 0x100
#define BOOT_DIAGNOSTIC_PARTITION_TABLE_VERIFIED_OK 0x200
#define BOOT_DIAGNOSTIC_IMAGE_DEF_LSB 10
#define BOOT_DIAGNOSTIC_IMAGE_DEF_MATCHING_KEY_FOR_VERIFY 0x400
#define BOOT_DIAGNOSTIC_IMAGE_DEF_HASH_FOR_VERIFY 0x800
#define BOOT_DIAGNOSTIC_IMAGE_DEF_VERIFIED_OK 0x1000
#define BOOT_DIAGNOSTIC_LOAD_MAP_ENTRIES_LOADED 0x2000
#define BOOT_DIAGNOSTIC_IMAGE_LAUNCHED 0x4000
#define BOOT_DIAGNOSTIC_IMAGE_CONDITION_FAILURE 0x8000
#define BOOT_PARSED_BLOCK_DIAGNOSTIC_MATCHING_KEY_FOR_VERIFY 0x1 // if this is present and VERIFIED_OK isn't the sig check failed
#define BOOT_PARSED_BLOCK_DIAGNOSTIC_HASH_FOR_VERIFY 0x2 // if this is present and VERIFIED_OL isn't then hash check failed
#define BOOT_PARSED_BLOCK_DIAGNOSTIC_VERIFIED_OK 0x4
#define BOOT_TBYB_AND_UPDATE_FLAG_BUY_PENDING 0x1
#define BOOT_TBYB_AND_UPDATE_FLAG_OTP_VERSION_APPLIED 0x2
#define BOOT_TBYB_AND_UPDATE_FLAG_OTHER_ERASED 0x4
#ifndef __ASSEMBLER__
// Limited to 3 arguments in case of varm multiplex hint (trashes Arm r3)
typedef int (*bootrom_api_callback_generic_t)(uint32_t r0, uint32_t r1, uint32_t r2);
// Return negative for error, else number of bytes transferred:
//typedef int (*bootrom_api_callback_stdout_put_blocking_t)(const uint8_t *buffer, uint32_t size);
//typedef int (*bootrom_api_callback_stdin_get_t)(uint8_t *buffer, uint32_t size);
//typedef void (*bootrom_api_callback_core1_security_setup_t)(void);
#endif
#endif
/*! \brief Return a bootrom lookup code based on two ASCII characters
* \ingroup pico_bootrom
*
* These codes are uses to lookup data or function addresses in the bootrom
*
* \param c1 the first character
* \param c2 the second character
* \return the 'code' to use in rom_func_lookup() or rom_data_lookup()
*/
#define ROM_TABLE_CODE(c1, c2) ((c1) | ((c2) << 8))
// ROM FUNCTIONS
// RP2040 & RP2350
#define ROM_DATA_SOFTWARE_GIT_REVISION ROM_TABLE_CODE('G', 'R')
#define ROM_FUNC_FLASH_ENTER_CMD_XIP ROM_TABLE_CODE('C', 'X')
#define ROM_FUNC_FLASH_EXIT_XIP ROM_TABLE_CODE('E', 'X')
#define ROM_FUNC_FLASH_FLUSH_CACHE ROM_TABLE_CODE('F', 'C')
#define ROM_FUNC_CONNECT_INTERNAL_FLASH ROM_TABLE_CODE('I', 'F')
#define ROM_FUNC_FLASH_RANGE_ERASE ROM_TABLE_CODE('R', 'E')
#define ROM_FUNC_FLASH_RANGE_PROGRAM ROM_TABLE_CODE('R', 'P')
#if PICO_RP2040
// RP2040 only
#define ROM_FUNC_MEMCPY44 ROM_TABLE_CODE('C', '4')
#define ROM_DATA_COPYRIGHT ROM_TABLE_CODE('C', 'R')
#define ROM_FUNC_CLZ32 ROM_TABLE_CODE('L', '3')
#define ROM_FUNC_MEMCPY ROM_TABLE_CODE('M', 'C')
#define ROM_FUNC_MEMSET ROM_TABLE_CODE('M', 'S')
#define ROM_FUNC_POPCOUNT32 ROM_TABLE_CODE('P', '3')
#define ROM_FUNC_REVERSE32 ROM_TABLE_CODE('R', '3')
#define ROM_FUNC_MEMSET4 ROM_TABLE_CODE('S', '4')
#define ROM_FUNC_CTZ32 ROM_TABLE_CODE('T', '3')
#define ROM_FUNC_RESET_USB_BOOT ROM_TABLE_CODE('U', 'B')
#endif
#if !PICO_RP2040 || PICO_COMBINED_DOCS
// RP2350 only
#define ROM_FUNC_PICK_AB_PARTITION ROM_TABLE_CODE('A', 'B')
#define ROM_FUNC_CHAIN_IMAGE ROM_TABLE_CODE('C', 'I')
#define ROM_FUNC_EXPLICIT_BUY ROM_TABLE_CODE('E', 'B')
#define ROM_FUNC_FLASH_RUNTIME_TO_STORAGE_ADDR ROM_TABLE_CODE('F', 'A')
#define ROM_DATA_FLASH_DEVINFO16_PTR ROM_TABLE_CODE('F', 'D')
#define ROM_FUNC_FLASH_OP ROM_TABLE_CODE('F', 'O')
#define ROM_FUNC_GET_B_PARTITION ROM_TABLE_CODE('G', 'B')
#define ROM_FUNC_GET_PARTITION_TABLE_INFO ROM_TABLE_CODE('G', 'P')
#define ROM_FUNC_GET_SYS_INFO ROM_TABLE_CODE('G', 'S')
#define ROM_FUNC_GET_UF2_TARGET_PARTITION ROM_TABLE_CODE('G', 'U')
#define ROM_FUNC_LOAD_PARTITION_TABLE ROM_TABLE_CODE('L', 'P')
#define ROM_FUNC_OTP_ACCESS ROM_TABLE_CODE('O', 'A')
#define ROM_DATA_PARTITION_TABLE_PTR ROM_TABLE_CODE('P', 'T')
#define ROM_FUNC_FLASH_RESET_ADDRESS_TRANS ROM_TABLE_CODE('R', 'A')
#define ROM_FUNC_REBOOT ROM_TABLE_CODE('R', 'B')
#define ROM_FUNC_SET_ROM_CALLBACK ROM_TABLE_CODE('R', 'C')
#define ROM_FUNC_SECURE_CALL ROM_TABLE_CODE('S', 'C')
#define ROM_FUNC_SET_NS_API_PERMISSION ROM_TABLE_CODE('S', 'P')
#define ROM_FUNC_BOOTROM_STATE_RESET ROM_TABLE_CODE('S', 'R')
#define ROM_FUNC_SET_BOOTROM_STACK ROM_TABLE_CODE('S', 'S')
#define ROM_DATA_SAVED_XIP_SETUP_FUNC_PTR ROM_TABLE_CODE('X', 'F')
#define ROM_FUNC_FLASH_SELECT_XIP_READ_MODE ROM_TABLE_CODE('X', 'M')
#define ROM_FUNC_VALIDATE_NS_BUFFER ROM_TABLE_CODE('V', 'B')
#endif
// these form a bit set
#define BOOTROM_STATE_RESET_CURRENT_CORE 0x01
#define BOOTROM_STATE_RESET_OTHER_CORE 0x02
#define BOOTROM_STATE_RESET_GLOBAL_STATE 0x04 // reset any global state (e.g. permissions)
// partition level stuff is returned first (note PT_INFO flags is only 16 bits)
// 3 words: pt_count, unpartitioned_perm_loc, unpartioned_perm_flags
#define PT_INFO_PT_INFO 0x0001
#define PT_INFO_SINGLE_PARTITION 0x8000 // marker to just include a single partition in the results)
// then in order per partition selected
// 2 words: unpartitioned_perm_loc, unpartioned_perm_flags
#define PT_INFO_PARTITION_LOCATION_AND_FLAGS 0x0010
// 2 words: id lsb first
#define PT_INFO_PARTITION_ID 0x0020
// n+1 words: n, family_id...
#define PT_INFO_PARTITION_FAMILY_IDS 0x0040
// (n+3)/4 words... bytes are: n (len), c0, c1, ... cn-1 padded to word boundary with zeroes
#define PT_INFO_PARTITION_NAME 0x0080
// items are returned in order
// 3 words package_id, device_id, wafer_id
#define SYS_INFO_CHIP_INFO 0x0001
// 1 word: chip specific critical bits
#define SYS_INFO_CRITICAL 0x0002
// 1 word: bytes: cpu_type, supported_cpu_type_bitfield
#define SYS_INFO_CPU_INFO 0x0004
// 1 word: same as FLASH_DEVINFO row in OTP
#define SYS_INFO_FLASH_DEV_INFO 0x0008
// 4 words
#define SYS_INFO_BOOT_RANDOM 0x0010
// 2 words lsb first
#define SYS_INFO_NONCE 0x0020
// 4 words boot_info, boot_diagnostic, boot_param0, boot_param1
#define SYS_INFO_BOOT_INFO 0x0040
#define BOOTROM_NS_API_get_sys_info 0
#define BOOTROM_NS_API_checked_flash_op 1
#define BOOTROM_NS_API_flash_runtime_to_storage_addr 2
#define BOOTROM_NS_API_get_partition_table_info 3
#define BOOTROM_NS_API_secure_call 4
#define BOOTROM_NS_API_otp_access 5
#define BOOTROM_NS_API_reboot 6
#define BOOTROM_NS_API_get_b_partition 7
#define BOOTROM_NS_API_COUNT 8
#ifndef __ASSEMBLER__
typedef struct {
uint32_t permissions_and_location;
uint32_t permissions_and_flags;
} resident_partition_t;
static_assert(sizeof(resident_partition_t) == 8, "");
#define OTP_CMD_ROW_BITS 0x0000ffffu
#define OTP_CMD_ROW_LSB 0u
#define OTP_CMD_WRITE_BITS 0x00010000u
#define OTP_CMD_ECC_BITS 0x00020000u
typedef struct otp_cmd {
uint32_t flags;
} otp_cmd_t;
typedef enum {
BOOTROM_XIP_MODE_03H_SERIAL = 0,
BOOTROM_XIP_MODE_0BH_SERIAL,
BOOTROM_XIP_MODE_BBH_DUAL,
BOOTROM_XIP_MODE_EBH_QUAD,
BOOTROM_XIP_MODE_N_MODES
} bootrom_xip_mode_t;
// The checked flash API wraps the low-level flash routines from generic_flash, adding bounds
// checking, permission checking against the resident partition table, and simple address
// translation. The low-level API deals with flash offsets (i.e. distance from the start of the
// first flash device, measured in bytes) but the checked flash API accepts one of two types of
// address:
//
// - Flash runtime addresses: the address of some flash-resident data or code in the currently
// running image. The flash addresses your binary is "linked at" by the linker.
// - Flash storage addresses: a flash offset, plus the address base where QSPI hardware is first
// mapped on the system bus (XIP_BASE constant from addressmap.h)
//
// These addresses are one and the same *if* the currently running program is stored at the
// beginning of flash. They are different if the start of your image has been "rolled" by the flash
// boot path to make it appear at the address it was linked at even though it is stored at a
// different location in flash, which is necessary when you have A/B images for example.
//
// The address translation between flash runtime and flash storage addresses is configured in
// hardware by the QMI_ATRANSx registers, and this API assumes those registers contain a valid
// address mapping which it can use to translate runtime to storage addresses.
typedef struct cflash_flags {
uint32_t flags;
} cflash_flags_t;
// Bits which are permitted to be set in a flags variable -- any other bits being set is an error
#define CFLASH_FLAGS_BITS 0x00070301u
// Used to tell checked flash API which space a given address belongs to
#define CFLASH_ASPACE_BITS 0x00000001u
#define CFLASH_ASPACE_LSB 0u
#define CFLASH_ASPACE_VALUE_STORAGE 0u
#define CFLASH_ASPACE_VALUE_RUNTIME 1u
// Used to tell checked flash APIs the effective security level of a flash access (may be forced to
// one of these values for the NonSecure-exported version of this API)
#define CFLASH_SECLEVEL_BITS 0x00000300u
#define CFLASH_SECLEVEL_LSB 8u
// Zero is not a valid security level:
#define CFLASH_SECLEVEL_VALUE_SECURE 1u
#define CFLASH_SECLEVEL_VALUE_NONSECURE 2u
#define CFLASH_SECLEVEL_VALUE_BOOTLOADER 3u
#define CFLASH_OP_BITS 0x00070000u
#define CFLASH_OP_LSB 16u
// Erase size_bytes bytes of flash, starting at address addr. Both addr and size_bytes must be a
// multiple of 4096 bytes (one flash sector).
#define CFLASH_OP_VALUE_ERASE 0u
// Program size_bytes bytes of flash, starting at address addr. Both addr and size_bytes must be a
// multiple of 256 bytes (one flash page).
#define CFLASH_OP_VALUE_PROGRAM 1u
// Read size_bytes bytes of flash, starting at address addr. There are no alignment restrictions on
// addr or size_bytes.
#define CFLASH_OP_VALUE_READ 2u
#define CFLASH_OP_MAX 2u
#endif
#endif
// new location; this file kept for backwards compatibility
#include "boot/bootrom_constants.h"
+12 -2
View File
@@ -11,7 +11,7 @@
#include <stdint.h>
#include <stddef.h>
#ifdef __unix__
#if defined __unix__ && defined __GLIBC__
#include <sys/cdefs.h>
@@ -47,7 +47,7 @@ extern void tight_loop_contents();
#define __STRING(x) #x
#endif
#ifndef _MSC_VER
#if !defined(_MSC_VER) || defined(__clang__)
#ifndef __noreturn
#define __noreturn __attribute((noreturn))
#endif
@@ -60,6 +60,12 @@ extern void tight_loop_contents();
#define __noinline __attribute__((noinline))
#endif
#ifndef __force_inline
// don't think it is critical to inline in host mode, and this is simpler than picking the
// correct attribute incantation for always_inline on different compiler versions
#define __force_inline inline
#endif
#ifndef __aligned
#define __aligned(x) __attribute__((aligned(x)))
#endif
@@ -148,7 +154,11 @@ uint get_core_num();
static inline uint __get_current_exception(void) {
return 0;
}
void busy_wait_at_least_cycles(uint32_t minimum_cycles);
#ifdef __cplusplus
}
#endif
@@ -76,6 +76,11 @@ cc_binary(
copts = ["-fPIC"],
# Incompatible with section garbage collection.
features = ["-gc_sections"],
# Platforms will commonly depend on bootloader components in every
# binary via `link_extra_libs`, so we must drop these deps when
# building the bootloader binaries themselves in order to avoid a
# circular dependency.
link_extra_lib = "//bazel:empty_cc_lib",
linkopts = [
"-Wl,--no-gc-sections",
"-nostartfiles",
+15 -7
View File
@@ -30,10 +30,16 @@ pico_register_common_scope_var(PICO_DEFAULT_BOOT_STAGE2_FILE)
# needed by function below
set(PICO_BOOT_STAGE2_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE INTERNAL "")
add_library(boot_stage2_headers INTERFACE)
pico_add_library(boot_stage2_headers)
target_include_directories(boot_stage2_headers SYSTEM INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
# by convention the first source file name without extension is used for the binary info name
# pico_define_boot_stage2(NAME SOURCES)
# \brief\ Define a boot stage 2 target.
#
# By convention the first source file name without extension is used for the binary info name
#
# \param\ NAME The name of the boot stage 2 target
# \param\ SOURCES The source files to link into the boot stage 2
function(pico_define_boot_stage2 NAME SOURCES)
add_executable(${NAME}
${SOURCES}
@@ -66,15 +72,12 @@ function(pico_define_boot_stage2 NAME SOURCES)
add_custom_command(OUTPUT ${ORIGINAL_BIN} DEPENDS ${NAME} COMMAND ${CMAKE_OBJCOPY} -Obinary $<TARGET_FILE:${NAME}> ${ORIGINAL_BIN}
VERBATIM)
add_custom_target(${NAME}_padded_checksummed_asm DEPENDS ${PADDED_CHECKSUMMED_ASM})
add_custom_command(OUTPUT ${PADDED_CHECKSUMMED_ASM} DEPENDS ${ORIGINAL_BIN}
COMMAND ${Python3_EXECUTABLE} ${PICO_BOOT_STAGE2_DIR}/pad_checksum -s 0xffffffff ${ORIGINAL_BIN} ${PADDED_CHECKSUMMED_ASM}
VERBATIM)
add_library(${NAME}_library INTERFACE)
add_dependencies(${NAME}_library ${NAME}_padded_checksummed_asm)
# not strictly (or indeed actually) a link library, but this avoids dependency cycle
target_link_libraries(${NAME}_library INTERFACE ${PADDED_CHECKSUMMED_ASM})
add_library(${NAME}_library OBJECT ${PADDED_CHECKSUMMED_ASM})
target_link_libraries(${NAME}_library INTERFACE "$<TARGET_OBJECTS:${NAME}_library>")
target_link_libraries(${NAME}_library INTERFACE boot_stage2_headers)
list(GET SOURCES 0 FIRST_SOURCE)
@@ -100,7 +103,12 @@ endmacro()
pico_define_boot_stage2(bs2_default ${PICO_DEFAULT_BOOT_STAGE2_FILE})
# pico_clone_default_boot_stage2(NAME)
# \brief_nodesc\ Clone the default boot stage 2 target.
#
# Create a new boot stage 2 target using the default implementation for the current build (PICO_BOARD derived)
#
# \param\ NAME The name of the new boot stage 2 target
function(pico_clone_default_boot_stage2 NAME)
pico_define_boot_stage2(${NAME} ${PICO_DEFAULT_BOOT_STAGE2_FILE})
endfunction()
@@ -144,10 +144,10 @@ regular_func _stage2_boot
// status register and checking for the "RX FIFO Not Empty" flag to assert.
movs r1, #SSI_SR_RFNE_BITS
00:
1:
ldr r0, [r3, #SSI_SR_OFFSET] // Read status register
tst r0, r1 // RFNE status flag set?
beq 00b // If not then wait
beq 1b // If not then wait
// At this point CN# will be deasserted and the SPI clock will not be running.
// The Winbond WX25X10CL device will be in continuous read, dual I/O mode and
@@ -7,6 +7,7 @@ MEMORY {
SECTIONS {
. = ORIGIN(SRAM);
.text : {
_start = .; /* make LLVM happy */
*(.entry)
*(.text)
} >SRAM
@@ -11,13 +11,15 @@
#include "pico.h"
// PICO_CONFIG: PICO_BUILD_BOOT_STAGE2_NAME, The name of the boot stage 2 if selected by the build, group=boot_stage2
// PICO_CONFIG: PICO_FLASH_SPI_CLKDIV, Clock divider from clk_sys to use for serial flash communications in boot stage 2. On RP2040 this must be a multiple of 2. This define applies to compilation of the boot stage 2 not the main application, type=int, default=varies; often specified in board header, advanced=true, group=boot_stage2
// PICO_CONFIG: PICO_BUILD_BOOT_STAGE2_NAME, Name of the boot stage 2 if selected in the build system. This define applies to compilation of the boot stage 2 not the main application, group=boot_stage2
#ifdef PICO_BUILD_BOOT_STAGE2_NAME
#define _BOOT_STAGE2_SELECTED
#else
// check that multiple boot stage 2 options haven't been set...
// PICO_CONFIG: PICO_BOOT_STAGE2_CHOOSE_IS25LP080, Select boot2_is25lp080 as the boot stage 2 when no boot stage 2 selection is made by the CMake build, type=bool, default=0, group=boot_stage2
// PICO_CONFIG: PICO_BOOT_STAGE2_CHOOSE_IS25LP080, Select boot2_is25lp080 as the boot stage 2 when no boot stage 2 selection is made by the CMake build. This define applies to compilation of the boot stage 2 not the main application, type=bool, default=0, group=boot_stage2
#ifndef PICO_BOOT_STAGE2_CHOOSE_IS25LP080
#define PICO_BOOT_STAGE2_CHOOSE_IS25LP080 0
#elif PICO_BOOT_STAGE2_CHOOSE_IS25LP080
@@ -26,7 +28,7 @@
#endif
#define _BOOT_STAGE2_SELECTED
#endif
// PICO_CONFIG: PICO_BOOT_STAGE2_CHOOSE_W25Q080, Select boot2_w25q080 as the boot stage 2 when no boot stage 2 selection is made by the CMake build, type=bool, default=0, group=boot_stage2
// PICO_CONFIG: PICO_BOOT_STAGE2_CHOOSE_W25Q080, Select boot2_w25q080 as the boot stage 2 when no boot stage 2 selection is made by the CMake build. This define applies to compilation of the boot stage 2 not the main application, type=bool, default=0, group=boot_stage2
#ifndef PICO_BOOT_STAGE2_CHOOSE_W25Q080
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 0
#elif PICO_BOOT_STAGE2_CHOOSE_W25Q080
@@ -35,7 +37,7 @@
#endif
#define _BOOT_STAGE2_SELECTED
#endif
// PICO_CONFIG: PICO_BOOT_STAGE2_CHOOSE_W25X10CL, Select boot2_w25x10cl as the boot stage 2 when no boot stage 2 selection is made by the CMake build, type=bool, default=0, group=boot_stage2
// PICO_CONFIG: PICO_BOOT_STAGE2_CHOOSE_W25X10CL, Select boot2_w25x10cl as the boot stage 2 when no boot stage 2 selection is made by the CMake build. This define applies to compilation of the boot stage 2 not the main application, type=bool, default=0, group=boot_stage2
#ifndef PICO_BOOT_STAGE2_CHOOSE_W25X10CL
#define PICO_BOOT_STAGE2_CHOOSE_W25X10CL 0
#elif PICO_BOOT_STAGE2_CHOOSE_W25X10CL
@@ -44,7 +46,7 @@
#endif
#define _BOOT_STAGE2_SELECTED
#endif
// PICO_CONFIG: PICO_BOOT_STAGE2_CHOOSE_AT25SF128A, Select boot2_at25sf128a as the boot stage 2 when no boot stage 2 selection is made by the CMake build, type=bool, default=0, group=boot_stage2
// PICO_CONFIG: PICO_BOOT_STAGE2_CHOOSE_AT25SF128A, Select boot2_at25sf128a as the boot stage 2 when no boot stage 2 selection is made by the CMake build. This define applies to compilation of the boot stage 2 not the main application, type=bool, default=0, group=boot_stage2
#ifndef PICO_BOOT_STAGE2_CHOOSE_AT25SF128A
#define PICO_BOOT_STAGE2_CHOOSE_AT25SF128A 0
#elif PICO_BOOT_STAGE2_CHOOSE_AT25SF128A
@@ -54,7 +56,7 @@
#define _BOOT_STAGE2_SELECTED
#endif
// PICO_CONFIG: PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H, Select boot2_generic_03h as the boot stage 2 when no boot stage 2 selection is made by the CMake build, type=bool, default=1, group=boot_stage2
// PICO_CONFIG: PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H, Select boot2_generic_03h as the boot stage 2 when no boot stage 2 selection is made by the CMake build. This define applies to compilation of the boot stage 2 not the main application, type=bool, default=1, group=boot_stage2
#if defined(PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H) && PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H
#ifdef _BOOT_STAGE2_SELECTED
#error multiple boot stage 2 options chosen
@@ -46,6 +46,15 @@
#define HAS_SIO_DIVIDER 1
#define HAS_RP2040_RTC 1
#ifndef FPGA_CLK_SYS_HZ
#define FPGA_CLK_SYS_HZ (48 * MHZ)
#endif
#ifndef FPGA_CLK_REF_HZ
#define FPGA_CLK_REF_HZ (12 * MHZ)
#endif
// PICO_CONFIG: XOSC_HZ, Crystal oscillator frequency in Hz, type=int, default=12000000, advanced=true, group=hardware_base
// NOTE: The system and USB clocks are generated from the frequency using two PLLs.
// If you override this define, or SYS_CLK_HZ/USB_CLK_HZ below, you will *also* need to add your own adjusted PLL set-up defines to
@@ -61,6 +70,11 @@
#endif
#endif
// PICO_CONFIG: PICO_USE_FASTEST_SUPPORTED_CLOCK, Use the fastest officially supported clock by default, type=bool, default=0, group=hardware_base
#ifndef PICO_USE_FASTEST_SUPPORTED_CLOCK
#define PICO_USE_FASTEST_SUPPORTED_CLOCK 0
#endif
// PICO_CONFIG: SYS_CLK_HZ, System operating frequency in Hz, type=int, default=125000000, advanced=true, group=hardware_base
#ifndef SYS_CLK_HZ
#ifdef SYS_CLK_KHZ
@@ -68,9 +82,13 @@
#elif defined(SYS_CLK_MHZ)
#define SYS_CLK_HZ ((SYS_CLK_MHZ) * _u(1000000))
#else
#if PICO_USE_FASTEST_SUPPORTED_CLOCK
#define SYS_CLK_HZ _u(200000000)
#else
#define SYS_CLK_HZ _u(125000000)
#endif
#endif
#endif
// PICO_CONFIG: USB_CLK_HZ, USB clock frequency. Must be 48MHz for the USB interface to operate correctly, type=int, default=48000000, advanced=true, group=hardware_base
#ifndef USB_CLK_HZ
@@ -116,4 +134,6 @@
#define FIRST_USER_IRQ (NUM_IRQS - NUM_USER_IRQS)
#define VTABLE_FIRST_IRQ 16
#define REG_FIELD_WIDTH(f) (f ## _MSB + 1 - f ## _LSB)
#endif
@@ -39,6 +39,12 @@
#define I2C0_IRQ 23
#define I2C1_IRQ 24
#define RTC_IRQ 25
#define SPARE_IRQ_0 26
#define SPARE_IRQ_1 27
#define SPARE_IRQ_2 28
#define SPARE_IRQ_3 29
#define SPARE_IRQ_4 30
#define SPARE_IRQ_5 31
#else
/**
* \brief Interrupt numbers on RP2040 (used as typedef \ref irq_num_t)
@@ -71,6 +77,12 @@ typedef enum irq_num_rp2040 {
I2C0_IRQ = 23, ///< Select I2C0's IRQ output
I2C1_IRQ = 24, ///< Select I2C1's IRQ output
RTC_IRQ = 25, ///< Select RTC's IRQ output
SPARE_IRQ_0 = 26, ///< Select SPARE IRQ 0
SPARE_IRQ_1 = 27, ///< Select SPARE IRQ 1
SPARE_IRQ_2 = 28, ///< Select SPARE IRQ 2
SPARE_IRQ_3 = 29, ///< Select SPARE IRQ 3
SPARE_IRQ_4 = 30, ///< Select SPARE IRQ 4
SPARE_IRQ_5 = 31, ///< Select SPARE IRQ 5
IRQ_COUNT
} irq_num_t;
#endif
@@ -101,6 +113,12 @@ typedef enum irq_num_rp2040 {
#define isr_i2c0 isr_irq23
#define isr_i2c1 isr_irq24
#define isr_rtc isr_irq25
#define isr_spare_0 isr_irq26
#define isr_spare_1 isr_irq27
#define isr_spare_2 isr_irq28
#define isr_spare_3 isr_irq29
#define isr_spare_4 isr_irq30
#define isr_spare_5 isr_irq31
#endif // _INTCTRL_H
@@ -24,7 +24,6 @@
// BITMASK [BITRANGE] FIELDNAME (RESETVALUE) DESCRIPTION
/** \brief Bus fabric performance counters on RP2040 (used as typedef \ref bus_ctrl_perf_counter_t)
* \ingroup hardware_busctrl
*/
typedef enum bus_ctrl_perf_counter_rp2040 {
arbiter_rom_perf_event_access = 19,
+5 -5
View File
@@ -4,10 +4,10 @@
* @file src/rp2_common/cmsis/stub/CMSIS/Device/RP2350/Include/RP2350.h
* @brief CMSIS HeaderFile
* @version 0.1
* @date Thu Aug 8 04:04:02 2024
* @note Generated by SVDConv V3.3.47
* from File 'src/rp2_common/cmsis/../../rp2350/hardware_regs/RP2350.svd',
* last modified on Thu Aug 8 03:59:33 2024
* @date Mon Jul 28 11:37:41 2025
* @note Generated by SVDConv V3.3.45
* from File 'src/rp2350/hardware_regs/RP2350.svd',
* last modified on Mon Jul 28 11:35:05 2025
*/
@@ -2028,7 +2028,7 @@ typedef struct { /*!< POWMAN Structure
ignore the power down requests. To do nothing would risk
entering an unrecoverable lock-up state. Invalid requests
are: any combination of power up and power down requests
any request that results in swcore boing powered and xip
any request that results in swcore being powered and xip
unpowered If the request is to power down the switched-core
domain then POWMAN_STATE_WAITING stays active until the
processors halt. During this time the POWMAN_STATE_REQ
@@ -1,9 +1,9 @@
/*************************************************************************//**
* @file system_RP2040.h
* @file system_RP2350.h
* @brief CMSIS-Core(M) Device Peripheral Access Layer Header File for
* Device RP2040
* @version V1.0.0
* @date 5. May 2021
* Device RP2350
* @version V1.0.1
* @date 6. Sep 2024
*****************************************************************************/
/*
* Copyright (c) 2009-2021 Arm Limited. All rights reserved.
@@ -26,8 +26,8 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef _CMSIS_SYSTEM_RP2040_H
#define _CMSIS_SYSTEM_RP2040_H
#ifndef _CMSIS_SYSTEM_RP2350_H
#define _CMSIS_SYSTEM_RP2350_H
#ifdef __cplusplus
extern "C" {
@@ -62,4 +62,4 @@ extern void SystemCoreClockUpdate (void);
}
#endif
#endif /* _CMSIS_SYSTEM_RP2040_H */
#endif /* _CMSIS_SYSTEM_RP2350_H */
+3 -3
View File
@@ -615,7 +615,7 @@
// Description : Clock control, can be changed on-the-fly (except for auxsrc)
#define CLOCKS_CLK_SYS_CTRL_OFFSET _u(0x0000003c)
#define CLOCKS_CLK_SYS_CTRL_BITS _u(0x000000e1)
#define CLOCKS_CLK_SYS_CTRL_RESET _u(0x00000000)
#define CLOCKS_CLK_SYS_CTRL_RESET _u(0x00000041)
// -----------------------------------------------------------------------------
// Field : CLOCKS_CLK_SYS_CTRL_AUXSRC
// Description : Selects the auxiliary clock source, will glitch when switching
@@ -625,7 +625,7 @@
// 0x3 -> xosc_clksrc
// 0x4 -> clksrc_gpin0
// 0x5 -> clksrc_gpin1
#define CLOCKS_CLK_SYS_CTRL_AUXSRC_RESET _u(0x0)
#define CLOCKS_CLK_SYS_CTRL_AUXSRC_RESET _u(0x2)
#define CLOCKS_CLK_SYS_CTRL_AUXSRC_BITS _u(0x000000e0)
#define CLOCKS_CLK_SYS_CTRL_AUXSRC_MSB _u(7)
#define CLOCKS_CLK_SYS_CTRL_AUXSRC_LSB _u(5)
@@ -642,7 +642,7 @@
// fly
// 0x0 -> clk_ref
// 0x1 -> clksrc_clk_sys_aux
#define CLOCKS_CLK_SYS_CTRL_SRC_RESET _u(0x0)
#define CLOCKS_CLK_SYS_CTRL_SRC_RESET _u(0x1)
#define CLOCKS_CLK_SYS_CTRL_SRC_BITS _u(0x00000001)
#define CLOCKS_CLK_SYS_CTRL_SRC_MSB _u(0)
#define CLOCKS_CLK_SYS_CTRL_SRC_LSB _u(0)
+4 -4
View File
@@ -121,8 +121,8 @@ typedef enum dreq_num_rp2350 {
DREQ_PWM_WRAP7 = 39, ///< Select PWM Counter 7's Wrap Value as DREQ
DREQ_PWM_WRAP8 = 40, ///< Select PWM Counter 8's Wrap Value as DREQ
DREQ_PWM_WRAP9 = 41, ///< Select PWM Counter 9's Wrap Value as DREQ
DREQ_PWM_WRAP10 = 42, ///< Select PWM Counter 0's Wrap Value as DREQ
DREQ_PWM_WRAP11 = 43, ///< Select PWM Counter 1's Wrap Value as DREQ
DREQ_PWM_WRAP10 = 42, ///< Select PWM Counter 10's Wrap Value as DREQ
DREQ_PWM_WRAP11 = 43, ///< Select PWM Counter 11's Wrap Value as DREQ
DREQ_I2C0_TX = 44, ///< Select I2C0's TX FIFO as DREQ
DREQ_I2C0_RX = 45, ///< Select I2C0's RX FIFO as DREQ
DREQ_I2C1_TX = 46, ///< Select I2C1's TX FIFO as DREQ
@@ -135,8 +135,8 @@ typedef enum dreq_num_rp2350 {
DREQ_CORESIGHT = 53, ///< Select CORESIGHT as DREQ
DREQ_SHA256 = 54, ///< Select SHA256 as DREQ
DREQ_DMA_TIMER0 = 59, ///< Select DMA_TIMER0 as DREQ
DREQ_DMA_TIMER1 = 60, ///< Select DMA_TIMER0 as DREQ
DREQ_DMA_TIMER2 = 61, ///< Select DMA_TIMER1 as DREQ
DREQ_DMA_TIMER1 = 60, ///< Select DMA_TIMER1 as DREQ
DREQ_DMA_TIMER2 = 61, ///< Select DMA_TIMER2 as DREQ
DREQ_DMA_TIMER3 = 62, ///< Select DMA_TIMER3 as DREQ
DREQ_FORCE = 63, ///< Select FORCE as DREQ
DREQ_COUNT
@@ -37,8 +37,7 @@
#define GLITCH_DETECTOR_ARM_VALUE_YES _u(0x0000)
// =============================================================================
// Register : GLITCH_DETECTOR_DISARM
// Description : None
// Forcibly disarm the glitch detectors, if they are armed by OTP.
// Description : Forcibly disarm the glitch detectors, if they are armed by OTP.
// Ignored if ARM is YES.
//
// This register is Secure read/write only.
@@ -142,8 +141,7 @@
#define GLITCH_DETECTOR_SENSITIVITY_DET0_ACCESS "RW"
// =============================================================================
// Register : GLITCH_DETECTOR_LOCK
// Description : None
// Write any nonzero value to disable writes to ARM, DISARM,
// Description : Write any nonzero value to disable writes to ARM, DISARM,
// SENSITIVITY and LOCK. This register is Secure read/write only.
#define GLITCH_DETECTOR_LOCK_OFFSET _u(0x0000000c)
#define GLITCH_DETECTOR_LOCK_BITS _u(0x000000ff)
+18 -18
View File
@@ -59,12 +59,12 @@
#define PLL_USB_IRQ 43
#define POWMAN_IRQ_POW 44
#define POWMAN_IRQ_TIMER 45
#define SPAREIRQ_IRQ_0 46
#define SPAREIRQ_IRQ_1 47
#define SPAREIRQ_IRQ_2 48
#define SPAREIRQ_IRQ_3 49
#define SPAREIRQ_IRQ_4 50
#define SPAREIRQ_IRQ_5 51
#define SPARE_IRQ_0 46
#define SPARE_IRQ_1 47
#define SPARE_IRQ_2 48
#define SPARE_IRQ_3 49
#define SPARE_IRQ_4 50
#define SPARE_IRQ_5 51
#else
/**
* \brief Interrupt numbers on RP2350 (used as typedef \ref irq_num_t)
@@ -79,8 +79,8 @@ typedef enum irq_num_rp2350 {
TIMER1_IRQ_1 = 5, ///< Select TIMER1's IRQ 1 output
TIMER1_IRQ_2 = 6, ///< Select TIMER1's IRQ 2 output
TIMER1_IRQ_3 = 7, ///< Select TIMER1's IRQ 3 output
PWM_IRQ_WRAP_0 = 8, ///< Select PWM's IRQ_WRAP 0 output
PWM_IRQ_WRAP_1 = 9, ///< Select PWM's IRQ_WRAP 1 output
PWM_IRQ_WRAP_0 = 8, ///< Select PWM's WRAP_0 IRQ output
PWM_IRQ_WRAP_1 = 9, ///< Select PWM's WRAP_1 IRQ output
DMA_IRQ_0 = 10, ///< Select DMA's IRQ 0 output
DMA_IRQ_1 = 11, ///< Select DMA's IRQ 1 output
DMA_IRQ_2 = 12, ///< Select DMA's IRQ 2 output
@@ -96,27 +96,27 @@ typedef enum irq_num_rp2350 {
IO_IRQ_BANK0_NS = 22, ///< Select IO_BANK0_NS's IRQ output
IO_IRQ_QSPI = 23, ///< Select IO_QSPI's IRQ output
IO_IRQ_QSPI_NS = 24, ///< Select IO_QSPI_NS's IRQ output
SIO_IRQ_FIFO = 25, ///< Select SIO's IRQ_FIFO output
SIO_IRQ_BELL = 26, ///< Select SIO's IRQ_BELL output
SIO_IRQ_FIFO_NS = 27, ///< Select SIO_NS's IRQ_FIFO output
SIO_IRQ_BELL_NS = 28, ///< Select SIO_NS's IRQ_BELL output
SIO_IRQ_MTIMECMP = 29, ///< Select SIO_IRQ_MTIMECMP's IRQ output
SIO_IRQ_FIFO = 25, ///< Select SIO's FIFO IRQ output
SIO_IRQ_BELL = 26, ///< Select SIO's BELL IRQ output
SIO_IRQ_FIFO_NS = 27, ///< Select SIO_NS's FIFO IRQ output
SIO_IRQ_BELL_NS = 28, ///< Select SIO_NS's BELL IRQ output
SIO_IRQ_MTIMECMP = 29, ///< Select SIO's MTIMECMP IRQ output
CLOCKS_IRQ = 30, ///< Select CLOCKS's IRQ output
SPI0_IRQ = 31, ///< Select SPI0's IRQ output
SPI1_IRQ = 32, ///< Select SPI1's IRQ output
UART0_IRQ = 33, ///< Select UART0's IRQ output
UART1_IRQ = 34, ///< Select UART1's IRQ output
ADC_IRQ_FIFO = 35, ///< Select ADC's IRQ_FIFO output
ADC_IRQ_FIFO = 35, ///< Select ADC's FIFO IRQ output
I2C0_IRQ = 36, ///< Select I2C0's IRQ output
I2C1_IRQ = 37, ///< Select I2C1's IRQ output
OTP_IRQ = 38, ///< Select OTP's IRQ output
TRNG_IRQ = 39, ///< Select TRNG's IRQ output
PROC0_IRQ_CTI = 40, ///< Select PROC0's IRQ_CTI output
PROC1_IRQ_CTI = 41, ///< Select PROC1's IRQ_CTI output
PROC0_IRQ_CTI = 40, ///< Select PROC0's CTI IRQ output
PROC1_IRQ_CTI = 41, ///< Select PROC1's CTI IRQ output
PLL_SYS_IRQ = 42, ///< Select PLL_SYS's IRQ output
PLL_USB_IRQ = 43, ///< Select PLL_USB's IRQ output
POWMAN_IRQ_POW = 44, ///< Select POWMAN's IRQ_POW output
POWMAN_IRQ_TIMER = 45, ///< Select POWMAN's IRQ_TIMER output
POWMAN_IRQ_POW = 44, ///< Select POWMAN's POW IRQ output
POWMAN_IRQ_TIMER = 45, ///< Select POWMAN's TIMER IRQ output
SPARE_IRQ_0 = 46, ///< Select SPARE IRQ 0
SPARE_IRQ_1 = 47, ///< Select SPARE IRQ 1
SPARE_IRQ_2 = 48, ///< Select SPARE IRQ 2
+2 -4
View File
@@ -461,8 +461,7 @@
// =============================================================================
// Register : PIO_DBG_PADOUT
// Description : Read to sample the pad output values PIO is currently driving
// to the GPIOs. On RP2040 there are 30 GPIOs, so the two most
// significant bits are hardwired to 0.
// to the GPIOs.
#define PIO_DBG_PADOUT_OFFSET _u(0x0000003c)
#define PIO_DBG_PADOUT_BITS _u(0xffffffff)
#define PIO_DBG_PADOUT_RESET _u(0x00000000)
@@ -472,8 +471,7 @@
// =============================================================================
// Register : PIO_DBG_PADOE
// Description : Read to sample the pad output enables (direction) PIO is
// currently driving to the GPIOs. On RP2040 there are 30 GPIOs,
// so the two most significant bits are hardwired to 0.
// currently driving to the GPIOs.
#define PIO_DBG_PADOE_OFFSET _u(0x00000040)
#define PIO_DBG_PADOE_BITS _u(0xffffffff)
#define PIO_DBG_PADOE_RESET _u(0x00000000)
+30 -29
View File
@@ -944,7 +944,7 @@
// requests and ignore the power down requests. To do nothing
// would risk entering an unrecoverable lock-up state. Invalid
// requests are: any combination of power up and power down
// requests any request that results in swcore boing powered and
// requests any request that results in swcore being powered and
// xip unpowered If the request is to power down the switched-core
// domain then POWMAN_STATE_WAITING stays active until the
// processors halt. During this time the POWMAN_STATE_REQ field
@@ -957,6 +957,7 @@
#define POWMAN_STATE_RESET _u(0x0000000f)
// -----------------------------------------------------------------------------
// Field : POWMAN_STATE_CHANGING
// Description : Indicates a power state change is in progress
#define POWMAN_STATE_CHANGING_RESET _u(0x0)
#define POWMAN_STATE_CHANGING_BITS _u(0x00002000)
#define POWMAN_STATE_CHANGING_MSB _u(13)
@@ -964,6 +965,9 @@
#define POWMAN_STATE_CHANGING_ACCESS "RO"
// -----------------------------------------------------------------------------
// Field : POWMAN_STATE_WAITING
// Description : Indicates the power manager has received a state change request
// and is waiting for other actions to complete before executing
// it
#define POWMAN_STATE_WAITING_RESET _u(0x0)
#define POWMAN_STATE_WAITING_BITS _u(0x00001000)
#define POWMAN_STATE_WAITING_MSB _u(12)
@@ -971,8 +975,8 @@
#define POWMAN_STATE_WAITING_ACCESS "RO"
// -----------------------------------------------------------------------------
// Field : POWMAN_STATE_BAD_HW_REQ
// Description : Bad hardware initiated state request. Went back to state 0
// (i.e. everything powered up)
// Description : Invalid hardware initiated state request, power up requests
// actioned, power down requests ignored
#define POWMAN_STATE_BAD_HW_REQ_RESET _u(0x0)
#define POWMAN_STATE_BAD_HW_REQ_BITS _u(0x00000800)
#define POWMAN_STATE_BAD_HW_REQ_MSB _u(11)
@@ -980,7 +984,7 @@
#define POWMAN_STATE_BAD_HW_REQ_ACCESS "RO"
// -----------------------------------------------------------------------------
// Field : POWMAN_STATE_BAD_SW_REQ
// Description : Bad software initiated state request. No action taken.
// Description : Invalid software initiated state request ignored
#define POWMAN_STATE_BAD_SW_REQ_RESET _u(0x0)
#define POWMAN_STATE_BAD_SW_REQ_BITS _u(0x00000400)
#define POWMAN_STATE_BAD_SW_REQ_MSB _u(10)
@@ -988,9 +992,8 @@
#define POWMAN_STATE_BAD_SW_REQ_ACCESS "RO"
// -----------------------------------------------------------------------------
// Field : POWMAN_STATE_PWRUP_WHILE_WAITING
// Description : Request ignored because of a pending pwrup request. See
// current_pwrup_req. Note this blocks powering up AND powering
// down.
// Description : Indicates that a power state change request was ignored because
// of a pending power state change request
#define POWMAN_STATE_PWRUP_WHILE_WAITING_RESET _u(0x0)
#define POWMAN_STATE_PWRUP_WHILE_WAITING_BITS _u(0x00000200)
#define POWMAN_STATE_PWRUP_WHILE_WAITING_MSB _u(9)
@@ -998,6 +1001,8 @@
#define POWMAN_STATE_PWRUP_WHILE_WAITING_ACCESS "WC"
// -----------------------------------------------------------------------------
// Field : POWMAN_STATE_REQ_IGNORED
// Description : Indicates that a software state change request was ignored
// because it clashed with an ongoing hardware or debugger request
#define POWMAN_STATE_REQ_IGNORED_RESET _u(0x0)
#define POWMAN_STATE_REQ_IGNORED_BITS _u(0x00000100)
#define POWMAN_STATE_REQ_IGNORED_MSB _u(8)
@@ -1005,6 +1010,8 @@
#define POWMAN_STATE_REQ_IGNORED_ACCESS "WC"
// -----------------------------------------------------------------------------
// Field : POWMAN_STATE_REQ
// Description : This is written by software or hardware to request a new power
// state
#define POWMAN_STATE_REQ_RESET _u(0x0)
#define POWMAN_STATE_REQ_BITS _u(0x000000f0)
#define POWMAN_STATE_REQ_MSB _u(7)
@@ -1012,6 +1019,7 @@
#define POWMAN_STATE_REQ_ACCESS "RW"
// -----------------------------------------------------------------------------
// Field : POWMAN_STATE_CURRENT
// Description : Indicates the current power state
#define POWMAN_STATE_CURRENT_RESET _u(0xf)
#define POWMAN_STATE_CURRENT_BITS _u(0x0000000f)
#define POWMAN_STATE_CURRENT_MSB _u(3)
@@ -1019,8 +1027,7 @@
#define POWMAN_STATE_CURRENT_ACCESS "RO"
// =============================================================================
// Register : POWMAN_POW_FASTDIV
// Description : None
// divides the POWMAN clock to provide a tick for the delay module
// Description : divides the POWMAN clock to provide a tick for the delay module
// and state machines
// when clk_pow is running from the slow clock it is not divided
// when clk_pow is running from the fast clock it is divided by
@@ -1187,6 +1194,10 @@
#define POWMAN_EXT_TIME_REF_SOURCE_SEL_MSB _u(1)
#define POWMAN_EXT_TIME_REF_SOURCE_SEL_LSB _u(0)
#define POWMAN_EXT_TIME_REF_SOURCE_SEL_ACCESS "RW"
#define POWMAN_EXT_TIME_REF_SOURCE_SEL_VALUE_GPIO12 _u(0x0)
#define POWMAN_EXT_TIME_REF_SOURCE_SEL_VALUE_GPIO20 _u(0x1)
#define POWMAN_EXT_TIME_REF_SOURCE_SEL_VALUE_GPIO14 _u(0x2)
#define POWMAN_EXT_TIME_REF_SOURCE_SEL_VALUE_GPIO22 _u(0x3)
// =============================================================================
// Register : POWMAN_LPOSC_FREQ_KHZ_INT
// Description : Informs the AON Timer of the integer component of the clock
@@ -1241,8 +1252,7 @@
#define POWMAN_XOSC_FREQ_KHZ_FRAC_ACCESS "RW"
// =============================================================================
// Register : POWMAN_SET_TIME_63TO48
// Description : None
// For setting the time, do not use for reading the time, use
// Description : For setting the time, do not use for reading the time, use
// POWMAN_READ_TIME_UPPER and POWMAN_READ_TIME_LOWER. This field
// must only be written when POWMAN_TIMER_RUN=0
#define POWMAN_SET_TIME_63TO48_OFFSET _u(0x00000060)
@@ -1253,8 +1263,7 @@
#define POWMAN_SET_TIME_63TO48_ACCESS "RW"
// =============================================================================
// Register : POWMAN_SET_TIME_47TO32
// Description : None
// For setting the time, do not use for reading the time, use
// Description : For setting the time, do not use for reading the time, use
// POWMAN_READ_TIME_UPPER and POWMAN_READ_TIME_LOWER. This field
// must only be written when POWMAN_TIMER_RUN=0
#define POWMAN_SET_TIME_47TO32_OFFSET _u(0x00000064)
@@ -1265,8 +1274,7 @@
#define POWMAN_SET_TIME_47TO32_ACCESS "RW"
// =============================================================================
// Register : POWMAN_SET_TIME_31TO16
// Description : None
// For setting the time, do not use for reading the time, use
// Description : For setting the time, do not use for reading the time, use
// POWMAN_READ_TIME_UPPER and POWMAN_READ_TIME_LOWER. This field
// must only be written when POWMAN_TIMER_RUN=0
#define POWMAN_SET_TIME_31TO16_OFFSET _u(0x00000068)
@@ -1277,8 +1285,7 @@
#define POWMAN_SET_TIME_31TO16_ACCESS "RW"
// =============================================================================
// Register : POWMAN_SET_TIME_15TO0
// Description : None
// For setting the time, do not use for reading the time, use
// Description : For setting the time, do not use for reading the time, use
// POWMAN_READ_TIME_UPPER and POWMAN_READ_TIME_LOWER. This field
// must only be written when POWMAN_TIMER_RUN=0
#define POWMAN_SET_TIME_15TO0_OFFSET _u(0x0000006c)
@@ -1289,8 +1296,7 @@
#define POWMAN_SET_TIME_15TO0_ACCESS "RW"
// =============================================================================
// Register : POWMAN_READ_TIME_UPPER
// Description : None
// For reading bits 63:32 of the timer. When reading all 64 bits
// Description : For reading bits 63:32 of the timer. When reading all 64 bits
// it is possible for the LOWER count to rollover during the read.
// It is recommended to read UPPER, then LOWER, then re-read UPPER
// and, if it has changed, re-read LOWER.
@@ -1302,8 +1308,7 @@
#define POWMAN_READ_TIME_UPPER_ACCESS "RO"
// =============================================================================
// Register : POWMAN_READ_TIME_LOWER
// Description : None
// For reading bits 31:0 of the timer.
// Description : For reading bits 31:0 of the timer.
#define POWMAN_READ_TIME_LOWER_OFFSET _u(0x00000074)
#define POWMAN_READ_TIME_LOWER_BITS _u(0xffffffff)
#define POWMAN_READ_TIME_LOWER_RESET _u(0x00000000)
@@ -1312,8 +1317,7 @@
#define POWMAN_READ_TIME_LOWER_ACCESS "RO"
// =============================================================================
// Register : POWMAN_ALARM_TIME_63TO48
// Description : None
// This field must only be written when POWMAN_ALARM_ENAB=0
// Description : This field must only be written when POWMAN_ALARM_ENAB=0
#define POWMAN_ALARM_TIME_63TO48_OFFSET _u(0x00000078)
#define POWMAN_ALARM_TIME_63TO48_BITS _u(0x0000ffff)
#define POWMAN_ALARM_TIME_63TO48_RESET _u(0x00000000)
@@ -1322,8 +1326,7 @@
#define POWMAN_ALARM_TIME_63TO48_ACCESS "RW"
// =============================================================================
// Register : POWMAN_ALARM_TIME_47TO32
// Description : None
// This field must only be written when POWMAN_ALARM_ENAB=0
// Description : This field must only be written when POWMAN_ALARM_ENAB=0
#define POWMAN_ALARM_TIME_47TO32_OFFSET _u(0x0000007c)
#define POWMAN_ALARM_TIME_47TO32_BITS _u(0x0000ffff)
#define POWMAN_ALARM_TIME_47TO32_RESET _u(0x00000000)
@@ -1332,8 +1335,7 @@
#define POWMAN_ALARM_TIME_47TO32_ACCESS "RW"
// =============================================================================
// Register : POWMAN_ALARM_TIME_31TO16
// Description : None
// This field must only be written when POWMAN_ALARM_ENAB=0
// Description : This field must only be written when POWMAN_ALARM_ENAB=0
#define POWMAN_ALARM_TIME_31TO16_OFFSET _u(0x00000080)
#define POWMAN_ALARM_TIME_31TO16_BITS _u(0x0000ffff)
#define POWMAN_ALARM_TIME_31TO16_RESET _u(0x00000000)
@@ -1342,8 +1344,7 @@
#define POWMAN_ALARM_TIME_31TO16_ACCESS "RW"
// =============================================================================
// Register : POWMAN_ALARM_TIME_15TO0
// Description : None
// This field must only be written when POWMAN_ALARM_ENAB=0
// Description : This field must only be written when POWMAN_ALARM_ENAB=0
#define POWMAN_ALARM_TIME_15TO0_OFFSET _u(0x00000084)
#define POWMAN_ALARM_TIME_15TO0_BITS _u(0x0000ffff)
#define POWMAN_ALARM_TIME_15TO0_RESET _u(0x00000000)
+7 -7
View File
@@ -39,9 +39,9 @@
// Field : ROSC_CTRL_FREQ_RANGE
// Description : Controls the number of delay stages in the ROSC ring
// LOW uses stages 0 to 7
// MEDIUM uses stages 2 to 7
// HIGH uses stages 4 to 7
// TOOHIGH uses stages 6 to 7 and should not be used because its
// MEDIUM uses stages 0 to 5
// HIGH uses stages 0 to 3
// TOOHIGH uses stages 0 to 1 and should not be used because its
// frequency exceeds design specifications
// The clock output will not glitch when changing the range up one
// step at a time
@@ -77,7 +77,7 @@
// DS1_RANDOM=1
#define ROSC_FREQA_OFFSET _u(0x00000004)
#define ROSC_FREQA_BITS _u(0xffff77ff)
#define ROSC_FREQA_RESET _u(0x00000000)
#define ROSC_FREQA_RESET _u(0x00000088)
// -----------------------------------------------------------------------------
// Field : ROSC_FREQA_PASSWD
// Description : Set to 0x9696 to apply the settings
@@ -108,7 +108,7 @@
// -----------------------------------------------------------------------------
// Field : ROSC_FREQA_DS1_RANDOM
// Description : Randomises the stage 1 drive strength
#define ROSC_FREQA_DS1_RANDOM_RESET _u(0x0)
#define ROSC_FREQA_DS1_RANDOM_RESET _u(0x1)
#define ROSC_FREQA_DS1_RANDOM_BITS _u(0x00000080)
#define ROSC_FREQA_DS1_RANDOM_MSB _u(7)
#define ROSC_FREQA_DS1_RANDOM_LSB _u(7)
@@ -124,7 +124,7 @@
// -----------------------------------------------------------------------------
// Field : ROSC_FREQA_DS0_RANDOM
// Description : Randomises the stage 0 drive strength
#define ROSC_FREQA_DS0_RANDOM_RESET _u(0x0)
#define ROSC_FREQA_DS0_RANDOM_RESET _u(0x1)
#define ROSC_FREQA_DS0_RANDOM_BITS _u(0x00000008)
#define ROSC_FREQA_DS0_RANDOM_MSB _u(3)
#define ROSC_FREQA_DS0_RANDOM_LSB _u(3)
@@ -206,7 +206,7 @@
// On power-up this field is initialised to WAKE
// An invalid write will also select WAKE
// Warning: setup the irq before selecting dormant mode
// 0x636f6d61 -> dormant
// 0x636f6d61 -> DORMANT
// 0x77616b65 -> WAKE
#define ROSC_DORMANT_OFFSET _u(0x00000010)
#define ROSC_DORMANT_BITS _u(0xffffffff)
+74 -12
View File
@@ -86,7 +86,7 @@
// In addition the following custom extensions are configured:
// Xh3bm, Xh3power, Xh3irq, Xh3pmpm
#define RVCSR_MISA_OFFSET _u(0x00000301)
#define RVCSR_MISA_BITS _u(0xc0901107)
#define RVCSR_MISA_BITS _u(0xc0b511bf)
#define RVCSR_MISA_RESET _u(0x40901105)
// -----------------------------------------------------------------------------
// Field : RVCSR_MISA_MXL
@@ -106,6 +106,14 @@
#define RVCSR_MISA_X_LSB _u(23)
#define RVCSR_MISA_X_ACCESS "RO"
// -----------------------------------------------------------------------------
// Field : RVCSR_MISA_V
// Description : Vector extension (not implemented).
#define RVCSR_MISA_V_RESET _u(0x0)
#define RVCSR_MISA_V_BITS _u(0x00200000)
#define RVCSR_MISA_V_MSB _u(21)
#define RVCSR_MISA_V_LSB _u(21)
#define RVCSR_MISA_V_ACCESS "RO"
// -----------------------------------------------------------------------------
// Field : RVCSR_MISA_U
// Description : Value of 1 indicates U-mode is implemented.
#define RVCSR_MISA_U_RESET _u(0x1)
@@ -114,6 +122,22 @@
#define RVCSR_MISA_U_LSB _u(20)
#define RVCSR_MISA_U_ACCESS "RO"
// -----------------------------------------------------------------------------
// Field : RVCSR_MISA_S
// Description : Supervisor extension (not implemented).
#define RVCSR_MISA_S_RESET _u(0x0)
#define RVCSR_MISA_S_BITS _u(0x00040000)
#define RVCSR_MISA_S_MSB _u(18)
#define RVCSR_MISA_S_LSB _u(18)
#define RVCSR_MISA_S_ACCESS "RO"
// -----------------------------------------------------------------------------
// Field : RVCSR_MISA_Q
// Description : Quad-precision floating point extension (not implemented).
#define RVCSR_MISA_Q_RESET _u(0x0)
#define RVCSR_MISA_Q_BITS _u(0x00010000)
#define RVCSR_MISA_Q_MSB _u(16)
#define RVCSR_MISA_Q_LSB _u(16)
#define RVCSR_MISA_Q_ACCESS "RO"
// -----------------------------------------------------------------------------
// Field : RVCSR_MISA_M
// Description : Value of 1 indicates the M extension (integer multiply/divide)
// is implemented.
@@ -132,6 +156,39 @@
#define RVCSR_MISA_I_LSB _u(8)
#define RVCSR_MISA_I_ACCESS "RO"
// -----------------------------------------------------------------------------
// Field : RVCSR_MISA_H
// Description : Hypervisor extension (not implemented, I agree it would be
// pretty cool on a microcontroller through).
#define RVCSR_MISA_H_RESET _u(0x0)
#define RVCSR_MISA_H_BITS _u(0x00000080)
#define RVCSR_MISA_H_MSB _u(7)
#define RVCSR_MISA_H_LSB _u(7)
#define RVCSR_MISA_H_ACCESS "RO"
// -----------------------------------------------------------------------------
// Field : RVCSR_MISA_F
// Description : Single-precision floating point extension (not implemented).
#define RVCSR_MISA_F_RESET _u(0x0)
#define RVCSR_MISA_F_BITS _u(0x00000020)
#define RVCSR_MISA_F_MSB _u(5)
#define RVCSR_MISA_F_LSB _u(5)
#define RVCSR_MISA_F_ACCESS "RO"
// -----------------------------------------------------------------------------
// Field : RVCSR_MISA_E
// Description : RV32E/64E base ISA (not implemented).
#define RVCSR_MISA_E_RESET _u(0x0)
#define RVCSR_MISA_E_BITS _u(0x00000010)
#define RVCSR_MISA_E_MSB _u(4)
#define RVCSR_MISA_E_LSB _u(4)
#define RVCSR_MISA_E_ACCESS "RO"
// -----------------------------------------------------------------------------
// Field : RVCSR_MISA_D
// Description : Double-precision floating point extension (not implemented).
#define RVCSR_MISA_D_RESET _u(0x0)
#define RVCSR_MISA_D_BITS _u(0x00000008)
#define RVCSR_MISA_D_MSB _u(3)
#define RVCSR_MISA_D_LSB _u(3)
#define RVCSR_MISA_D_ACCESS "RO"
// -----------------------------------------------------------------------------
// Field : RVCSR_MISA_C
// Description : Value of 1 indicates the C extension (compressed instructions)
// is implemented.
@@ -207,7 +264,7 @@
// Description : Timer interrupt enable. The processor transfers to the timer
// interrupt vector when `mie.mtie`, `mip.mtip` and `mstatus.mie`
// are all 1, unless a software or external interrupt request is
// also valid at this time.
// also both pending and enabled at this time.
#define RVCSR_MIE_MTIE_RESET _u(0x0)
#define RVCSR_MIE_MTIE_BITS _u(0x00000080)
#define RVCSR_MIE_MTIE_MSB _u(7)
@@ -216,9 +273,9 @@
// -----------------------------------------------------------------------------
// Field : RVCSR_MIE_MSIE
// Description : Software interrupt enable. The processor transfers to the
// software interrupt vector `mie.msie`, `mip.msip` and
// software interrupt vector when `mie.msie`, `mip.msip` and
// `mstatus.mie` are all 1, unless an external interrupt request
// is also valid at this time.
// is also both pending and enabled at this time.
#define RVCSR_MIE_MSIE_RESET _u(0x0)
#define RVCSR_MIE_MSIE_BITS _u(0x00000008)
#define RVCSR_MIE_MSIE_MSB _u(3)
@@ -336,7 +393,7 @@
#define RVCSR_MENVCFGH_RESET _u(0x00000000)
#define RVCSR_MENVCFGH_MSB _u(31)
#define RVCSR_MENVCFGH_LSB _u(0)
#define RVCSR_MENVCFGH_ACCESS "RW"
#define RVCSR_MENVCFGH_ACCESS "-"
// =============================================================================
// Register : RVCSR_MCOUNTINHIBIT
// Description : Count inhibit register for `mcycle`/`minstret`
@@ -732,7 +789,7 @@
// Description : Timer interrupt pending. The processor transfers to the timer
// interrupt vector when `mie.mtie`, `mip.mtip` and `mstatus.mie`
// are all 1, unless a software or external interrupt request is
// also valid at this time.
// also both pending and enabled at this time.
#define RVCSR_MIP_MTIP_RESET _u(0x0)
#define RVCSR_MIP_MTIP_BITS _u(0x00000080)
#define RVCSR_MIP_MTIP_MSB _u(7)
@@ -741,9 +798,9 @@
// -----------------------------------------------------------------------------
// Field : RVCSR_MIP_MSIP
// Description : Software interrupt pending. The processor transfers to the
// software interrupt vector `mie.msie`, `mip.msip` and
// software interrupt vector when `mie.msie`, `mip.msip` and
// `mstatus.mie` are all 1, unless an external interrupt request
// is also valid at this time.
// is also both pending and enabled at this time.
#define RVCSR_MIP_MSIP_RESET _u(0x0)
#define RVCSR_MIP_MSIP_BITS _u(0x00000008)
#define RVCSR_MIP_MSIP_MSB _u(3)
@@ -3099,14 +3156,18 @@
#define RVCSR_MVENDORID_RESET _u(0x00000000)
// -----------------------------------------------------------------------------
// Field : RVCSR_MVENDORID_BANK
#define RVCSR_MVENDORID_BANK_RESET "-"
// Description : Value of 9 indicates 9 continuation codes, which is JEP106 bank
// 10.
#define RVCSR_MVENDORID_BANK_RESET _u(0x0000009)
#define RVCSR_MVENDORID_BANK_BITS _u(0xffffff80)
#define RVCSR_MVENDORID_BANK_MSB _u(31)
#define RVCSR_MVENDORID_BANK_LSB _u(7)
#define RVCSR_MVENDORID_BANK_ACCESS "RO"
// -----------------------------------------------------------------------------
// Field : RVCSR_MVENDORID_OFFSET
#define RVCSR_MVENDORID_OFFSET_RESET "-"
// Description : ID 0x13 in bank 10 is the JEP106 ID for Raspberry Pi Ltd, the
// vendor of RP2350.
#define RVCSR_MVENDORID_OFFSET_RESET _u(0x13)
#define RVCSR_MVENDORID_OFFSET_BITS _u(0x0000007f)
#define RVCSR_MVENDORID_OFFSET_MSB _u(6)
#define RVCSR_MVENDORID_OFFSET_LSB _u(0)
@@ -3122,10 +3183,11 @@
#define RVCSR_MARCHID_ACCESS "RO"
// =============================================================================
// Register : RVCSR_MIMPID
// Description : Implementation ID
// Description : Implementation ID. On RP2350 this reads as 0x86fc4e3f, which is
// release v1.0-rc1 of Hazard3.
#define RVCSR_MIMPID_OFFSET _u(0x00000f13)
#define RVCSR_MIMPID_BITS _u(0xffffffff)
#define RVCSR_MIMPID_RESET "-"
#define RVCSR_MIMPID_RESET _u(0x86fc4e3f)
#define RVCSR_MIMPID_MSB _u(31)
#define RVCSR_MIMPID_LSB _u(0)
#define RVCSR_MIMPID_ACCESS "RO"
+4 -1
View File
@@ -255,7 +255,10 @@
// =============================================================================
// Register : SYSCFG_AUXCTRL
// Description : Auxiliary system control register
// * Bits 7:2: Reserved
// * Bits 7:3: Reserved
//
// * Bit 2: Set to mask OTP power analogue power supply detection
// from resetting OTP controller and PSM
//
// * Bit 1: When clear, the LPOSC output is XORed into the TRNG
// ROSC output as an additional, uncorrelated entropy source. When
+12 -24
View File
@@ -36,8 +36,7 @@
#define TICKS_PROC0_CTRL_ENABLE_ACCESS "RW"
// =============================================================================
// Register : TICKS_PROC0_CYCLES
// Description : None
// Total number of clk_tick cycles before the next tick.
// Description : Total number of clk_tick cycles before the next tick.
#define TICKS_PROC0_CYCLES_OFFSET _u(0x00000004)
#define TICKS_PROC0_CYCLES_BITS _u(0x000001ff)
#define TICKS_PROC0_CYCLES_RESET _u(0x00000000)
@@ -46,8 +45,7 @@
#define TICKS_PROC0_CYCLES_ACCESS "RW"
// =============================================================================
// Register : TICKS_PROC0_COUNT
// Description : None
// Count down timer: the remaining number clk_tick cycles before
// Description : Count down timer: the remaining number clk_tick cycles before
// the next tick is generated.
#define TICKS_PROC0_COUNT_OFFSET _u(0x00000008)
#define TICKS_PROC0_COUNT_BITS _u(0x000001ff)
@@ -79,8 +77,7 @@
#define TICKS_PROC1_CTRL_ENABLE_ACCESS "RW"
// =============================================================================
// Register : TICKS_PROC1_CYCLES
// Description : None
// Total number of clk_tick cycles before the next tick.
// Description : Total number of clk_tick cycles before the next tick.
#define TICKS_PROC1_CYCLES_OFFSET _u(0x00000010)
#define TICKS_PROC1_CYCLES_BITS _u(0x000001ff)
#define TICKS_PROC1_CYCLES_RESET _u(0x00000000)
@@ -89,8 +86,7 @@
#define TICKS_PROC1_CYCLES_ACCESS "RW"
// =============================================================================
// Register : TICKS_PROC1_COUNT
// Description : None
// Count down timer: the remaining number clk_tick cycles before
// Description : Count down timer: the remaining number clk_tick cycles before
// the next tick is generated.
#define TICKS_PROC1_COUNT_OFFSET _u(0x00000014)
#define TICKS_PROC1_COUNT_BITS _u(0x000001ff)
@@ -122,8 +118,7 @@
#define TICKS_TIMER0_CTRL_ENABLE_ACCESS "RW"
// =============================================================================
// Register : TICKS_TIMER0_CYCLES
// Description : None
// Total number of clk_tick cycles before the next tick.
// Description : Total number of clk_tick cycles before the next tick.
#define TICKS_TIMER0_CYCLES_OFFSET _u(0x0000001c)
#define TICKS_TIMER0_CYCLES_BITS _u(0x000001ff)
#define TICKS_TIMER0_CYCLES_RESET _u(0x00000000)
@@ -132,8 +127,7 @@
#define TICKS_TIMER0_CYCLES_ACCESS "RW"
// =============================================================================
// Register : TICKS_TIMER0_COUNT
// Description : None
// Count down timer: the remaining number clk_tick cycles before
// Description : Count down timer: the remaining number clk_tick cycles before
// the next tick is generated.
#define TICKS_TIMER0_COUNT_OFFSET _u(0x00000020)
#define TICKS_TIMER0_COUNT_BITS _u(0x000001ff)
@@ -165,8 +159,7 @@
#define TICKS_TIMER1_CTRL_ENABLE_ACCESS "RW"
// =============================================================================
// Register : TICKS_TIMER1_CYCLES
// Description : None
// Total number of clk_tick cycles before the next tick.
// Description : Total number of clk_tick cycles before the next tick.
#define TICKS_TIMER1_CYCLES_OFFSET _u(0x00000028)
#define TICKS_TIMER1_CYCLES_BITS _u(0x000001ff)
#define TICKS_TIMER1_CYCLES_RESET _u(0x00000000)
@@ -175,8 +168,7 @@
#define TICKS_TIMER1_CYCLES_ACCESS "RW"
// =============================================================================
// Register : TICKS_TIMER1_COUNT
// Description : None
// Count down timer: the remaining number clk_tick cycles before
// Description : Count down timer: the remaining number clk_tick cycles before
// the next tick is generated.
#define TICKS_TIMER1_COUNT_OFFSET _u(0x0000002c)
#define TICKS_TIMER1_COUNT_BITS _u(0x000001ff)
@@ -208,8 +200,7 @@
#define TICKS_WATCHDOG_CTRL_ENABLE_ACCESS "RW"
// =============================================================================
// Register : TICKS_WATCHDOG_CYCLES
// Description : None
// Total number of clk_tick cycles before the next tick.
// Description : Total number of clk_tick cycles before the next tick.
#define TICKS_WATCHDOG_CYCLES_OFFSET _u(0x00000034)
#define TICKS_WATCHDOG_CYCLES_BITS _u(0x000001ff)
#define TICKS_WATCHDOG_CYCLES_RESET _u(0x00000000)
@@ -218,8 +209,7 @@
#define TICKS_WATCHDOG_CYCLES_ACCESS "RW"
// =============================================================================
// Register : TICKS_WATCHDOG_COUNT
// Description : None
// Count down timer: the remaining number clk_tick cycles before
// Description : Count down timer: the remaining number clk_tick cycles before
// the next tick is generated.
#define TICKS_WATCHDOG_COUNT_OFFSET _u(0x00000038)
#define TICKS_WATCHDOG_COUNT_BITS _u(0x000001ff)
@@ -251,8 +241,7 @@
#define TICKS_RISCV_CTRL_ENABLE_ACCESS "RW"
// =============================================================================
// Register : TICKS_RISCV_CYCLES
// Description : None
// Total number of clk_tick cycles before the next tick.
// Description : Total number of clk_tick cycles before the next tick.
#define TICKS_RISCV_CYCLES_OFFSET _u(0x00000040)
#define TICKS_RISCV_CYCLES_BITS _u(0x000001ff)
#define TICKS_RISCV_CYCLES_RESET _u(0x00000000)
@@ -261,8 +250,7 @@
#define TICKS_RISCV_CYCLES_ACCESS "RW"
// =============================================================================
// Register : TICKS_RISCV_COUNT
// Description : None
// Count down timer: the remaining number clk_tick cycles before
// Description : Count down timer: the remaining number clk_tick cycles before
// the next tick is generated.
#define TICKS_RISCV_COUNT_OFFSET _u(0x00000044)
#define TICKS_RISCV_COUNT_BITS _u(0x000001ff)
+4 -3
View File
@@ -1082,13 +1082,14 @@
#define USB_SIE_STATUS_SPEED_ACCESS "RO"
// -----------------------------------------------------------------------------
// Field : USB_SIE_STATUS_SUSPENDED
// Description : Bus in suspended state. Valid for device. Device will go into
// suspend if neither Keep Alive / SOF frames are enabled.
// Description : Bus in suspended state. Valid for device and host. Host and
// device will go into suspend if neither Keep Alive / SOF frames
// are enabled.
#define USB_SIE_STATUS_SUSPENDED_RESET _u(0x0)
#define USB_SIE_STATUS_SUSPENDED_BITS _u(0x00000010)
#define USB_SIE_STATUS_SUSPENDED_MSB _u(4)
#define USB_SIE_STATUS_SUSPENDED_LSB _u(4)
#define USB_SIE_STATUS_SUSPENDED_ACCESS "WC"
#define USB_SIE_STATUS_SUSPENDED_ACCESS "RO"
// -----------------------------------------------------------------------------
// Field : USB_SIE_STATUS_LINE_STATE
// Description : USB bus line state
@@ -24,7 +24,6 @@
// BITMASK [BITRANGE] FIELDNAME (RESETVALUE) DESCRIPTION
/** \brief Bus fabric performance counters on RP2350 (used as typedef \ref bus_ctrl_perf_counter_t)
* \ingroup hardware_busctrl
*/
typedef enum bus_ctrl_perf_counter_rp2350 {
arbiter_rom_perf_event_access = 19,
@@ -137,14 +137,14 @@ typedef struct {
_REG_(POWMAN_STATE_OFFSET) // POWMAN_STATE
// This register controls the power state of the 4 power domains
// 0x00002000 [13] CHANGING (0)
// 0x00001000 [12] WAITING (0)
// 0x00000800 [11] BAD_HW_REQ (0) Bad hardware initiated state request
// 0x00000400 [10] BAD_SW_REQ (0) Bad software initiated state request
// 0x00000200 [9] PWRUP_WHILE_WAITING (0) Request ignored because of a pending pwrup request
// 0x00000100 [8] REQ_IGNORED (0)
// 0x000000f0 [7:4] REQ (0x0)
// 0x0000000f [3:0] CURRENT (0xf)
// 0x00002000 [13] CHANGING (0) Indicates a power state change is in progress
// 0x00001000 [12] WAITING (0) Indicates the power manager has received a state change...
// 0x00000800 [11] BAD_HW_REQ (0) Invalid hardware initiated state request, power up...
// 0x00000400 [10] BAD_SW_REQ (0) Invalid software initiated state request ignored
// 0x00000200 [9] PWRUP_WHILE_WAITING (0) Indicates that a power state change request was ignored...
// 0x00000100 [8] REQ_IGNORED (0) Indicates that a software state change request was...
// 0x000000f0 [7:4] REQ (0x0) This is written by software or hardware to request a new...
// 0x0000000f [3:0] CURRENT (0xf) Indicates the current power state
io_rw_32 state;
_REG_(POWMAN_POW_FASTDIV_OFFSET) // POWMAN_POW_FASTDIV
+2 -2
View File
@@ -35,9 +35,9 @@ typedef struct {
// 0xffff0000 [31:16] PASSWD (0x0000) Set to 0x9696 to apply the settings +
// 0x00007000 [14:12] DS3 (0x0) Stage 3 drive strength
// 0x00000700 [10:8] DS2 (0x0) Stage 2 drive strength
// 0x00000080 [7] DS1_RANDOM (0) Randomises the stage 1 drive strength
// 0x00000080 [7] DS1_RANDOM (1) Randomises the stage 1 drive strength
// 0x00000070 [6:4] DS1 (0x0) Stage 1 drive strength
// 0x00000008 [3] DS0_RANDOM (0) Randomises the stage 0 drive strength
// 0x00000008 [3] DS0_RANDOM (1) Randomises the stage 0 drive strength
// 0x00000007 [2:0] DS0 (0x0) Stage 0 drive strength
io_rw_32 freqa;
@@ -72,7 +72,7 @@ typedef struct {
_REG_(SYSCFG_AUXCTRL_OFFSET) // SYSCFG_AUXCTRL
// Auxiliary system control register
// 0x000000ff [7:0] AUXCTRL (0x00) * Bits 7:2: Reserved
// 0x000000ff [7:0] AUXCTRL (0x00) * Bits 7:3: Reserved
io_rw_32 auxctrl;
} syscfg_hw_t;
+2 -2
View File
@@ -5,10 +5,10 @@
// This file may be distributed under the terms of the GNU GPLv3 license.
#include <stdint.h> // uint32_t
#include "boot/picoboot_constants.h" // REBOOT2_FLAG_REBOOT_TYPE_BOOTSEL
#include "hardware/address_mapped.h" // static_assert
#include "boot/bootrom_constants.h" // RT_FLAG_FUNC_ARM_NONSEC
#include "boot/picoboot_constants.h" // REBOOT2_FLAG_REBOOT_TYPE_BOOTSEL
#include "internal.h" // bootrom_read_unique_id
#include "pico/bootrom_constants.h" // RT_FLAG_FUNC_ARM_NONSEC
static void *
rom_func_lookup(uint32_t code)