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

Go to the source code of this file.

Data Structures

struct  stellaris_flash_bank
 

Macros

#define AMASK   1
 
#define AMISC   1
 
#define DC0   0x008
 
#define DC1   0x010
 
#define DC2   0x014
 
#define DC3   0x018
 
#define DC4   0x01C
 
#define DID0   0x000
 
#define DID0_VER(did0)   ((did0 >> 28)&0x07)
 
#define DID1   0x004
 
#define FLASH_CIM   (FLASH_CONTROL_BASE | 0x010)
 
#define FLASH_CONTROL_BASE   0x400FD000
 
#define FLASH_CRIS   (FLASH_CONTROL_BASE | 0x00C)
 
#define FLASH_FMA   (FLASH_CONTROL_BASE | 0x000)
 
#define FLASH_FMA_PPE(x)   (2 * (x) + 1) /* for FMPPPEx */
 
#define FLASH_FMA_PRE(x)   (2 * (x)) /* for FMPPREx */
 
#define FLASH_FMC   (FLASH_CONTROL_BASE | 0x008)
 
#define FLASH_FMD   (FLASH_CONTROL_BASE | 0x004)
 
#define FLASH_FSIZE   (FLASH_CONTROL_BASE | 0xFC0)
 
#define FLASH_MISC   (FLASH_CONTROL_BASE | 0x014)
 
#define FLASH_SSIZE   (FLASH_CONTROL_BASE | 0xFC4)
 
#define FMC_COMT   (1 << 3)
 
#define FMC_ERASE   (1 << 1)
 
#define FMC_MERASE   (1 << 2)
 
#define FMC_WRITE   (1 << 0)
 
#define FMC_WRKEY   (0xA442 << 16)
 
#define FMPPE   0x134
 
#define FMPPE0   0x400 /* PPE1 = PPE0 + 4, etc */
 
#define FMPRE   0x130
 
#define FMPRE0   0x200 /* PRE1 = PRE0 + 4, etc */
 
#define NVMSTAT   0x1a0
 
#define PLLCFG   0x064
 
#define PMASK   2
 
#define PMISC   2
 
#define RCC   0x060
 
#define RCC2   0x070
 
#define RIS   0x050
 
#define SCB_BASE   0x400FE000
 
#define USECRL   0x140
 

Functions

 COMMAND_HANDLER (stellaris_handle_mass_erase_command)
 
 COMMAND_HANDLER (stellaris_handle_recover_command)
 Perform the Stellaris "Recovering a 'Locked' Device procedure. More...
 
 FLASH_BANK_COMMAND_HANDLER (stellaris_flash_bank_command)
 
static int get_stellaris_info (struct flash_bank *bank, struct command_invocation *cmd)
 
static int stellaris_erase (struct flash_bank *bank, unsigned int first, unsigned int last)
 
static int stellaris_mass_erase (struct flash_bank *bank)
 
static int stellaris_probe (struct flash_bank *bank)
 
static int stellaris_protect (struct flash_bank *bank, int set, unsigned int first, unsigned int last)
 
static int stellaris_protect_check (struct flash_bank *bank)
 
static void stellaris_read_clock_info (struct flash_bank *bank)
 Read clock configuration and set stellaris_info->usec_clocks. More...
 
static int stellaris_read_part_info (struct flash_bank *bank)
 
static void stellaris_set_flash_timing (struct flash_bank *bank)
 
