19 #define FLASH_TIMEOUT 8000
39 #include "../../../contrib/loaders/flash/cc26xx/cc26x0_algo.inc"
44 #include "../../../contrib/loaders/flash/cc26xx/cc26x2_algo.inc"
51 uint32_t device_type = 0;
77 uint32_t sector_length;
104 long long elapsed_ms;
115 if (elapsed_ms > 500)
158 LOG_ERROR(
"%s: Failed to load flash helper algorithm",
173 LOG_ERROR(
"%s: Failed to start flash helper algorithm",
233 sizeof(algo_params), (uint8_t *)&algo_params);
286 if ((first == 0) && (last == (
bank->num_sectors - 1))) {
306 sizeof(algo_params), (uint8_t *)&algo_params);
326 long long elapsed_ms;
360 LOG_ERROR(
"Unable to write data to target memory");
371 sizeof(algo_params[index]), (uint8_t *)&algo_params[index]);
386 if (elapsed_ms > 500)
461 num_sectors = value & 0xff;
462 if (num_sectors > max_sectors)
463 num_sectors = max_sectors;
470 bank->num_sectors = num_sectors;
472 bank->write_start_alignment = 0;
473 bank->write_end_alignment = 0;
476 for (
int i = 0; i < num_sectors; i++) {
479 bank->sectors[i].is_erased = -1;
480 bank->sectors[i].is_protected = 0;
531 "%s device: ICEPick ID 0x%08" PRIx32
", USER ID 0x%08" PRIx32
"\n",
539 .flash_bank_command = cc26xx_flash_bank_command,
#define ARMV7M_COMMON_MAGIC
static const struct device_t * device
Support functions to access arbitrary bits in a byte array.
static void buf_set_u32(uint8_t *_buffer, unsigned first, unsigned num, uint32_t value)
Sets num bits in _buffer, starting at the first bit, using the bits in value.
static const uint8_t cc26x0_algo[]
static uint32_t cc26xx_sector_length(uint32_t icepick_id)
static int cc26xx_quit(struct flash_bank *bank)
FLASH_BANK_COMMAND_HANDLER(cc26xx_flash_bank_command)
static int cc26xx_probe(struct flash_bank *bank)
static int cc26xx_info(struct flash_bank *bank, struct command_invocation *cmd)
static const uint8_t cc26x2_algo[]
static int cc26xx_auto_probe(struct flash_bank *bank)
static int cc26xx_init(struct flash_bank *bank)
static int cc26xx_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
static int cc26xx_mass_erase(struct flash_bank *bank)
const struct flash_driver cc26xx_flash
static uint32_t cc26xx_device_type(uint32_t icepick_id, uint32_t user_id)
static int cc26xx_erase(struct flash_bank *bank, unsigned int first, unsigned int last)
static int cc26xx_wait_algo_done(struct flash_bank *bank, uint32_t params_addr)
#define CC13X0_ICEPICK_ID
#define CC26XX_STATUS_OFFSET
#define CC26X1_ICEPICK_ID
#define CC26X0_ALGO_PARAMS_1
#define CC26X2_ALGO_PARAMS_1
#define CC26X0_ALGO_BUFFER_0
#define CC26XX_BUFFER_FULL
#define CC26X0_ICEPICK_ID
#define CC26X0_WORKING_SIZE
#define CC26XX_FLASH_BASE_ADDR
#define CC26XX_BUFFER_EMPTY
#define CC26XX_CMD_ERASE_SECTORS
#define CC26X0_ALGO_PARAMS_0
#define CC26XX_CMD_ERASE_ALL
#define CC26X2_ALGO_BUFFER_0
#define CC26X0_SECTOR_LENGTH
#define CC26X2_ALGO_BUFFER_1
#define CC26XX_ALGO_BASE_ADDRESS
#define CC26X0_MAX_SECTORS
#define CC26XX_FLASH_SIZE_INFO
#define CC26XX_CMD_PROGRAM
#define CC13X2_CC26X2_ICEPICK_ID
#define CC26X0_ALGO_BUFFER_1
#define CC26X2_WORKING_SIZE
#define CC26X2_MAX_SECTORS
#define CC26X2_ALGO_PARAMS_0
#define USER_ID_CC13_MASK
#define CC26X2_SECTOR_LENGTH
void command_print_sameline(struct command_invocation *cmd, const char *format,...)
#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...
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.
#define LOG_ERROR(expr ...)
size_t size
Size of the control block search area.
unsigned int common_magic
struct armv7m_algorithm armv7m_info
uint32_t algo_working_size
struct working_area * working_area
const uint8_t * algo_code
When run_command is called, a new instance will be created on the stack, filled with the proper value...
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...
Describes the geometry and status of a single flash sector within a flash bank.
int target_halt(struct target *target)
int target_write_buffer(struct target *target, target_addr_t address, uint32_t size, const uint8_t *buffer)
int target_wait_algorithm(struct target *target, int num_mem_params, struct mem_param *mem_params, int num_reg_params, struct reg_param *reg_params, target_addr_t exit_point, int timeout_ms, void *arch_info)
Waits for an algorithm started with target_start_algorithm() to complete.
int target_alloc_working_area(struct target *target, uint32_t size, struct working_area **area)
int target_free_working_area(struct target *target, struct working_area *area)
Free a working area.
int target_read_u32(struct target *target, target_addr_t address, uint32_t *value)
int target_start_algorithm(struct target *target, int num_mem_params, struct mem_param *mem_params, int num_reg_params, struct reg_param *reg_params, target_addr_t entry_point, target_addr_t exit_point, void *arch_info)
Executes a target-specific native code algorithm and leaves it running.
#define ERROR_TARGET_NOT_HALTED
#define ERROR_TARGET_RESOURCE_NOT_AVAILABLE