- add support for newer high density stm32 parts
[openocd.git] / src / flash / stm32x.h
1 /***************************************************************************
2 * Copyright (C) 2005 by Dominic Rath *
3 * Dominic.Rath@gmx.de *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
20 #ifndef STM32X_H
21 #define STM32X_H
22
23 #include "flash.h"
24 #include "target.h"
25
26 typedef struct stm32x_options_s
27 {
28 u16 RDP;
29 u16 user_options;
30 u16 protection[4];
31 } stm32x_options_t;
32
33 typedef struct stm32x_flash_bank_s
34 {
35 stm32x_options_t option_bytes;
36 working_area_t *write_algorithm;
37 int ppage_size;
38 int probed;
39 } stm32x_flash_bank_t;
40
41 /* stm32x register locations */
42
43 #define STM32_FLASH_ACR 0x40022000
44 #define STM32_FLASH_KEYR 0x40022004
45 #define STM32_FLASH_OPTKEYR 0x40022008
46 #define STM32_FLASH_SR 0x4002200C
47 #define STM32_FLASH_CR 0x40022010
48 #define STM32_FLASH_AR 0x40022014
49 #define STM32_FLASH_OBR 0x4002201C
50 #define STM32_FLASH_WRPR 0x40022020
51
52 /* option byte location */
53
54 #define STM32_OB_RDP 0x1FFFF800
55 #define STM32_OB_USER 0x1FFFF802
56 #define STM32_OB_DATA0 0x1FFFF804
57 #define STM32_OB_DATA1 0x1FFFF806
58 #define STM32_OB_WRP0 0x1FFFF808
59 #define STM32_OB_WRP1 0x1FFFF80A
60 #define STM32_OB_WRP2 0x1FFFF80C
61 #define STM32_OB_WRP3 0x1FFFF80E
62
63 /* FLASH_CR register bits */
64
65 #define FLASH_PG (1<<0)
66 #define FLASH_PER (1<<1)
67 #define FLASH_MER (1<<2)
68 #define FLASH_OPTPG (1<<4)
69 #define FLASH_OPTER (1<<5)
70 #define FLASH_STRT (1<<6)
71 #define FLASH_LOCK (1<<7)
72 #define FLASH_OPTWRE (1<<9)
73
74 /* FLASH_SR regsiter bits */
75
76 #define FLASH_BSY (1<<0)
77 #define FLASH_PGERR (1<<2)
78 #define FLASH_WRPRTERR (1<<4)
79 #define FLASH_EOP (1<<5)
80
81 /* STM32_FLASH_OBR bit definitions (reading) */
82
83 #define OPT_ERROR 0
84 #define OPT_READOUT 1
85 #define OPT_RDWDGSW 2
86 #define OPT_RDRSTSTOP 3
87 #define OPT_RDRSTSTDBY 4
88
89 /* register unlock keys */
90
91 #define KEY1 0x45670123
92 #define KEY2 0xCDEF89AB
93
94 typedef struct stm32x_mem_layout_s {
95 u32 sector_start;
96 u32 sector_size;
97 } stm32x_mem_layout_t;
98
99 #endif /* STM32X_H */
100

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)