static int stellaris_write (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
 
static int stellaris_write_block (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t wcount)
 

Variables

static const unsigned int rcc_xtal [32]
 
static const char *const stellaris_classname []
 
static const struct command_registration stellaris_command_handlers []
 
static const struct command_registration stellaris_exec_command_handlers []
 
const struct flash_driver stellaris_flash
 
struct {
   uint8_t   class
 
   const char *   partname
 
   uint8_t   partno
 
stellaris_parts []
 
static const uint8_t stellaris_write_code []
 

Macro Definition Documentation

◆ AMASK

#define AMASK   1

Definition at line 66 of file stellaris.c.

◆ AMISC

#define AMISC   1

Definition at line 63 of file stellaris.c.

◆ DC0

#define DC0   0x008

Definition at line 31 of file stellaris.c.

◆ DC1

#define DC1   0x010

Definition at line 32 of file stellaris.c.

◆ DC2

#define DC2   0x014

Definition at line 33 of file stellaris.c.

◆ DC3

#define DC3   0x018

Definition at line 34 of file stellaris.c.

◆ DC4

#define DC4   0x01C

Definition at line 35 of file stellaris.c.

◆ DID0

#define DID0   0x000

Definition at line 29 of file stellaris.c.

◆ DID0_VER

#define DID0_VER (   did0)    ((did0 >> 28)&0x07)

Definition at line 25 of file stellaris.c.

◆ DID1

#define DID1   0x004

Definition at line 30 of file stellaris.c.

◆ FLASH_CIM

#define FLASH_CIM   (FLASH_CONTROL_BASE | 0x010)

Definition at line 58 of file stellaris.c.

◆ FLASH_CONTROL_BASE

#define FLASH_CONTROL_BASE   0x400FD000

Definition at line 53 of file stellaris.c.

◆ FLASH_CRIS

#define FLASH_CRIS   (FLASH_CONTROL_BASE | 0x00C)

Definition at line 57 of file stellaris.c.

◆ FLASH_FMA

#define FLASH_FMA   (FLASH_CONTROL_BASE | 0x000)

Definition at line 54 of file stellaris.c.

◆ FLASH_FMA_PPE

#define FLASH_FMA_PPE (   x)    (2 * (x) + 1) /* for FMPPPEx */

Definition at line 80 of file stellaris.c.

◆ FLASH_FMA_PRE

#define FLASH_FMA_PRE (   x)    (2 * (x)) /* for FMPPREx */

Definition at line 79 of file stellaris.c.

◆ FLASH_FMC

#define FLASH_FMC   (FLASH_CONTROL_BASE | 0x008)

Definition at line 56 of file stellaris.c.

◆ FLASH_FMD

#define FLASH_FMD   (FLASH_CONTROL_BASE | 0x004)

Definition at line 55 of file stellaris.c.

◆ FLASH_FSIZE

#define FLASH_FSIZE   (FLASH_CONTROL_BASE | 0xFC0)

Definition at line 60 of file stellaris.c.

◆ FLASH_MISC

#define FLASH_MISC   (FLASH_CONTROL_BASE | 0x014)

Definition at line 59 of file stellaris.c.

◆ FLASH_SSIZE

#define FLASH_SSIZE   (FLASH_CONTROL_BASE | 0xFC4)

Definition at line 61 of file stellaris.c.

◆ FMC_COMT

#define FMC_COMT   (1 << 3)

Definition at line 71 of file stellaris.c.

◆ FMC_ERASE

#define FMC_ERASE   (1 << 1)

Definition at line 73 of file stellaris.c.

◆ FMC_MERASE

#define FMC_MERASE   (1 << 2)

Definition at line 72 of file stellaris.c.

◆ FMC_WRITE

#define FMC_WRITE   (1 << 0)

Definition at line 74 of file stellaris.c.

◆ FMC_WRKEY

#define FMC_WRKEY   (0xA442 << 16)

Definition at line 70 of file stellaris.c.

◆ FMPPE

#define FMPPE   0x134

Definition at line 45 of file stellaris.c.

◆ FMPPE0

#define FMPPE0   0x400 /* PPE1 = PPE0 + 4, etc */

Definition at line 49 of file stellaris.c.

◆ FMPRE

#define FMPRE   0x130

Definition at line 44 of file stellaris.c.

◆ FMPRE0

#define FMPRE0   0x200 /* PRE1 = PRE0 + 4, etc */

Definition at line 48 of file stellaris.c.

◆ NVMSTAT

#define NVMSTAT   0x1a0

Definition at line 41 of file stellaris.c.

◆ PLLCFG

#define PLLCFG   0x064

Definition at line 39 of file stellaris.c.

◆ PMASK

#define PMASK   2

Definition at line 67 of file stellaris.c.

◆ PMISC

#define PMISC   2

Definition at line 64 of file stellaris.c.

◆ RCC

#define RCC   0x060

Definition at line 38 of file stellaris.c.

◆ RCC2

#define RCC2   0x070

Definition at line 40 of file stellaris.c.

◆ RIS

#define RIS   0x050

Definition at line 37 of file stellaris.c.

◆ SCB_BASE

#define SCB_BASE   0x400FE000

Definition at line 28 of file stellaris.c.

◆ USECRL

#define USECRL   0x140

Definition at line 51 of file stellaris.c.

Function Documentation

◆ COMMAND_HANDLER() [1/2]

COMMAND_HANDLER ( stellaris_handle_mass_erase_command  )

◆ COMMAND_HANDLER() [2/2]

COMMAND_HANDLER ( stellaris_handle_recover_command  )

Perform the Stellaris "Recovering a 'Locked' Device procedure.

This performs a mass erase and then restores all nonvolatile registers (including USER_* registers and flash lock bits) to their defaults. Accordingly, flash can be reprogrammed, and JTAG can be used.

NOTE that DustDevil parts (at least rev A0 silicon) have errata which can affect this operation if flash protection has been enabled.

Definition at line 1326 of file stellaris.c.

References adapter_assert_reset(), adapter_deassert_reset(), bank, CMD_ARGC, CMD_CTX, arm::dap, dap_to_jtag(), dap_to_swd(), ERROR_COMMAND_SYNTAX_ERROR, ERROR_FAIL, ERROR_OK, get_flash_bank_by_num_noprobe(), jtag_execute_queue(), jtag_get_reset_config(), LOG_ERROR, LOG_INFO, NULL, RESET_HAS_SRST, and target_to_arm().

◆ FLASH_BANK_COMMAND_HANDLER()

FLASH_BANK_COMMAND_HANDLER ( stellaris_flash_bank_command  )

◆ get_stellaris_info()

◆ stellaris_erase()

◆ stellaris_mass_erase()

◆ stellaris_probe()

static int stellaris_probe ( struct flash_bank bank)
static

◆ stellaris_protect()

◆ stellaris_protect_check()

◆ stellaris_read_clock_info()

◆ stellaris_read_part_info()

◆ stellaris_set_flash_timing()

static void stellaris_set_flash_timing ( struct flash_bank bank)
static

◆ stellaris_write()

◆ stellaris_write_block()

Variable Documentation

◆ class

uint8_t class

Definition at line 116 of file stellaris.c.

◆ partname

const char* partname

Definition at line 118 of file stellaris.c.

◆ partno

uint8_t partno

Definition at line 117 of file stellaris.c.

Referenced by stellaris_read_part_info().

◆ rcc_xtal

const unsigned int rcc_xtal[32]
static

Definition at line 533 of file stellaris.c.

Referenced by stellaris_read_clock_info().

◆ stellaris_classname

const char* const stellaris_classname[]
static
Initial value:
= {
"Sandstorm",
"Fury",
"Unknown",
"DustDevil",
"Tempest",
"Blizzard/TM4C123x",
"Firestorm",
"",
"",
"",
"Snowflake",
}

Definition at line 429 of file stellaris.c.

Referenced by get_stellaris_info().

◆ stellaris_command_handlers

const struct command_registration stellaris_command_handlers[]
static
Initial value:
= {
{
.name = "stellaris",
.mode = COMMAND_EXEC,
.help = "Stellaris flash command group",
.usage = "",
},
}
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
Definition: command.h:253
@ COMMAND_EXEC
Definition: command.h:40
static const struct command_registration stellaris_exec_command_handlers[]
Definition: stellaris.c:1387

Definition at line 1326 of file stellaris.c.

◆ stellaris_exec_command_handlers

const struct command_registration stellaris_exec_command_handlers[]
static
Initial value:
= {
{
.name = "mass_erase",
.usage = "<bank>",
.handler = stellaris_handle_mass_erase_command,
.mode = COMMAND_EXEC,
.help = "erase entire device",
},
{
.name = "recover",
.handler = stellaris_handle_recover_command,
.mode = COMMAND_EXEC,
.usage = "",
.help = "recover (and erase) locked device",
},
}

Definition at line 1326 of file stellaris.c.

◆ stellaris_flash

const struct flash_driver stellaris_flash
Initial value:
= {
.name = "stellaris",
.flash_bank_command = stellaris_flash_bank_command,
.erase = stellaris_erase,
.protect = stellaris_protect,
.write = stellaris_write,
.probe = stellaris_probe,
.auto_probe = stellaris_probe,
.erase_check = default_flash_blank_check,
.protect_check = stellaris_protect_check,
.free_driver_priv = default_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.
void default_flash_free_driver_priv(struct flash_bank *bank)
Deallocates bank->driver_priv.
static int get_stellaris_info(struct flash_bank *bank, struct command_invocation *cmd)
Definition: stellaris.c:472
static const struct command_registration stellaris_command_handlers[]
Definition: stellaris.c:1404
static int stellaris_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
Definition: stellaris.c:1101
static int stellaris_protect_check(struct flash_bank *bank)
Definition: stellaris.c:780
static int stellaris_probe(struct flash_bank *bank)
Definition: stellaris.c:1214
static int stellaris_protect(struct flash_bank *bank, int set, unsigned int first, unsigned int last)
Definition: stellaris.c:884
static int stellaris_erase(struct flash_bank *bank, unsigned int first, unsigned int last)
Definition: stellaris.c:828

Definition at line 1326 of file stellaris.c.

◆ 

const { ... } stellaris_parts[]

◆ stellaris_write_code

const uint8_t stellaris_write_code[]
static

Definition at line 983 of file stellaris.c.

Referenced by stellaris_write_block().