flash/nor: move variable's declaration in C file 72/7172/2
authorAntonio Borneo <borneo.antonio@gmail.com>
Mon, 5 Sep 2022 22:57:11 +0000 (00:57 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Tue, 13 Sep 2022 22:13:50 +0000 (22:13 +0000)
Variables should not be declared in the include file, otherwise
multiple include will cause multiple instances.

Move the declaration in the C file and make it static.

Change-Id: I8b4884cba643a792a78df4e123aa324b19d92279
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7172
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
src/flash/nor/cc26xx.c
src/flash/nor/cc26xx.h
src/flash/nor/cc3220sf.c
src/flash/nor/cc3220sf.h
src/flash/nor/msp432.c
src/flash/nor/msp432.h

index b8d18a7d991ab56c876221e2733d0571b5f30d9e..9fbb880b429b1332a8a6b880ac44a4bb9e1f6f90 100644 (file)
@@ -34,6 +34,16 @@ struct cc26xx_bank {
        uint32_t params_addr[2];
 };
 
+/* Flash helper algorithm for CC26x0 Chameleon targets */
+static const uint8_t cc26x0_algo[] = {
+#include "../../../contrib/loaders/flash/cc26xx/cc26x0_algo.inc"
+};
+
+/* Flash helper algorithm for CC26x2 Agama targets */
+static const uint8_t cc26x2_algo[] = {
+#include "../../../contrib/loaders/flash/cc26xx/cc26x2_algo.inc"
+};
+
 static int cc26xx_auto_probe(struct flash_bank *bank);
 
 static uint32_t cc26xx_device_type(uint32_t icepick_id, uint32_t user_id)
index fdba73939a96e1569255dab5262fca600ecab4a2..83fc94024a23741304dabcb81bef47c024a7e6be 100644 (file)
@@ -77,14 +77,4 @@ struct cc26xx_algo_params {
        uint8_t status[4];
 };
 
-/* Flash helper algorithm for CC26x0 Chameleon targets */
-const uint8_t cc26x0_algo[] = {
-#include "../../../contrib/loaders/flash/cc26xx/cc26x0_algo.inc"
-};
-
-/* Flash helper algorithm for CC26x2 Agama targets */
-const uint8_t cc26x2_algo[] = {
-#include "../../../contrib/loaders/flash/cc26xx/cc26x2_algo.inc"
-};
-
 #endif /* OPENOCD_FLASH_NOR_CC26XX_H */
index b639bd1093ecc24d2a952e9780d18576fb5e43f8..6493d6c830da588cf01186340df77604a39ade61 100644 (file)
@@ -22,6 +22,11 @@ struct cc3220sf_bank {
        struct armv7m_algorithm armv7m_info;
 };
 
+/* Flash helper algorithm for CC3220SF */
+static const uint8_t cc3220sf_algo[] = {
+#include "../../../contrib/loaders/flash/cc3220sf/cc3220sf.inc"
+};
+
 static int cc3220sf_mass_erase(struct flash_bank *bank)
 {
        struct target *target = bank->target;
index 7e935f23ab10ebcd0f409dcfbab02c219820499a..eb2a6c6480f5c58d73bc44054a4864b6f544222a 100644 (file)
@@ -26,9 +26,4 @@
 #define FMC_ERASE_VALUE   (FMC_DEFAULT_VALUE | FMC_ERASE_BIT)
 #define FMC_MERASE_VALUE  (FMC_DEFAULT_VALUE | FMC_MERASE_BIT)
 
-/* Flash helper algorithm for CC3220SF */
-const uint8_t cc3220sf_algo[] = {
-#include "../../../contrib/loaders/flash/cc3220sf/cc3220sf.inc"
-};
-
 #endif /* OPENOCD_FLASH_NOR_CC3220SF_H */
index 931c4ff66787ed87fb405da5d6f09f00bbaa8676..6adf6c34b0a8d9d5b0928410398693da8230f16b 100644 (file)
@@ -45,6 +45,21 @@ struct msp432_bank {
        struct armv7m_algorithm armv7m_info;
 };
 
+/* Flash helper algorithm for MSP432P401x targets */
+static const uint8_t msp432p401x_algo[] = {
+#include "../../../contrib/loaders/flash/msp432/msp432p401x_algo.inc"
+};
+
+/* Flash helper algorithm for MSP432P411x targets */
+static const uint8_t msp432p411x_algo[] = {
+#include "../../../contrib/loaders/flash/msp432/msp432p411x_algo.inc"
+};
+
+/* Flash helper algorithm for MSP432E4x targets */
+static const uint8_t msp432e4x_algo[] = {
+#include "../../../contrib/loaders/flash/msp432/msp432e4x_algo.inc"
+};
+
 static int msp432_auto_probe(struct flash_bank *bank);
 
 static int msp432_device_type(uint32_t family_type, uint32_t device_id,
index 504e7a8ec2085bfa7187ee9598b20206240d43df..d0a62c4884d7d1717c951e1fd93d6052f992faa0 100644 (file)
@@ -101,19 +101,4 @@ struct msp432_algo_params {
        uint8_t unlock_bsl[4];
 };
 
-/* Flash helper algorithm for MSP432P401x targets */
-const uint8_t msp432p401x_algo[] = {
-#include "../../../contrib/loaders/flash/msp432/msp432p401x_algo.inc"
-};
-
-/* Flash helper algorithm for MSP432P411x targets */
-const uint8_t msp432p411x_algo[] = {
-#include "../../../contrib/loaders/flash/msp432/msp432p411x_algo.inc"
-};
-
-/* Flash helper algorithm for MSP432E4x targets */
-const uint8_t msp432e4x_algo[] = {
-#include "../../../contrib/loaders/flash/msp432/msp432e4x_algo.inc"
-};
-
 #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)