flash/nor: consolidate flash protect/protect_check
[openocd.git] / src / flash / nor / msp432.h
1 /***************************************************************************
2 * Copyright (C) 2018 by Texas Instruments, Inc. *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
16 ***************************************************************************/
17
18 #ifndef OPENOCD_FLASH_NOR_MSP432_H
19 #define OPENOCD_FLASH_NOR_MSP432_H
20
21 /* MSP432 family types */
22 #define MSP432_NO_FAMILY 0 /* Family type not determined yet */
23 #define MSP432E4 1 /* MSP432E4 family of devices */
24 #define MSP432P4 2 /* MSP432P4 family of devices */
25
26 /* MSP432 device types */
27 #define MSP432_NO_TYPE 0 /* Device type not determined yet */
28 #define MSP432P401X_DEPR 1 /* Early MSP432P401x offerings, now deprecated */
29 #define MSP432P401X 2 /* MSP432P401x device, revision C or higher */
30 #define MSP432P411X 3 /* MSP432P411x device, revision A or higher */
31 #define MSP432P401X_GUESS 4 /* Assuming it's an MSP432P401x device */
32 #define MSP432P411X_GUESS 5 /* Assuming it's an MSP432P411x device */
33 #define MSP432E401Y 6 /* MSP432E401Y device */
34 #define MSP432E411Y 7 /* MSP432E401Y device */
35 #define MSP432E4X_GUESS 8 /* Assuming it's an MSP432E4x device */
36
37 /* MSP432P4 flash parameters */
38 #define P4_FLASH_MAIN_BASE 0x00000000
39 #define P4_FLASH_INFO_BASE 0x00200000
40 #define P4_SECTOR_LENGTH 0x1000
41 #define P4_ALGO_ENTRY_ADDR 0x01000110
42
43 /* MSP432E4 flash paramters */
44 #define E4_FLASH_BASE 0x00000000
45 #define E4_FLASH_SIZE 0x100000
46 #define E4_SECTOR_LENGTH 0x4000
47 #define E4_ALGO_ENTRY_ADDR 0x20000110
48
49 /* Flash helper algorithm key addresses */
50 #define ALGO_BASE_ADDR 0x20000000
51 #define ALGO_BUFFER1_ADDR 0x20002000
52 #define ALGO_BUFFER2_ADDR 0x20003000
53 #define ALGO_PARAMS_BASE_ADDR 0x20000150
54 #define ALGO_FLASH_COMMAND_ADDR 0x20000150
55 #define ALGO_RETURN_CODE_ADDR 0x20000154
56 #define ALGO_FLASH_DEST_ADDR 0x2000015c
57 #define ALGO_FLASH_LENGTH_ADDR 0x20000160
58 #define ALGO_BUFFER1_STATUS_ADDR 0x20000164
59 #define ALGO_BUFFER2_STATUS_ADDR 0x20000168
60 #define ALGO_ERASE_PARAM_ADDR 0x2000016c
61 #define ALGO_UNLOCK_BSL_ADDR 0x20000170
62 #define ALGO_STACK_POINTER_ADDR 0x20002000
63
64 /* Flash helper algorithm key sizes */
65 #define ALGO_BUFFER_SIZE 0x1000
66 #define ALGO_WORKING_SIZE (ALGO_BUFFER2_ADDR + 0x1000 - ALGO_BASE_ADDR)
67
68 /* Flash helper algorithm flash commands */
69 #define FLASH_NO_COMMAND 0
70 #define FLASH_MASS_ERASE 1
71 #define FLASH_SECTOR_ERASE 2
72 #define FLASH_PROGRAM 4
73 #define FLASH_INIT 8
74 #define FLASH_EXIT 16
75 #define FLASH_CONTINUOUS 32
76
77 /* Flash helper algorithm return codes */
78 #define FLASH_BUSY 0x00000001
79 #define FLASH_SUCCESS 0x00000ACE
80 #define FLASH_ERROR 0x0000DEAD
81 #define FLASH_TIMEOUT_ERROR 0xDEAD0000
82 #define FLASH_VERIFY_ERROR 0xDEADDEAD
83 #define FLASH_WRONG_COMMAND 0x00000BAD
84 #define FLASH_POWER_ERROR 0x00DEAD00
85
86 /* Flash helper algorithm buffer status values */
87 #define BUFFER_INACTIVE 0x00
88 #define BUFFER_ACTIVE 0x01
89 #define BUFFER_DATA_READY 0x10
90
91 /* Flash helper algorithm erase parameters */
92 #define FLASH_ERASE_MAIN 0x01
93 #define FLASH_ERASE_INFO 0x02
94
95 /* Flash helper algorithm lock/unlock BSL options */
96 #define FLASH_LOCK_BSL 0x00
97 #define FLASH_UNLOCK_BSL 0x0b
98
99 /* Flash helper algorithm parameter block struct */
100 struct msp432_algo_params {
101 uint8_t flash_command[4];
102 uint8_t return_code[4];
103 uint8_t _reserved0[4];
104 uint8_t address[4];
105 uint8_t length[4];
106 uint8_t buffer1_status[4];
107 uint8_t buffer2_status[4];
108 uint8_t erase_param[4];
109 uint8_t unlock_bsl[4];
110 };
111
112 /* Flash helper algorithm for MSP432P401x targets */
113 const uint8_t msp432p401x_algo[] = {
114 #include "../../../contrib/loaders/flash/msp432/msp432p401x_algo.inc"
115 };
116
117 /* Flash helper algorithm for MSP432P411x targets */
118 const uint8_t msp432p411x_algo[] = {
119 #include "../../../contrib/loaders/flash/msp432/msp432p411x_algo.inc"
120 };
121
122 /* Flash helper algorithm for MSP432E4x targets */
123 const uint8_t msp432e4x_algo[] = {
124 #include "../../../contrib/loaders/flash/msp432/msp432e4x_algo.inc"
125 };
126
127 #endif /* OPENOCD_FLASH_NOR_MSP432_H */

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)