OpenOCD
rp2040.c File Reference
Include dependency graph for rp2040.c:

Go to the source code of this file.

Data Structures

struct  rp2040_flash_bank
 

Macros

#define BOOTROM_MAGIC   0x01754d
 
#define BOOTROM_MAGIC_ADDR   0x00000010
 
#define FUNC_CONNECT_INTERNAL_FLASH   MAKE_TAG('I', 'F')
 
#define FUNC_DEBUG_TRAMPOLINE   MAKE_TAG('D', 'T')
 
#define FUNC_DEBUG_TRAMPOLINE_END   MAKE_TAG('D', 'E')
 
#define FUNC_FLASH_ENTER_CMD_XIP   MAKE_TAG('C', 'X')
 
#define FUNC_FLASH_EXIT_XIP   MAKE_TAG('E', 'X')
 
#define FUNC_FLASH_FLUSH_CACHE   MAKE_TAG('F', 'C')
 
#define FUNC_FLASH_RANGE_ERASE   MAKE_TAG('R', 'E')
 
#define FUNC_FLASH_RANGE_PROGRAM   MAKE_TAG('R', 'P')
 
#define MAKE_TAG(a, b)   (((b)<<8) | a)
 

Functions

 FLASH_BANK_COMMAND_HANDLER (rp2040_flash_bank_command)
 
static int rp2040_call_rom_func (struct target *target, struct rp2040_flash_bank *priv, uint16_t func_offset, uint32_t argdata[], unsigned int n_args, unsigned int timeout_ms)
 
static int rp2040_finalize_stack_free (struct flash_bank *bank)
 
static int rp2040_flash_auto_probe (struct flash_bank *bank)
 
static int rp2040_flash_erase (struct flash_bank *bank, unsigned int first, unsigned int last)
 
static void rp2040_flash_free_driver_priv (struct flash_bank *bank)
 
static int rp2040_flash_probe (struct flash_bank *bank)
 
static int rp2040_flash_write (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
 
static uint32_t rp2040_lookup_symbol (struct target *target, uint32_t tag, uint16_t *symbol)
 
static int rp2040_spi_read_flash_id (struct target *target, uint32_t *devid)
 
static int rp2040_ssel_active (struct target *target, bool active)
 
static int rp2040_stack_grab_and_prep (struct flash_bank *bank)
 

Variables

static const struct flash_device rp2040_default_spi_device
 
const struct flash_driver rp2040_flash
 

Macro Definition Documentation

◆ BOOTROM_MAGIC

#define BOOTROM_MAGIC   0x01754d

Definition at line 17 of file rp2040.c.

◆ BOOTROM_MAGIC_ADDR

#define BOOTROM_MAGIC_ADDR   0x00000010

Definition at line 18 of file rp2040.c.

◆ FUNC_CONNECT_INTERNAL_FLASH

#define FUNC_CONNECT_INTERNAL_FLASH   MAKE_TAG('I', 'F')

Definition at line 29 of file rp2040.c.

◆ FUNC_DEBUG_TRAMPOLINE

#define FUNC_DEBUG_TRAMPOLINE   MAKE_TAG('D', 'T')

Definition at line 26 of file rp2040.c.

◆ FUNC_DEBUG_TRAMPOLINE_END

#define FUNC_DEBUG_TRAMPOLINE_END   MAKE_TAG('D', 'E')

Definition at line 27 of file rp2040.c.

◆ FUNC_FLASH_ENTER_CMD_XIP

#define FUNC_FLASH_ENTER_CMD_XIP   MAKE_TAG('C', 'X')

Definition at line 33 of file rp2040.c.

◆ FUNC_FLASH_EXIT_XIP

#define FUNC_FLASH_EXIT_XIP   MAKE_TAG('E', 'X')

Definition at line 28 of file rp2040.c.

◆ FUNC_FLASH_FLUSH_CACHE

#define FUNC_FLASH_FLUSH_CACHE   MAKE_TAG('F', 'C')

Definition at line 32 of file rp2040.c.

◆ FUNC_FLASH_RANGE_ERASE

#define FUNC_FLASH_RANGE_ERASE   MAKE_TAG('R', 'E')

Definition at line 30 of file rp2040.c.

◆ FUNC_FLASH_RANGE_PROGRAM

#define FUNC_FLASH_RANGE_PROGRAM   MAKE_TAG('R', 'P')

Definition at line 31 of file rp2040.c.

◆ MAKE_TAG

#define MAKE_TAG (   a,
 
)    (((b)<<8) | a)

