arm_adi_v5: rewrite dap_to_jtag and dap_to_swd
[openocd.git] / src / flash / nor / stellaris.c
index 27b66325a363d48be00310d428cf6189b94adade..8731f8b88d089e02faa1cd53fe1a5677ce3dbf0b 100644 (file)
@@ -16,9 +16,7 @@
  *   GNU General Public License for more details.                          *
  *                                                                         *
  *   You should have received a copy of the GNU General Public License     *
- *   along with this program; if not, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.           *
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>. *
  ***************************************************************************/
 
 /***************************************************************************
@@ -507,12 +505,12 @@ static int get_stellaris_info(struct flash_bank *bank, char *buf, int buf_size)
        printed = snprintf(buf,
                           buf_size,
                           "did1: 0x%8.8" PRIx32 ", arch: 0x%4.4" PRIx32
-                          ", eproc: %s, ramsize: %ik, flashsize: %ik\n",
+                          ", eproc: %s, ramsize: %" PRIu32 "k, flashsize: %" PRIu32 "k\n",
                           stellaris_info->did1,
                           stellaris_info->did1,
                           "ARMv7M",
                           stellaris_info->sramsiz,
-                          stellaris_info->num_pages * stellaris_info->pagesize / 1024);
+                          (uint32_t)(stellaris_info->num_pages * stellaris_info->pagesize / 1024));
        buf += printed;
        buf_size -= printed;
 
@@ -602,7 +600,7 @@ static void stellaris_read_clock_info(struct flash_bank *bank)
        LOG_DEBUG("Stellaris PLLCFG %" PRIx32 "", pllcfg);
 
        stellaris_info->rcc = rcc;
-       stellaris_info->rcc = rcc2;
+       stellaris_info->rcc2 = rcc2;
 
        sysdiv = (rcc >> 23) & 0xF;
        usesysdiv = (rcc >> 22) & 0x1;
@@ -1065,7 +1063,7 @@ static int stellaris_write_block(struct flash_bank *bank,
                        &write_algorithm) != ERROR_OK) {
                LOG_DEBUG("no working area for block memory writes");
                return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
-       };
+       }
 
        /* plus a buffer big enough for this data */
        if (wcount * 4 < buffer_size)
@@ -1080,7 +1078,7 @@ static int stellaris_write_block(struct flash_bank *bank,
                }
                LOG_DEBUG("retry target_alloc_working_area(%s, size=%u)",
                                target_name(target), (unsigned) buffer_size);
-       };
+       }
 
        target_write_buffer(target, write_algorithm->address,
                        sizeof(stellaris_write_code),
@@ -1357,6 +1355,7 @@ COMMAND_HANDLER(stellaris_handle_mass_erase_command)
 COMMAND_HANDLER(stellaris_handle_recover_command)
 {
        struct flash_bank *bank;
+       struct arm *arm;
        int retval;
 
        if (CMD_ARGC != 0)
@@ -1385,12 +1384,13 @@ COMMAND_HANDLER(stellaris_handle_recover_command)
        }
        adapter_assert_reset();
 
+       arm = target_to_arm(bank->target);
        for (int i = 0; i < 5; i++) {
-               retval = dap_to_swd(bank->target);
+               retval = dap_to_swd(arm->dap);
                if (retval != ERROR_OK)
                        goto done;
 
-               retval = dap_to_jtag(bank->target);
+               retval = dap_to_jtag(arm->dap);
                if (retval != ERROR_OK)
                        goto done;
        }
@@ -1454,4 +1454,5 @@ struct flash_driver stellaris_flash = {
        .erase_check = default_flash_blank_check,
        .protect_check = stellaris_protect_check,
        .info = get_stellaris_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };

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)