OpenOCD
msp432.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 /***************************************************************************
4  * Copyright (C) 2018 by Texas Instruments, Inc. *
5  ***************************************************************************/
6 
7 #ifndef OPENOCD_FLASH_NOR_MSP432_H
8 #define OPENOCD_FLASH_NOR_MSP432_H
9 
10 /* MSP432 family types */
11 #define MSP432_NO_FAMILY 0 /* Family type not determined yet */
12 #define MSP432E4 1 /* MSP432E4 family of devices */
13 #define MSP432P4 2 /* MSP432P4 family of devices */
14 
15 /* MSP432 device types */
16 #define MSP432_NO_TYPE 0 /* Device type not determined yet */
17 #define MSP432P401X_DEPR 1 /* Early MSP432P401x offerings, now deprecated */
18 #define MSP432P401X 2 /* MSP432P401x device, revision C or higher */
19 #define MSP432P411X 3 /* MSP432P411x device, revision A or higher */
20 #define MSP432P401X_GUESS 4 /* Assuming it's an MSP432P401x device */
21 #define MSP432P411X_GUESS 5 /* Assuming it's an MSP432P411x device */
22 #define MSP432E401Y 6 /* MSP432E401Y device */
23 #define MSP432E411Y 7 /* MSP432E401Y device */
24 #define MSP432E4X_GUESS 8 /* Assuming it's an MSP432E4x device */
25 
26 /* Common MSP432 flash parameters */
27 #define FLASH_BASE 0x00000000
28 
29 /* MSP432P4 flash parameters */
30 #define P4_FLASH_MAIN_BASE FLASH_BASE
31 #define P4_FLASH_INFO_BASE 0x00200000
32 #define P4_SECTOR_LENGTH 0x1000
33 #define P4_ALGO_ENTRY_ADDR 0x01000110
34 
35 /* MSP432E4 flash parameters */
36 #define E4_FLASH_BASE FLASH_BASE
37 #define E4_FLASH_SIZE 0x100000
38 #define E4_SECTOR_LENGTH 0x4000
39 #define E4_ALGO_ENTRY_ADDR 0x20000110
40 
41 /* Flash helper algorithm key addresses */
42 #define ALGO_BASE_ADDR 0x20000000
43 #define ALGO_BUFFER1_ADDR 0x20002000
44 #define ALGO_BUFFER2_ADDR 0x20003000
45 #define ALGO_PARAMS_BASE_ADDR 0x20000150
46 #define ALGO_FLASH_COMMAND_ADDR 0x20000150
47 #define ALGO_RETURN_CODE_ADDR 0x20000154
48 #define ALGO_FLASH_DEST_ADDR 0x2000015c
49 #define ALGO_FLASH_LENGTH_ADDR 0x20000160
50 #define ALGO_BUFFER1_STATUS_ADDR 0x20000164
51 #define ALGO_BUFFER2_STATUS_ADDR 0x20000168
52 #define ALGO_ERASE_PARAM_ADDR 0x2000016c
53 #define ALGO_UNLOCK_BSL_ADDR 0x20000170
54 #define ALGO_STACK_POINTER_ADDR 0x20002000
55 
56 /* Flash helper algorithm key sizes */
57 #define ALGO_BUFFER_SIZE 0x1000
58 #define ALGO_WORKING_SIZE (ALGO_BUFFER2_ADDR + 0x1000 - ALGO_BASE_ADDR)
59 
60 /* Flash helper algorithm flash commands */
61 #define FLASH_NO_COMMAND 0
62 #define FLASH_MASS_ERASE 1
63 #define FLASH_SECTOR_ERASE 2
64 #define FLASH_PROGRAM 4
65 #define FLASH_INIT 8
66 #define FLASH_EXIT 16
67 #define FLASH_CONTINUOUS 32
68 
69 /* Flash helper algorithm return codes */
70 #define FLASH_BUSY 0x00000001
71 #define FLASH_SUCCESS 0x00000ACE
72 #define FLASH_ERROR 0x0000DEAD
73 #define FLASH_TIMEOUT_ERROR 0xDEAD0000
74 #define FLASH_VERIFY_ERROR 0xDEADDEAD
75 #define FLASH_WRONG_COMMAND 0x00000BAD
76 #define FLASH_POWER_ERROR 0x00DEAD00
77 
78 /* Flash helper algorithm buffer status values */
79 #define BUFFER_INACTIVE 0x00
80 #define BUFFER_ACTIVE 0x01
81 #define BUFFER_DATA_READY 0x10
82 
83 /* Flash helper algorithm erase parameters */
84 #define FLASH_ERASE_MAIN 0x01
85 #define FLASH_ERASE_INFO 0x02
86 
87 /* Flash helper algorithm lock/unlock BSL options */
88 #define FLASH_LOCK_BSL 0x00
89 #define FLASH_UNLOCK_BSL 0x0b
90 
91 /* Flash helper algorithm parameter block struct */
93  uint8_t flash_command[4];
94  uint8_t return_code[4];
95  uint8_t _reserved0[4];
96  uint8_t address[4];
97  uint8_t length[4];
98  uint8_t buffer1_status[4];
99  uint8_t buffer2_status[4];
100  uint8_t erase_param[4];
101  uint8_t unlock_bsl[4];
102 };
103 
104 #endif /* OPENOCD_FLASH_NOR_MSP432_H */
uint8_t unlock_bsl[4]
Definition: msp432.h:101
uint8_t _reserved0[4]
Definition: msp432.h:95
uint8_t length[4]
Definition: msp432.h:97
uint8_t buffer2_status[4]
Definition: msp432.h:99
uint8_t return_code[4]
Definition: msp432.h:94
uint8_t address[4]
Definition: msp432.h:96
uint8_t erase_param[4]
Definition: msp432.h:100
uint8_t buffer1_status[4]
Definition: msp432.h:98
uint8_t flash_command[4]
Definition: msp432.h:93