16 #define BOOTROM_RP2040_MAGIC 0x01754d
18 #define BOOTROM_RP2350_MAGIC 0x02754d
19 #define BOOTROM_MAGIC_MASK 0xffffff
20 #define BOOTROM_MAGIC_ADDR 0x00000010
22 #define MAKE_TAG(a, b) (((b)<<8) | a)
23 #define FUNC_FLASH_EXIT_XIP MAKE_TAG('E', 'X')
24 #define FUNC_CONNECT_INTERNAL_FLASH MAKE_TAG('I', 'F')
25 #define FUNC_FLASH_RANGE_ERASE MAKE_TAG('R', 'E')
26 #define FUNC_FLASH_RANGE_PROGRAM MAKE_TAG('R', 'P')
27 #define FUNC_FLASH_FLUSH_CACHE MAKE_TAG('F', 'C')
28 #define FUNC_FLASH_ENTER_CMD_XIP MAKE_TAG('C', 'X')
29 #define FUNC_BOOTROM_STATE_RESET MAKE_TAG('S', 'R')
30 #define FUNC_BOOTROM_SET_STACK MAKE_TAG('S', 'S')
31 #define FUNC_FLASH_RESET_ADDRESS_TRANS MAKE_TAG('R', 'A')
34 #define RT_FLAG_FUNC_RISCV 0x01
35 #define RT_FLAG_FUNC_ARM_SEC 0x04
36 #define RT_FLAG_FUNC_ARM_NONSEC 0x10
37 #define RT_FLAG_DATA 0x40
40 #define BOOTROM_STATE_RESET_CURRENT_CORE 0x01
41 #define BOOTROM_STATE_RESET_OTHER_CORE 0x02
42 #define BOOTROM_STATE_RESET_GLOBAL_STATE 0x04
44 #define ACCESSCTRL_LOCK_OFFSET 0x40060000u
45 #define ACCESSCTRL_LOCK_DEBUG_BITS 0x00000008u
46 #define ACCESSCTRL_CFGRESET_OFFSET 0x40060008u
47 #define ACCESSCTRL_WRITE_PASSWORD 0xacce0000u
49 #define RP2040_SSI_DR0 0x18000060
50 #define RP2040_QSPI_CTRL 0x4001800c
52 #define RP2040_QSPI_CTRL_OUTOVER_MASK (3ul << 8)
53 #define RP2040_QSPI_CTRL_OUTOVER_LOW (2ul << 8)
54 #define RP2040_QSPI_CTRL_OUTOVER_HIGH (3ul << 8)
56 #define RP2350_QMI_DIRECT_CSR 0x400d0000
57 #define RP2350_QMI_DIRECT_TX 0x400d0004
58 #define RP2350_QMI_DIRECT_RX 0x400d0008
60 #define RP2350_QMI_DIRECT_CSR_EN BIT(0)
61 #define RP2350_QMI_DIRECT_CSR_ASSERT_CS0N BIT(2)
62 #define RP2350_QMI_DIRECT_TX_NOPUSH BIT(20)
63 #define RP2350_QMI_DIRECT_TX_OE BIT(19)
65 #define RP2XXX_SYSINFO_CHIP_ID 0x40000000
66 #define RP2XXX_CHIP_ID_PART_MANUFACTURER(id) ((id) & 0x0fffffff)
67 #define RP2XXX_CHIP_ID_MANUFACTURER 0x493
68 #define RP2XXX_MK_PART(part) (((part) << 12) | (RP2XXX_CHIP_ID_MANUFACTURER << 1) | 1)
69 #define RP2040_CHIP_ID_PART 0x0002
70 #define IS_RP2040(id) (RP2XXX_CHIP_ID_PART_MANUFACTURER(id) == RP2XXX_MK_PART(RP2040_CHIP_ID_PART))
71 #define RP2350_CHIP_ID_PART 0x0004
72 #define IS_RP2350(id) (RP2XXX_CHIP_ID_PART_MANUFACTURER(id) == RP2XXX_MK_PART(RP2350_CHIP_ID_PART))
73 #define RP2XXX_CHIP_ID_REVISION(id) ((id) >> 28)
75 #define RP2XXX_MAX_ALGO_STACK_USAGE 1024
76 #define RP2XXX_MAX_RAM_ALGO_SIZE 1024
78 #define RP2XXX_ROM_API_FIXED_FLASH_PAGE 256
79 #define RP2XXX_ROM_API_FIXED_FLASH_SECTOR 4096
97 0x5f, 0xf4, 0x40, 0x41,
100 0x30, 0xee, 0x10, 0xf7,
103 0x40, 0xec, 0x80, 0x07,
104 0x40, 0xec, 0x81, 0x07,
110 0x88, 0xed, 0x00, 0xe0
116 #define ROM_CALL_BATCH_ALGO_SIZE_BYTES 32
146 0x80, 0xf3, 0x0a, 0x88,
147 0x80, 0xf3, 0x0b, 0x88,
166 0x97, 0x04, 0x00, 0x00,
167 0x93, 0x84, 0x04, 0x02,
171 0x03, 0xa1, 0x44, 0x00,
214 #ifndef LOG_ROM_SYMBOL_DEBUG
215 #define LOG_ROM_SYMBOL_DEBUG LOG_DEBUG
220 LOG_ROM_SYMBOL_DEBUG(
"Looking up ROM symbol '%c%c' in RP2040 table", tag & 0xff, (tag >> 8) & 0xff);
224 LOG_ERROR(
"Only data and Secure Arm functions can be looked up in RP2040 ROM table");
228 uint16_t ptr_to_entry;
229 unsigned int offset_magic_to_table_ptr = flags ==
RT_FLAG_DATA ? 6 : 4;
240 if (entry_tag == tag) {
257 LOG_ROM_SYMBOL_DEBUG(
"Looking up ROM symbol '%c%c' in RP2350 A0 table", tag & 0xff, (tag >> 8) & 0xff);
271 LOG_WARNING(
"Ignoring non-default flags for RP2350 A0 lookup, hope you like Secure Arm functions");
274 uint16_t ptr_to_entry;
275 const unsigned int offset_magic_to_table_ptr = 4;
286 if (entry_tag == tag) {
301 uint16_t tag, uint16_t flags, uint16_t *symbol_out)
303 LOG_ROM_SYMBOL_DEBUG(
"Looking up ROM symbol '%c%c' in RP2350 A1 table", tag & 0xff, (tag >> 8) & 0xff);
311 uint16_t entry_tag, entry_flags;
317 if (entry_tag == 0) {
329 uint16_t matching_flags = flags & entry_flags;
331 if (tag == entry_tag && matching_flags != 0) {
334 while (!(matching_flags & 1)) {
338 matching_flags >>= 1;
344 *symbol_out = ptr_to_entry;
355 while (entry_flags) {
382 if (table_ptr < 0x7c00)
390 LOG_ERROR(
"RP2040/RP2350 BOOT ROM not found");
400 symtype_func, &
priv->jump_flash_exit_xip);
402 LOG_ERROR(
"Function FUNC_FLASH_EXIT_XIP not found in RP2xxx ROM");
407 symtype_func, &
priv->jump_connect_internal_flash);
409 LOG_ERROR(
"Function FUNC_CONNECT_INTERNAL_FLASH not found in RP2xxx ROM");
415 LOG_ERROR(
"Function FUNC_FLASH_RANGE_ERASE not found in RP2xxx ROM");
421 LOG_ERROR(
"Function FUNC_FLASH_RANGE_PROGRAM not found in RP2xxx ROM");
427 LOG_ERROR(
"Function FUNC_FLASH_FLUSH_CACHE not found in RP2xxx ROM");
433 LOG_ERROR(
"Function FUNC_FLASH_ENTER_CMD_XIP not found in RP2xxx ROM");
440 priv->jump_bootrom_reset_state = 0;
441 priv->jump_flash_reset_address_trans = 0;
447 priv->jump_bootrom_reset_state = 0;
448 LOG_WARNING(
"Function FUNC_BOOTROM_STATE_RESET not found in RP2xxx ROM. (probably an RP2350 A0)");
453 &
priv->jump_bootrom_set_varm_stack);
455 priv->jump_bootrom_set_varm_stack = 0;
456 LOG_WARNING(
"Function FUNC_BOOTROM_SET_STACK not found in RP2xxx ROM. (probably an RP2350 A0)");
461 symtype_func, &
priv->jump_flash_reset_address_trans);
463 priv->jump_flash_reset_address_trans = 0;
464 LOG_WARNING(
"Function FUNC_FLASH_RESET_ADDRESS_TRANS not found in RP2xxx ROM. (probably an RP2350 A0)");
479 if (!
priv->ram_algo_space) {
480 LOG_ERROR(
"No RAM code space allocated for ROM call");
483 if (
priv->ram_algo_space->size < batch_size) {
484 LOG_ERROR(
"RAM code space too small for call batch size of %u", n_calls);
489 for (
unsigned int i = 0; i < n_calls; ++i) {
492 for (
unsigned int j = 0; j < 4; ++j)
497 LOG_DEBUG(
"Returning early from call of 0 ROM functions");
501 const uint8_t *algo_code;
504 LOG_DEBUG(
"Using algo: rp2xxx_rom_call_batch_algo_armv8m");
507 LOG_DEBUG(
"Using algo: rp2xxx_rom_call_batch_algo_armv6m");
511 LOG_DEBUG(
"Using algo: rp2xxx_rom_call_batch_algo_riscv");
515 uint8_t *batch_bf = malloc(batch_size);
525 (
const uint32_t *)calls);
530 priv->ram_algo_space->address,
537 LOG_ERROR(
"Failed to write ROM batch algorithm to RAM code space");
545 unsigned int algo_timeout_ms = 3000;
553 algo_start_addr, algo_end_addr,
562 algo_start_addr, algo_end_addr,
568 LOG_ERROR(
"Failed to call ROM function batch");
582 uint16_t func_offset, uint32_t argdata[],
unsigned int n_args)
587 LOG_ERROR(
"no stack for flash programming code");
596 for (
unsigned int i = 0; i < n_args; ++i)
597 call.
args[i] = argdata[i];
607 uint32_t accessctrl_lock_reg;
609 LOG_ERROR(
"Failed to read ACCESSCTRL lock register");
619 LOG_ERROR(
"ACCESSCTRL is locked, so can't reset permissions. Following steps might fail");
621 LOG_DEBUG(
"Reset ACCESSCTRL permissions via CFGRESET");
636 LOG_ERROR(
"RP2350 init ARM core: DSCSR read failed");
642 LOG_DEBUG(
"Setting Current Domain Secure in DSCSR");
645 LOG_ERROR(
"RP2350 init ARM core: DSCSR read failed");
651 LOG_ERROR(
"No stack for flash programming code");
656 LOG_ERROR(
"No algorithm space for rcp_init code");
661 priv->ram_algo_space->address,
667 LOG_ERROR(
"Failed to load rcp_init algorithm into RAM");
672 priv->ram_algo_space->address);
681 priv->ram_algo_space->address,
702 LOG_ERROR(
"Could not allocate stack for flash programming code -- insufficient space");
707 if (!
priv->ram_algo_space) {
710 LOG_ERROR(
"Could not allocate RAM code space for ROM calls -- insufficient space");
718 LOG_ERROR(
"Failed to init ACCESSCTRL before ROM call");
724 LOG_ERROR(
"Failed to init Arm core 0 before ROM call");
728 uint32_t reset_args[1] = {
731 if (!
priv->jump_bootrom_reset_state) {
732 LOG_WARNING(
"RP2350 flash: no bootrom_reset_method");
741 LOG_ERROR(
"RP2350 flash: failed to call reset core state");
749 LOG_DEBUG(
"Enabling default Arm emulator stacks for RISC-V ROM calls");
753 LOG_ERROR(
"Failed to allocate memory for arguments to set_varmulet_user_stack()");
762 LOG_ERROR(
"Failed to initialise memory arguments for set_varmulet_user_stack()");
767 uint32_t set_stack_register_args[1] = {
771 set_stack_register_args,
ARRAY_SIZE(set_stack_register_args));
774 LOG_ERROR(
"Failed to initialise Arm emulation stacks for RISC-V");
780 LOG_DEBUG(
"Connecting flash IOs and issuing XIP exit sequence to flash");
783 .
pc =
priv->jump_connect_internal_flash,
784 .sp =
priv->stack->address +
priv->stack->size
787 .pc =
priv->jump_flash_exit_xip,
788 .sp =
priv->stack->address +
priv->stack->size
793 LOG_ERROR(
"RP2xxx flash: failed to exit flash XIP mode");
806 LOG_DEBUG(
"Flushing flash cache after write behind");
810 .
pc =
priv->jump_flush_cache,
811 .sp =
priv->stack->address +
priv->stack->size
814 .sp =
priv->stack->address +
priv->stack->size
818 int num_finishing_calls = 1;
823 finishing_calls[num_finishing_calls++].
pc =
priv->jump_enter_cmd_xip;
824 }
else if (
priv->jump_flash_reset_address_trans) {
826 finishing_calls[num_finishing_calls++].
pc =
priv->jump_flash_reset_address_trans;
831 LOG_ERROR(
"RP2xxx: failed to flush flash cache/restore XIP");
842 LOG_DEBUG(
"Cleaning up after flash operations");
847 if (
priv->ram_algo_space) {
849 priv->ram_algo_space = 0;
869 goto cleanup_and_return;
877 LOG_ERROR(
"Could not allocate bounce buffer for flash programming. Can't continue");
878 goto cleanup_and_return;
884 uint32_t write_size =
count > chunk_size ? chunk_size :
count;
885 LOG_DEBUG(
"Writing %" PRIu32
" bytes to offset 0x%" PRIx32,
889 LOG_ERROR(
"Could not load data into target bounce buffer");
901 LOG_ERROR(
"Failed to invoke flash programming code on target");
930 uint32_t offset_start =
bank->sectors[first].offset;
931 uint32_t offset_last =
bank->sectors[last].offset +
bank->sectors[last].size;
932 uint32_t
length = offset_last - offset_start;
933 LOG_DEBUG(
"erase %" PRIu32
" bytes starting at 0x%" PRIx32,
938 goto cleanup_and_return;
940 uint32_t offset_next = offset_start;
945 const uint32_t erase_chunk_size = 128 * 1024;
948 bool requires_loud_prints = offset_last - offset_next >= 2 * erase_chunk_size;
951 while (offset_next < offset_last) {
952 uint32_t remaining = offset_last - offset_next;
953 uint32_t call_size = remaining < erase_chunk_size ? remaining : erase_chunk_size;
955 if (offset_next % erase_chunk_size != 0 && call_size == erase_chunk_size)
956 call_size = erase_chunk_size - offset_next % erase_chunk_size;
959 " Erase chunk: 0x%08" PRIx32
" -> 0x%08" PRIx32,
961 offset_next + call_size - 1
980 offset_next += call_size;
1015 const uint8_t *tx,
unsigned int tx_len,
1016 unsigned int dummy_len,
1017 uint8_t *rx,
unsigned int rx_len)
1019 int retval, retval2;
1027 unsigned int tx_cnt = 0;
1028 unsigned int rx_cnt = 0;
1029 unsigned int xfer_len = tx_len + dummy_len + rx_len;
1030 while (rx_cnt < xfer_len) {
1031 int in_flight = tx_cnt - rx_cnt;
1032 if (tx_cnt < xfer_len && in_flight < 14) {
1033 uint32_t
dr = tx_cnt < tx_len ? tx[tx_cnt] : 0;
1046 if (rx_cnt >= tx_len + dummy_len)
1047 rx[rx_cnt - tx_len - dummy_len] = (uint8_t)
dr;
1066 const uint8_t *tx,
unsigned int tx_len,
1067 unsigned int dummy_len,
1068 uint8_t *rx,
unsigned int rx_len)
1070 uint32_t direct_csr;
1073 LOG_ERROR(
"QMI DIRECT_CSR read failed");
1079 LOG_ERROR(
"QMI DIRECT mode enable failed");
1083 unsigned int tx_cnt = 0;
1084 unsigned int rx_cnt = 0;
1085 unsigned int xfer_len = tx_len + dummy_len + rx_len;
1086 while (tx_cnt < xfer_len || rx_cnt < rx_len) {
1087 int in_flight = tx_cnt - tx_len - dummy_len - rx_cnt;
1088 if (tx_cnt < xfer_len && in_flight < 4) {
1090 if (tx_cnt < tx_len)
1092 else if (tx_cnt < tx_len + dummy_len)
1104 if (rx_cnt < rx_len) {
1110 rx[rx_cnt] = (uint8_t)
dr;
1124 LOG_ERROR(
"QMI DIRECT mode disable failed");
1130 const uint8_t *tx,
unsigned int tx_len,
1131 unsigned int dummy_len,
1132 uint8_t *rx,
unsigned int rx_len)
1146 unsigned int words, uint32_t *
buffer)
1151 uint8_t data[4 * words +
priv->sfdp_dummy_detect];
1156 data, 4 * words +
priv->sfdp_dummy_detect);
1160 if (
priv->sfdp_dummy_detect) {
1161 for (
unsigned int i = 0; i <
priv->sfdp_dummy_detect; i++)
1163 priv->sfdp_dummy_detect = 0;
1164 priv->sfdp_dummy = i;
1167 for (
unsigned int i = 0; i < words; i++)
1170 for (
unsigned int i = 0; i < words; i++)
1183 LOG_ERROR(
"SYSINFO CHIP_ID read failed");
1187 LOG_ERROR(
"Unknown SYSINFO CHIP_ID 0x%08" PRIx32,
priv->id);
1199 uint32_t flash_id = 0;
1200 if (
priv->size_override) {
1201 priv->spi_dev.name =
"size override";
1202 LOG_DEBUG(
"SPI flash autodetection disabled, using configured size");
1222 if (p->device_id == flash_id) {
1224 bank->size = p->size_in_bytes;
1230 if (
bank->size == 0) {
1231 priv->sfdp_dummy_detect = 8;
1232 priv->sfdp_dummy = 0;
1235 bank->size =
priv->spi_dev.size_in_bytes;
1241 snprintf(
priv->dev_name,
sizeof(
priv->dev_name),
"%s rev %u",
1245 if (
bank->size == 0) {
1246 LOG_ERROR(
"%s, QSPI Flash id = 0x%06" PRIx32
" not recognised",
1247 priv->dev_name, flash_id);
1253 if (
priv->size_override) {
1254 LOG_INFO(
"%s, QSPI Flash size override = %u KiB in %u sectors",
1257 LOG_INFO(
"%s, QSPI Flash %s id = 0x%06" PRIx32
" size = %u KiB in %u sectors",
1258 priv->dev_name,
priv->spi_dev.name, flash_id,
1259 bank->size / 1024,
bank->num_sectors);
1262 free(
bank->sectors);
1267 priv->probed =
true;
1289 priv->size_override =
bank->size != 0;
1328 uint32_t args[4] = { 0 };
1340 goto cleanup_and_return;
1350 goto cleanup_and_return;
1386 if (
bank->target == old_target) {
1387 bank->target = new_target;
1389 priv->probed =
false;
1391 }
else if (
bank->target == new_target) {
1397 command_print(
CMD,
"Neither old nor new target %s found in flash bank list",
1404 .
name =
"rom_api_call",
1406 .help =
"arbitrary ROM API call",
1407 .usage =
"fc [p0 [p1 [p2 [p3]]]]",
1408 .handler = rp2xxx_rom_api_call_handler,
1411 .name =
"_switch_target",
1413 .help =
"internal use",
1414 .usage =
"old_target new_target",
1415 .handler = rp2xxx_switch_target_handler,
1424 .help =
"rp2xxx flash controller commands",
1434 .flash_bank_command = rp2xxx_flash_bank_command,
static bool is_arm(struct arm *arm)
static struct arm * target_to_arm(const struct target *target)
Convert target handle to generic ARM target state handle.
#define ARMV7M_COMMON_MAGIC
Support functions to access arbitrary bits in a byte array.
void command_print(struct command_invocation *cmd, const char *format,...)
#define CMD
Use this macro to access the command being handled, rather than accessing the variable directly.
#define CMD_ARGV
Use this macro to access the arguments for the command being handled, rather than accessing the varia...
#define ERROR_COMMAND_SYNTAX_ERROR
#define CMD_ARGC
Use this macro to access the number of arguments for the command being handled, rather than accessing...
#define COMMAND_PARSE_NUMBER(type, in, out)
parses the string in into out as a type, or prints a command error and passes the error code to the c...
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
#define ERROR_COMMAND_ARGUMENT_INVALID
uint64_t buffer
Pointer to data buffer to send over SPI.
static struct esp_usb_jtag * priv
#define ERROR_FLASH_BANK_INVALID
struct flash_sector * alloc_block_array(uint32_t offset, uint32_t size, unsigned int num_blocks)
Allocate and fill an array of sectors or protection blocks.
int default_flash_blank_check(struct flash_bank *bank)
Provides default erased-bank check handling.
int default_flash_read(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
Provides default read implementation for flash memory.
void default_flash_free_driver_priv(struct flash_bank *bank)
Deallocates bank->driver_priv.
struct flash_bank * flash_bank_list(void)
#define LOG_CUSTOM_LEVEL(level, expr ...)
#define LOG_WARNING(expr ...)
#define ERROR_BUF_TOO_SMALL
#define LOG_TARGET_DEBUG(target, fmt_str,...)
#define LOG_ERROR(expr ...)
#define LOG_INFO(expr ...)
#define LOG_DEBUG(expr ...)
#define RP2350_QMI_DIRECT_CSR
#define RP2040_QSPI_CTRL_OUTOVER_LOW
static const uint8_t rp2xxx_rom_call_batch_algo_riscv[ROM_CALL_BATCH_ALGO_SIZE_BYTES]
#define RP2350_QMI_DIRECT_RX
#define LOG_ROM_SYMBOL_DEBUG
#define RP2350_QMI_DIRECT_TX
#define FUNC_FLASH_RANGE_ERASE
static int rp2350_init_arm_core0(struct target *target, struct rp2xxx_flash_bank *priv)
static int rp2350_a0_lookup_symbol(struct target *target, uint16_t tag, uint16_t flags, uint16_t *symbol_out)
static const struct command_registration rp2xxx_command_handler[]
static const int rp2xxx_rom_call_batch_algo_bkpt_offset
#define BOOTROM_RP2350_MAGIC
static int rp2xxx_call_rom_func(struct target *target, struct rp2xxx_flash_bank *priv, uint16_t func_offset, uint32_t argdata[], unsigned int n_args)
#define RP2040_QSPI_CTRL_OUTOVER_MASK
#define RT_FLAG_FUNC_RISCV
#define FUNC_FLASH_FLUSH_CACHE
static const uint8_t rcp_init_code[]
static int rp2xxx_flash_probe(struct flash_bank *bank)
static int rp2xxx_invalidate_cache_restore_xip(struct target *target, struct rp2xxx_flash_bank *priv)
#define RP2040_QSPI_CTRL_OUTOVER_HIGH
const struct flash_driver rp2xxx_flash
#define FUNC_FLASH_RESET_ADDRESS_TRANS
#define RP2350_QMI_DIRECT_CSR_EN
#define ROM_CALL_BATCH_ALGO_SIZE_BYTES
#define FUNC_FLASH_EXIT_XIP
static const struct command_registration rp2xxx_exec_command_handlers[]
COMMAND_HANDLER(rp2xxx_rom_api_call_handler)
#define ACCESSCTRL_WRITE_PASSWORD
#define FUNC_BOOTROM_SET_STACK
#define RP2XXX_CHIP_ID_REVISION(id)
#define BOOTROM_STATE_RESET_CURRENT_CORE
static int rp2350_spi_tx_rx(struct target *target, const uint8_t *tx, unsigned int tx_len, unsigned int dummy_len, uint8_t *rx, unsigned int rx_len)
static int rp2040_spi_tx_rx(struct target *target, const uint8_t *tx, unsigned int tx_len, unsigned int dummy_len, uint8_t *rx, unsigned int rx_len)
static void cleanup_after_raw_flash_cmd(struct target *target, struct rp2xxx_flash_bank *priv)
static int rp2xxx_spi_tx_rx(struct flash_bank *bank, const uint8_t *tx, unsigned int tx_len, unsigned int dummy_len, uint8_t *rx, unsigned int rx_len)
#define ACCESSCTRL_LOCK_DEBUG_BITS
#define RT_FLAG_FUNC_ARM_SEC
static int rp2xxx_call_rom_func_batch(struct target *target, struct rp2xxx_flash_bank *priv, struct rp2xxx_rom_call_batch_record *calls, unsigned int n_calls)
#define FUNC_BOOTROM_STATE_RESET
#define RP2XXX_MAX_RAM_ALGO_SIZE
FLASH_BANK_COMMAND_HANDLER(rp2xxx_flash_bank_command)
#define ACCESSCTRL_CFGRESET_OFFSET
#define ACCESSCTRL_LOCK_OFFSET
#define FUNC_CONNECT_INTERNAL_FLASH
#define RP2XXX_ROM_API_FIXED_FLASH_PAGE
static int rp2xxx_flash_auto_probe(struct flash_bank *bank)
static int rp2xxx_populate_rom_pointer_cache(struct target *target, struct rp2xxx_flash_bank *priv)
#define RP2350_QMI_DIRECT_TX_OE
#define BOOTROM_MAGIC_ADDR
static int rp2xxx_flash_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
static const uint8_t rp2xxx_rom_call_batch_algo_armv6m[ROM_CALL_BATCH_ALGO_SIZE_BYTES]
#define RP2XXX_ROM_API_FIXED_FLASH_SECTOR
static int rp2350_lookup_rom_symbol(struct target *target, uint32_t ptr_to_entry, uint16_t tag, uint16_t flags, uint16_t *symbol_out)
static int rp2350_init_accessctrl(struct target *target)
#define RP2XXX_MAX_ALGO_STACK_USAGE
#define BOOTROM_MAGIC_MASK
#define FUNC_FLASH_RANGE_PROGRAM
#define BOOTROM_RP2040_MAGIC
static const int rcp_init_code_bkpt_offset
#define RP2350_QMI_DIRECT_TX_NOPUSH
static int rp2040_ssel_active(struct target *target, bool active)
static int rp2xxx_read_sfdp_block(struct flash_bank *bank, uint32_t addr, unsigned int words, uint32_t *buffer)
#define RP2XXX_SYSINFO_CHIP_ID
#define RP2350_QMI_DIRECT_CSR_ASSERT_CS0N
static int rp2040_lookup_rom_symbol(struct target *target, uint16_t tag, uint16_t flags, uint16_t *symbol_out)
static int setup_for_raw_flash_cmd(struct target *target, struct rp2xxx_flash_bank *priv)
static int rp2xxx_flash_erase(struct flash_bank *bank, unsigned int first, unsigned int last)
static int rp2xxx_lookup_rom_symbol(struct target *target, uint16_t tag, uint16_t flags, uint16_t *symbol_out)
static const uint8_t rp2xxx_rom_call_batch_algo_armv8m[ROM_CALL_BATCH_ALGO_SIZE_BYTES]
#define FUNC_FLASH_ENTER_CMD_XIP
target_addr_t addr
Start address to search for the control block.
int spi_sfdp(struct flash_bank *bank, struct flash_device *dev, read_sfdp_block_t read_sfdp_block)
const struct flash_device flash_devices[]
#define SPIFLASH_READ_SFDP
unsigned int common_magic
Provides details of a flash bank, available either on-chip or through a major interface.
Provides the implementation-independent structure that defines all of the callbacks required by OpenO...
const char * name
Gives a human-readable name of this flash driver, This field is used to select and initialize the dri...
uint16_t jump_connect_internal_flash
uint16_t jump_flash_reset_address_trans
uint16_t jump_flash_range_erase
uint16_t jump_bootrom_reset_state
uint16_t jump_enter_cmd_xip
struct working_area * stack
unsigned int sfdp_dummy_detect
struct working_area * ram_algo_space
uint16_t jump_flush_cache
uint16_t jump_flash_exit_xip
struct flash_device spi_dev
uint16_t jump_bootrom_set_varm_stack
uint16_t jump_flash_range_program
struct target * get_target(const char *id)
void target_buffer_set_u32(struct target *target, uint8_t *buffer, uint32_t value)
int target_write_buffer(struct target *target, target_addr_t address, uint32_t size, const uint8_t *buffer)
int target_run_algorithm(struct target *target, int num_mem_params, struct mem_param *mem_params, int num_reg_params, struct reg_param *reg_param, target_addr_t entry_point, target_addr_t exit_point, unsigned int timeout_ms, void *arch_info)
Downloads a target-specific native code algorithm to the target, and executes it.
int target_write_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
Write count items of size bytes to the memory of target at the address given.
uint32_t target_get_working_area_avail(struct target *target)
int target_alloc_working_area(struct target *target, uint32_t size, struct working_area **area)
int target_write_u32(struct target *target, target_addr_t address, uint32_t value)
int target_free_working_area(struct target *target, struct working_area *area)
Free a working area.
int target_read_u16(struct target *target, target_addr_t address, uint16_t *value)
int target_read_u32(struct target *target, target_addr_t address, uint32_t *value)
struct target * get_current_target(struct command_context *cmd_ctx)
void target_buffer_set_u32_array(struct target *target, uint8_t *buffer, uint32_t count, const uint32_t *srcbuf)
#define ERROR_TARGET_NOT_HALTED
static const char * target_name(const struct target *target)
Returns the instance-specific name of the specified target.
#define ERROR_TARGET_RESOURCE_NOT_AVAILABLE
static uint32_t le_to_h_u24(const uint8_t *buf)
#define ARRAY_SIZE(x)
Compute the number of elements of a variable length array.
static void h_u24_to_be(uint8_t *buf, unsigned int val)
static uint32_t le_to_h_u32(const uint8_t *buf)