OpenOCD
|
Go to the source code of this file.
Data Structures | |
struct | nrf52_ficr_info |
struct | nrf5_info::nrf5_bank |
struct | nrf5_device_package |
struct | nrf5_device_spec |
struct | nrf5_info |
Macros | |
#define | NRF51_DEVICE_DEF(id, pt, var, bcode, fsize) |
#define | NRF5_DEVICE_DEF(id, pt, var, bcode, fsize, features) |
#define | NRF5_FICR_REG(offset) (NRF5_FICR_BASE + offset) |
#define | NRF5_NVMC_REG(offset) (NRF5_NVMC_BASE + offset) |
#define | NRF5_UICR_REG(offset) (NRF5_UICR_BASE + offset) |
#define | WATCHDOG_REFRESH_REGISTER 0x40010600 |
#define | WATCHDOG_REFRESH_VALUE 0x6e524635 |
Enumerations | |
enum | { NRF5_FLASH_BASE = 0x00000000 } |
enum | nrf5_features { NRF5_FEATURE_SERIES_51 = 1 << 0 , NRF5_FEATURE_SERIES_52 = 1 << 1 , NRF5_FEATURE_BPROT = 1 << 2 , NRF5_FEATURE_ACL_PROT = 1 << 3 } |
enum | nrf5_ficr_registers { NRF5_FICR_BASE = 0x10000000 , NRF5_FICR_CODEPAGESIZE = NRF5_FICR_REG(0x010) , NRF5_FICR_CODESIZE = NRF5_FICR_REG(0x014) , NRF51_FICR_CLENR0 = NRF5_FICR_REG(0x028) , NRF51_FICR_PPFC = NRF5_FICR_REG(0x02C) , NRF51_FICR_NUMRAMBLOCK = NRF5_FICR_REG(0x034) , NRF51_FICR_SIZERAMBLOCK0 = NRF5_FICR_REG(0x038) , NRF51_FICR_SIZERAMBLOCK1 = NRF5_FICR_REG(0x03C) , NRF51_FICR_SIZERAMBLOCK2 = NRF5_FICR_REG(0x040) , NRF51_FICR_SIZERAMBLOCK3 = NRF5_FICR_REG(0x044) , NRF5_FICR_CONFIGID = NRF5_FICR_REG(0x05C) , NRF5_FICR_DEVICEID0 = NRF5_FICR_REG(0x060) , NRF5_FICR_DEVICEID1 = NRF5_FICR_REG(0x064) , NRF5_FICR_ER0 = NRF5_FICR_REG(0x080) , NRF5_FICR_ER1 = NRF5_FICR_REG(0x084) , NRF5_FICR_ER2 = NRF5_FICR_REG(0x088) , NRF5_FICR_ER3 = NRF5_FICR_REG(0x08C) , NRF5_FICR_IR0 = NRF5_FICR_REG(0x090) , NRF5_FICR_IR1 = NRF5_FICR_REG(0x094) , NRF5_FICR_IR2 = NRF5_FICR_REG(0x098) , NRF5_FICR_IR3 = NRF5_FICR_REG(0x09C) , NRF5_FICR_DEVICEADDRTYPE = NRF5_FICR_REG(0x0A0) , NRF5_FICR_DEVICEADDR0 = NRF5_FICR_REG(0x0A4) , NRF5_FICR_DEVICEADDR1 = NRF5_FICR_REG(0x0A8) , NRF51_FICR_OVERRIDEN = NRF5_FICR_REG(0x0AC) , NRF51_FICR_NRF_1MBIT0 = NRF5_FICR_REG(0x0B0) , NRF51_FICR_NRF_1MBIT1 = NRF5_FICR_REG(0x0B4) , NRF51_FICR_NRF_1MBIT2 = NRF5_FICR_REG(0x0B8) , NRF51_FICR_NRF_1MBIT3 = NRF5_FICR_REG(0x0BC) , NRF51_FICR_NRF_1MBIT4 = NRF5_FICR_REG(0x0C0) , NRF51_FICR_BLE_1MBIT0 = NRF5_FICR_REG(0x0EC) , NRF51_FICR_BLE_1MBIT1 = NRF5_FICR_REG(0x0F0) , NRF51_FICR_BLE_1MBIT2 = NRF5_FICR_REG(0x0F4) , NRF51_FICR_BLE_1MBIT3 = NRF5_FICR_REG(0x0F8) , NRF51_FICR_BLE_1MBIT4 = NRF5_FICR_REG(0x0FC) , NRF5_FICR_INFO_PART = NRF5_FICR_REG(0x100) , NRF5_FICR_INFO_VARIANT = NRF5_FICR_REG(0x104) , NRF5_FICR_INFO_PACKAGE = NRF5_FICR_REG(0x108) , NRF5_FICR_INFO_RAM = NRF5_FICR_REG(0x10C) , NRF5_FICR_INFO_FLASH = NRF5_FICR_REG(0x110) } |
enum | nrf5_nvmc_config_bits { NRF5_NVMC_CONFIG_REN = 0x00 , NRF5_NVMC_CONFIG_WEN = 0x01 , NRF5_NVMC_CONFIG_EEN = 0x02 } |
enum | nrf5_nvmc_registers { NRF5_NVMC_BASE = 0x4001E000 , NRF5_NVMC_READY = NRF5_NVMC_REG(0x400) , NRF5_NVMC_CONFIG = NRF5_NVMC_REG(0x504) , NRF5_NVMC_ERASEPAGE = NRF5_NVMC_REG(0x508) , NRF5_NVMC_ERASEALL = NRF5_NVMC_REG(0x50C) , NRF5_NVMC_ERASEUICR = NRF5_NVMC_REG(0x514) , NRF5_BPROT_BASE = 0x40000000 } |
enum | nrf5_uicr_registers { NRF5_UICR_BASE = 0x10001000 , NRF51_UICR_CLENR0 = NRF5_UICR_REG(0x000) , NRF51_UICR_RBPCONF = NRF5_UICR_REG(0x004) , NRF51_UICR_XTALFREQ = NRF5_UICR_REG(0x008) , NRF51_UICR_FWID = NRF5_UICR_REG(0x010) } |
Functions | |
COMMAND_HANDLER (nrf5_handle_info_command) | |
COMMAND_HANDLER (nrf5_handle_mass_erase_command) | |
FLASH_BANK_COMMAND_HANDLER (nrf5_flash_bank_command) | |
static int | get_nrf5_chip_type_str (const struct nrf5_info *chip, char *buf, unsigned int buf_size) |
static int | nrf5_auto_probe (struct flash_bank *bank) |
static bool | nrf5_bank_is_probed (const struct flash_bank *bank) |
static const char * | nrf5_decode_info_package (uint32_t package) |
static int | nrf5_erase (struct flash_bank *bank, unsigned int first, unsigned int last) |
static int | nrf5_erase_all (struct nrf5_info *chip) |
static int | nrf5_erase_page (struct flash_bank *bank, struct nrf5_info *chip, struct flash_sector *sector) |
static void | nrf5_free_driver_priv (struct flash_bank *bank) |
static struct nrf5_info * | nrf5_get_chip (struct target *target) |
static int | nrf5_get_probed_chip_if_halted (struct flash_bank *bank, struct nrf5_info **chip) |
static int | nrf5_get_ram_size (struct target *target, uint32_t *ram_size) |
static int | nrf5_info (struct flash_bank *bank, struct command_invocation *cmd) |
static bool | nrf5_info_variant_to_str (uint32_t variant, char *bf) |
static int | nrf5_ll_flash_write (struct nrf5_info *chip, uint32_t address, const uint8_t *buffer, uint32_t bytes) |
static int | nrf5_nvmc_erase_enable (struct nrf5_info *chip) |
static int | nrf5_nvmc_generic_erase (struct nrf5_info *chip, uint32_t erase_register, uint32_t erase_value) |
static int | nrf5_nvmc_read_only (struct nrf5_info *chip) |
static int | nrf5_nvmc_write_enable (struct nrf5_info *chip) |
static int | nrf5_probe (struct flash_bank *bank) |
static int | nrf5_protect (struct flash_bank *bank, int set, unsigned int first, unsigned int last) |
static int | nrf5_protect_check (struct flash_bank *bank) |
static int | nrf5_protect_check_bprot (struct flash_bank *bank) |
static int | nrf5_protect_check_clenr0 (struct flash_bank *bank) |
static int | nrf5_protect_clenr0 (struct flash_bank *bank, int set, unsigned int first, unsigned int last) |
static int | nrf5_read_ficr_info (struct nrf5_info *chip) |
static int | nrf5_wait_for_nvmc (struct nrf5_info *chip) |
static int | nrf5_write (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count) |
Variables | |
const struct flash_driver nrf5_flash | nrf51_flash |
static const struct command_registration | nrf5_command_handlers [] |
static const struct command_registration | nrf5_exec_command_handlers [] |
const struct flash_driver | nrf5_flash |
static const struct nrf5_device_spec | nrf5_known_devices_table [] |
static const struct nrf5_device_package | nrf5_packages_table [] |
#define NRF51_DEVICE_DEF | ( | id, | |
pt, | |||
var, | |||
bcode, | |||
fsize | |||
) |
#define NRF5_DEVICE_DEF | ( | id, | |
pt, | |||
var, | |||
bcode, | |||
fsize, | |||
features | |||
) |
#define NRF5_FICR_REG | ( | offset | ) | (NRF5_FICR_BASE + offset) |
#define NRF5_NVMC_REG | ( | offset | ) | (NRF5_NVMC_BASE + offset) |
#define NRF5_UICR_REG | ( | offset | ) | (NRF5_UICR_BASE + offset) |
enum nrf5_features |
enum nrf5_ficr_registers |
enum nrf5_nvmc_registers |
enum nrf5_uicr_registers |
COMMAND_HANDLER | ( | nrf5_handle_info_command | ) |
Definition at line 1248 of file nrf5.c.
References ARRAY_SIZE, bank, CMD, CMD_CTX, command_print(), ERROR_OK, get_current_target(), get_flash_bank_by_addr(), LOG_ERROR, NRF51_FICR_BLE_1MBIT0, NRF51_FICR_BLE_1MBIT1, NRF51_FICR_BLE_1MBIT2, NRF51_FICR_BLE_1MBIT3, NRF51_FICR_BLE_1MBIT4, NRF51_FICR_CLENR0, NRF51_FICR_NRF_1MBIT0, NRF51_FICR_NRF_1MBIT1, NRF51_FICR_NRF_1MBIT2, NRF51_FICR_NRF_1MBIT3, NRF51_FICR_NRF_1MBIT4, NRF51_FICR_NUMRAMBLOCK, NRF51_FICR_OVERRIDEN, NRF51_FICR_PPFC, NRF51_FICR_SIZERAMBLOCK0, NRF51_FICR_SIZERAMBLOCK1, NRF51_FICR_SIZERAMBLOCK2, NRF51_FICR_SIZERAMBLOCK3, NRF51_UICR_CLENR0, NRF51_UICR_FWID, NRF51_UICR_RBPCONF, NRF51_UICR_XTALFREQ, NRF5_FICR_CODEPAGESIZE, NRF5_FICR_CODESIZE, NRF5_FICR_CONFIGID, NRF5_FICR_DEVICEADDR0, NRF5_FICR_DEVICEADDR1, NRF5_FICR_DEVICEADDRTYPE, NRF5_FICR_DEVICEID0, NRF5_FICR_DEVICEID1, NRF5_FICR_ER0, NRF5_FICR_ER1, NRF5_FICR_ER2, NRF5_FICR_ER3, NRF5_FICR_IR0, NRF5_FICR_IR1, NRF5_FICR_IR2, NRF5_FICR_IR3, NRF5_FLASH_BASE, nrf5_get_probed_chip_if_halted(), NULL, nrf5_info::target, and target_read_u32().
COMMAND_HANDLER | ( | nrf5_handle_mass_erase_command | ) |
Definition at line 1201 of file nrf5.c.
References bank, CMD_CTX, ERROR_FAIL, ERROR_OK, nrf5_info::features, get_current_target(), get_flash_bank_by_addr(), LOG_ERROR, LOG_INFO, NRF51_FICR_PPFC, nrf5_erase_all(), NRF5_FEATURE_SERIES_51, NRF5_FLASH_BASE, nrf5_get_probed_chip_if_halted(), NULL, and target_read_u32().
FLASH_BANK_COMMAND_HANDLER | ( | nrf5_flash_bank_command | ) |
Definition at line 1158 of file nrf5.c.
References nrf5_info::bank, bank, ERROR_FAIL, ERROR_OK, LOG_ERROR, NRF5_FLASH_BASE, nrf5_get_chip(), NRF5_UICR_BASE, NULL, nrf5_info::refcount, nrf5_info::target, and TARGET_ADDR_FMT.
|
static |
Definition at line 617 of file nrf5.c.
References nrf5_device_spec::build_code, ERROR_FAIL, ERROR_OK, nrf5_info::ficr_info, nrf5_info::ficr_info_valid, nrf5_info::hwid, LOG_ERROR, nrf5_decode_info_package(), nrf5_info_variant_to_str(), nrf52_ficr_info::package, nrf52_ficr_info::part, nrf5_device_spec::part, nrf5_info::spec, nrf52_ficr_info::variant, and nrf5_device_spec::variant.
Referenced by nrf5_info(), and nrf5_probe().
|
static |
Definition at line 869 of file nrf5.c.
References bank, ERROR_OK, nrf5_bank_is_probed(), and nrf5_probe().
|
static |
Definition at line 282 of file nrf5.c.
References bank.
Referenced by nrf5_auto_probe(), and nrf5_get_probed_chip_if_halted().
|
static |
Definition at line 608 of file nrf5.c.
References ARRAY_SIZE, nrf5_device_package::code, and nrf5_packages_table.
Referenced by get_nrf5_chip_type_str().
|
static |
Definition at line 1080 of file nrf5.c.
References bank, ERROR_FLASH_PROTECTED, ERROR_OK, nrf5_info::features, LOG_ERROR, nrf5_erase_page(), NRF5_FEATURE_SERIES_51, nrf5_get_probed_chip_if_halted(), and nrf5_protect_check_clenr0().
|
static |
Definition at line 877 of file nrf5.c.
References LOG_DEBUG, NRF5_NVMC_ERASEALL, and nrf5_nvmc_generic_erase().
Referenced by COMMAND_HANDLER().
|
static |
Definition at line 885 of file nrf5.c.
References bank, default_flash_blank_check(), ERROR_FAIL, ERROR_OK, nrf5_info::features, flash_sector::is_erased, LOG_DEBUG, LOG_ERROR, NRF51_FICR_PPFC, NRF5_FEATURE_SERIES_51, NRF5_NVMC_ERASEPAGE, NRF5_NVMC_ERASEUICR, nrf5_nvmc_generic_erase(), NRF5_UICR_BASE, flash_sector::offset, nrf5_info::target, and target_read_u32().
Referenced by nrf5_erase().
|
static |
Definition at line 1122 of file nrf5.c.
References bank, NULL, and nrf5_info::refcount.
Definition at line 1136 of file nrf5.c.
References flash_bank::driver, flash_bank::driver_priv, flash_bank_list(), flash_bank::next, nrf51_flash, nrf5_flash, NULL, and flash_bank::target.
Referenced by FLASH_BANK_COMMAND_HANDLER().
|
static |
Definition at line 292 of file nrf5.c.
References bank, ERROR_OK, ERROR_TARGET_NOT_HALTED, LOG_ERROR, nrf5_bank_is_probed(), nrf5_probe(), and TARGET_HALTED.
Referenced by COMMAND_HANDLER(), nrf5_erase(), nrf5_protect(), and nrf5_write().
|
static |
Definition at line 722 of file nrf5.c.
References ERROR_OK, ERROR_TARGET_RESOURCE_NOT_AVAILABLE, LOG_DEBUG, NRF51_FICR_NUMRAMBLOCK, NRF51_FICR_SIZERAMBLOCK0, and target_read_u32().
Referenced by nrf5_probe().
|
static |
Definition at line 642 of file nrf5.c.
References bank, cmd, command_print_sameline(), ERROR_FAIL, ERROR_OK, nrf5_info::flash_size_kb, get_nrf5_chip_type_str(), and nrf5_info::ram_size_kb.
|
static |
Definition at line 593 of file nrf5.c.
References h_u32_to_be().
Referenced by get_nrf5_chip_type_str().
|
static |
Definition at line 930 of file nrf5.c.
References working_area::address, ARM_MODE_THREAD, ARMV7M_COMMON_MAGIC, ARRAY_SIZE, buf_set_u32(), buffer, armv7m_algorithm::common_magic, armv7m_algorithm::core_mode, destroy_reg_param(), ERROR_OK, ERROR_TARGET_RESOURCE_NOT_AVAILABLE, init_reg_param(), LOG_DEBUG, LOG_WARNING, nrf5_wait_for_nvmc(), NULL, PARAM_IN_OUT, PARAM_OUT, source, nrf5_info::target, target_alloc_working_area(), target_free_working_area(), target_run_flash_async_algorithm(), target_write_buffer(), target_write_memory(), WATCHDOG_REFRESH_REGISTER, and WATCHDOG_REFRESH_VALUE.
Referenced by nrf5_write().
|
static |
Definition at line 333 of file nrf5.c.
References ERROR_OK, LOG_ERROR, NRF5_NVMC_CONFIG, NRF5_NVMC_CONFIG_EEN, nrf5_wait_for_nvmc(), nrf5_info::target, and target_write_u32().
Referenced by nrf5_nvmc_generic_erase().
|
static |
Definition at line 401 of file nrf5.c.
References ERROR_FAIL, ERROR_OK, LOG_ERROR, nrf5_nvmc_erase_enable(), nrf5_nvmc_read_only(), nrf5_wait_for_nvmc(), nrf5_info::target, and target_write_u32().
Referenced by nrf5_erase_all(), and nrf5_erase_page().
|
static |
Definition at line 379 of file nrf5.c.
References ERROR_OK, LOG_ERROR, NRF5_NVMC_CONFIG, NRF5_NVMC_CONFIG_REN, nrf5_wait_for_nvmc(), nrf5_info::target, and target_write_u32().
Referenced by nrf5_nvmc_generic_erase(), nrf5_protect_clenr0(), and nrf5_write().
|
static |
Definition at line 356 of file nrf5.c.
References ERROR_OK, LOG_ERROR, NRF5_NVMC_CONFIG, NRF5_NVMC_CONFIG_WEN, nrf5_wait_for_nvmc(), nrf5_info::target, and target_write_u32().
Referenced by nrf5_protect_clenr0(), and nrf5_write().
|
static |
Definition at line 755 of file nrf5.c.
References alloc_block_array(), ARRAY_SIZE, nrf5_info::bank, bank, ERROR_FAIL, ERROR_OK, nrf5_device_spec::features, nrf5_info::features, nrf5_info::ficr_info, nrf5_info::ficr_info_valid, nrf52_ficr_info::flash, nrf5_device_spec::flash_size_kb, nrf5_info::flash_size_kb, get_nrf5_chip_type_str(), nrf5_device_spec::hwid, nrf5_info::hwid, LOG_ERROR, LOG_INFO, LOG_WARNING, NRF5_FEATURE_SERIES_51, NRF5_FICR_CODEPAGESIZE, NRF5_FICR_CODESIZE, NRF5_FICR_CONFIGID, NRF5_FLASH_BASE, nrf5_get_ram_size(), nrf5_known_devices_table, nrf5_read_ficr_info(), NULL, nrf52_ficr_info::part, nrf5_device_spec::part, nrf5_info::nrf5_bank::probed, nrf52_ficr_info::ram, nrf5_info::ram_size_kb, nrf5_info::spec, nrf5_info::target, and target_read_u32().
Referenced by nrf5_auto_probe(), and nrf5_get_probed_chip_if_halted().
|
static |
Definition at line 570 of file nrf5.c.
References bank, ERROR_FLASH_OPER_UNSUPPORTED, ERROR_OK, nrf5_info::features, LOG_ERROR, NRF5_FEATURE_SERIES_51, nrf5_get_probed_chip_if_halted(), nrf5_protect_clenr0(), and NRF5_UICR_BASE.
|
static |
Definition at line 489 of file nrf5.c.
References bank, ERROR_FLASH_OPER_UNSUPPORTED, ERROR_OK, nrf5_info::features, LOG_WARNING, NRF5_FEATURE_BPROT, NRF5_FEATURE_SERIES_51, nrf5_protect_check_bprot(), nrf5_protect_check_clenr0(), and NRF5_UICR_BASE.
|
static |
Definition at line 462 of file nrf5.c.
References ARRAY_SIZE, bank, bit(), ERROR_OK, NRF5_BPROT_BASE, nrf5_info::target, and target_read_u32().
Referenced by nrf5_protect_check().
|
static |
Definition at line 430 of file nrf5.c.
References bank, ERROR_OK, LOG_ERROR, NRF51_FICR_CLENR0, NRF51_UICR_CLENR0, nrf5_info::target, and target_read_u32().
Referenced by nrf5_erase(), nrf5_protect_check(), and nrf5_write().
|
static |
Definition at line 510 of file nrf5.c.
References bank, ERROR_FAIL, ERROR_OK, LOG_ERROR, LOG_INFO, NRF51_FICR_PPFC, NRF51_UICR_CLENR0, nrf5_nvmc_read_only(), nrf5_nvmc_write_enable(), nrf5_wait_for_nvmc(), nrf5_info::target, target_read_u32(), and target_write_u32().
Referenced by nrf5_protect().
|
static |
Definition at line 656 of file nrf5.c.
References ERROR_OK, ERROR_TARGET_RESOURCE_NOT_AVAILABLE, nrf5_info::features, nrf5_info::ficr_info, nrf5_info::ficr_info_valid, nrf52_ficr_info::flash, LOG_DEBUG, NRF5_FEATURE_ACL_PROT, NRF5_FEATURE_BPROT, NRF5_FEATURE_SERIES_51, NRF5_FEATURE_SERIES_52, NRF5_FICR_INFO_FLASH, NRF5_FICR_INFO_PACKAGE, NRF5_FICR_INFO_PART, NRF5_FICR_INFO_RAM, NRF5_FICR_INFO_VARIANT, nrf52_ficr_info::package, nrf52_ficr_info::part, nrf52_ficr_info::ram, nrf5_info::target, target_read_u32(), and nrf52_ficr_info::variant.
Referenced by nrf5_probe().
|
static |
Definition at line 308 of file nrf5.c.
References ERROR_FLASH_BUSY, ERROR_OK, keep_alive(), LOG_DEBUG, LOG_ERROR, NRF5_NVMC_READY, nrf5_info::target, target_read_u32(), and timeval_ms().
Referenced by nrf5_ll_flash_write(), nrf5_nvmc_erase_enable(), nrf5_nvmc_generic_erase(), nrf5_nvmc_read_only(), nrf5_nvmc_write_enable(), and nrf5_protect_clenr0().
|
static |
Definition at line 1024 of file nrf5.c.
References bank, buffer, count, ERROR_FLASH_PROTECTED, ERROR_OK, nrf5_info::features, flash_sector::is_protected, LOG_ERROR, NRF5_FEATURE_SERIES_51, nrf5_get_probed_chip_if_halted(), nrf5_ll_flash_write(), nrf5_nvmc_read_only(), nrf5_nvmc_write_enable(), nrf5_protect_check_clenr0(), flash_sector::offset, offset, and flash_sector::size.
const struct flash_driver nrf51_flash |
Definition at line 1 of file nrf5.c.
Referenced by nrf5_get_chip().
|
static |
|
static |
const struct flash_driver nrf5_flash |
Definition at line 1248 of file nrf5.c.
Referenced by nrf5_get_chip().
|
static |
Definition at line 1 of file nrf5.c.
Referenced by nrf5_probe().
|
static |
Definition at line 1 of file nrf5.c.
Referenced by nrf5_decode_info_package().