Definition at line 25 of file rp2040.c.

Function Documentation

◆ FLASH_BANK_COMMAND_HANDLER()

FLASH_BANK_COMMAND_HANDLER ( rp2040_flash_bank_command  )

Definition at line 511 of file rp2040.c.

References bank, ERROR_OK, and priv.

◆ rp2040_call_rom_func()

static int rp2040_call_rom_func ( struct target target,
struct rp2040_flash_bank priv,
uint16_t  func_offset,
uint32_t  argdata[],
unsigned int  n_args,
unsigned int  timeout_ms 
)
static

◆ rp2040_finalize_stack_free()

static int rp2040_finalize_stack_free ( struct flash_bank bank)
static

◆ rp2040_flash_auto_probe()

static int rp2040_flash_auto_probe ( struct flash_bank bank)
static

Definition at line 492 of file rp2040.c.

References bank, ERROR_OK, priv, and rp2040_flash_probe().

◆ rp2040_flash_erase()

static int rp2040_flash_erase ( struct flash_bank bank,
unsigned int  first,
unsigned int  last 
)
static

◆ rp2040_flash_free_driver_priv()

static void rp2040_flash_free_driver_priv ( struct flash_bank bank)
static

Definition at line 502 of file rp2040.c.

References bank, and NULL.

◆ rp2040_flash_probe()

◆ rp2040_flash_write()

◆ rp2040_lookup_symbol()

static uint32_t rp2040_lookup_symbol ( struct target target,
uint32_t  tag,
uint16_t *  symbol 
)
static

◆ rp2040_spi_read_flash_id()

static int rp2040_spi_read_flash_id ( struct target target,
uint32_t *  devid 
)
static

◆ rp2040_ssel_active()

static int rp2040_ssel_active ( struct target target,
bool  active 
)
static

Definition at line 328 of file rp2040.c.

References ERROR_OK, state, target_read_u32(), and target_write_u32().

Referenced by rp2040_spi_read_flash_id().

◆ rp2040_stack_grab_and_prep()

static int rp2040_stack_grab_and_prep ( struct flash_bank bank)
static

Variable Documentation

◆ rp2040_default_spi_device

const struct flash_device rp2040_default_spi_device
static
Initial value:
=
FLASH_ID("autodetect disabled", 0x03, 0x00, 0x02, 0xd8, 0xc7, 0, 0x100, 0x10000, 0)
#define FLASH_ID(n, re, qr, pp, es, ces, id, psize, ssize, size)
Definition: spi.h:33

Definition at line 1 of file rp2040.c.

Referenced by rp2040_flash_probe().

◆ rp2040_flash

const struct flash_driver rp2040_flash
Initial value:
= {
.name = "rp2040_flash",
.flash_bank_command = rp2040_flash_bank_command,
.auto_probe = rp2040_flash_auto_probe,
.erase_check = default_flash_blank_check,
.free_driver_priv = rp2040_flash_free_driver_priv
}
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.
static int rp2040_flash_auto_probe(struct flash_bank *bank)
Definition: rp2040.c:492
static int rp2040_flash_probe(struct flash_bank *bank)
Definition: rp2040.c:379
static int rp2040_flash_erase(struct flash_bank *bank, unsigned int first, unsigned int last)
Definition: rp2040.c:278
static int rp2040_flash_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
Definition: rp2040.c:214
static void rp2040_flash_free_driver_priv(struct flash_bank *bank)
Definition: rp2040.c:502

Definition at line 511 of file rp2040.c.