jtag: linuxgpiod: drop extra parenthesis
[openocd.git] / src / target / espressif / esp.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
2
3 /***************************************************************************
4 * Espressif chips common target API for OpenOCD *
5 * Copyright (C) 2021 Espressif Systems Ltd. *
6 ***************************************************************************/
7
8 #ifdef HAVE_CONFIG_H
9 #include "config.h"
10 #endif
11
12 #include <helper/log.h>
13 #include <helper/binarybuffer.h>
14 #include "target/target.h"
15 #include "esp.h"
16
17 int esp_common_init(struct esp_common *esp, const struct esp_algorithm_hw *algo_hw)
18 {
19 if (!esp)
20 return ERROR_FAIL;
21
22 esp->algo_hw = algo_hw;
23
24 return ERROR_OK;
25 }
26
27 int esp_dbgstubs_table_read(struct target *target, struct esp_dbg_stubs *dbg_stubs)
28 {
29 uint32_t table_size, table_start_id, desc_entry_id, gcov_entry_id;
30 uint32_t entries[ESP_DBG_STUB_ENTRY_MAX] = {0};
31 uint8_t entry_buff[sizeof(entries)] = {0}; /* to avoid endiannes issues */
32
33 LOG_TARGET_DEBUG(target, "Read debug stubs info %" PRIx32 " / %d", dbg_stubs->base, dbg_stubs->entries_count);
34
35 /* First of, read 2 entries to get magic num and table size */
36 int res = target_read_buffer(target, dbg_stubs->base, sizeof(uint32_t) * 2, entry_buff);
37 if (res != ERROR_OK) {
38 LOG_ERROR("%s: Failed to read first debug stub entry!", target_name(target));
39 return res;
40 }
41 entries[0] = target_buffer_get_u32(target, entry_buff);
42 entries[1] = target_buffer_get_u32(target, entry_buff + sizeof(uint32_t));
43
44 if (entries[0] != ESP_DBG_STUB_MAGIC_NUM_VAL) {
45 /* idf with the old table entry structure */
46 table_size = 2;
47 table_start_id = 0;
48 desc_entry_id = 0;
49 gcov_entry_id = 1;
50 } else {
51 table_size = entries[1];
52 table_start_id = ESP_DBG_STUB_TABLE_START;
53 desc_entry_id = ESP_DBG_STUB_TABLE_START;
54 gcov_entry_id = ESP_DBG_STUB_ENTRY_FIRST;
55
56 /* discard unsupported entries */
57 if (table_size > ESP_DBG_STUB_ENTRY_MAX)
58 table_size = ESP_DBG_STUB_ENTRY_MAX;
59
60 /* now read the remaining entries */
61 res = target_read_buffer(target, dbg_stubs->base + 2 * sizeof(uint32_t), sizeof(uint32_t) * table_size - 2,
62 entry_buff + sizeof(uint32_t) * 2);
63 if (res != ERROR_OK) {
64 LOG_TARGET_ERROR(target, "Failed to read debug stubs info!");
65 return res;
66 }
67 for (unsigned int i = 2; i < table_size; ++i)
68 entries[i] = target_buffer_get_u32(target, entry_buff + sizeof(uint32_t) * i);
69
70 dbg_stubs->entries[ESP_DBG_STUB_CAPABILITIES] = entries[ESP_DBG_STUB_CAPABILITIES];
71 }
72
73 dbg_stubs->entries[ESP_DBG_STUB_DESC] = entries[desc_entry_id];
74 dbg_stubs->entries[ESP_DBG_STUB_ENTRY_GCOV] = entries[gcov_entry_id];
75
76 for (enum esp_dbg_stub_id i = ESP_DBG_STUB_DESC; i < ESP_DBG_STUB_ENTRY_MAX; i++) {
77 LOG_DEBUG("Check dbg stub %d - %x", i, dbg_stubs->entries[i]);
78 if (dbg_stubs->entries[i]) {
79 LOG_DEBUG("New dbg stub %d at %x", dbg_stubs->entries_count, dbg_stubs->entries[i]);
80 dbg_stubs->entries_count++;
81 }
82 }
83 if (dbg_stubs->entries_count < table_size - table_start_id)
84 LOG_WARNING("Not full dbg stub table %d of %d", dbg_stubs->entries_count, table_size - table_start_id);
85
86 return ERROR_OK;
87 }

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)