flash/stm32l4x: fix dual bank support for STM32L552xC devices
[openocd.git] / src / rtos / rtos.h
1 /***************************************************************************
2 * Copyright (C) 2011 by Broadcom Corporation *
3 * Evan Hunter - ehunter@broadcom.com *
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, see <http://www.gnu.org/licenses/>. *
17 ***************************************************************************/
18
19 #ifndef OPENOCD_RTOS_RTOS_H
20 #define OPENOCD_RTOS_RTOS_H
21
22 #include "server/server.h"
23 #include "target/target.h"
24 #include <jim-nvp.h>
25
26 typedef int64_t threadid_t;
27 typedef int64_t symbol_address_t;
28
29 struct reg;
30
31 /**
32 * Table should be terminated by an element with NULL in symbol_name
33 */
34 struct symbol_table_elem {
35 const char *symbol_name;
36 symbol_address_t address;
37 bool optional;
38 };
39
40 struct thread_detail {
41 threadid_t threadid;
42 bool exists;
43 char *thread_name_str;
44 char *extra_info_str;
45 };
46
47 struct rtos {
48 const struct rtos_type *type;
49
50 struct symbol_table_elem *symbols;
51 struct target *target;
52 /* add a context variable instead of global variable */
53 /* The thread currently selected by gdb. */
54 int64_t current_threadid;
55 /* The currently selected thread according to the target. */
56 threadid_t current_thread;
57 struct thread_detail *thread_details;
58 int thread_count;
59 int (*gdb_thread_packet)(struct connection *connection, char const *packet, int packet_size);
60 int (*gdb_target_for_threadid)(struct connection *connection, int64_t thread_id, struct target **p_target);
61 void *rtos_specific_params;
62 };
63
64 struct rtos_reg {
65 uint32_t number;
66 uint32_t size;
67 uint8_t value[16];
68 };
69
70 struct rtos_type {
71 const char *name;
72 bool (*detect_rtos)(struct target *target);
73 int (*create)(struct target *target);
74 int (*smp_init)(struct target *target);
75 int (*update_threads)(struct rtos *rtos);
76 /** Return a list of general registers, with their values filled out. */
77 int (*get_thread_reg_list)(struct rtos *rtos, int64_t thread_id,
78 struct rtos_reg **reg_list, int *num_regs);
79 int (*get_thread_reg)(struct rtos *rtos, int64_t thread_id,
80 uint32_t reg_num, struct rtos_reg *reg);
81 int (*get_symbol_list_to_lookup)(struct symbol_table_elem *symbol_list[]);
82 int (*clean)(struct target *target);
83 char * (*ps_command)(struct target *target);
84 int (*set_reg)(struct rtos *rtos, uint32_t reg_num, uint8_t *reg_value);
85 /* Implement these if different threads in the RTOS can see memory
86 * differently (for instance because address translation might be different
87 * for each thread). */
88 int (*read_buffer)(struct rtos *rtos, target_addr_t address, uint32_t size,
89 uint8_t *buffer);
90 int (*write_buffer)(struct rtos *rtos, target_addr_t address, uint32_t size,
91 const uint8_t *buffer);
92 };
93
94 struct stack_register_offset {
95 unsigned short number; /* register number */
96 signed short offset; /* offset in bytes from stack head, or -1 to indicate
97 * register is not stacked, or -2 to indicate this is the
98 * stack pointer register */
99 unsigned short width_bits;
100 };
101
102 struct rtos_register_stacking {
103 unsigned char stack_registers_size;
104 signed char stack_growth_direction;
105 unsigned char num_output_registers;
106 /* Some targets require evaluating the stack to determine the
107 * actual stack pointer for a process. If this field is NULL,
108 * just use stacking->stack_registers_size * stack_growth_direction
109 * to calculate adjustment.
110 */
111 int64_t (*calculate_process_stack)(struct target *target,
112 const uint8_t *stack_data,
113 const struct rtos_register_stacking *stacking,
114 int64_t stack_ptr);
115 const struct stack_register_offset *register_offsets;
116 };
117
118 #define GDB_THREAD_PACKET_NOT_CONSUMED (-40)
119
120 int rtos_create(struct jim_getopt_info *goi, struct target *target);
121 void rtos_destroy(struct target *target);
122 int rtos_set_reg(struct connection *connection, int reg_num,
123 uint8_t *reg_value);
124 int rtos_generic_stack_read(struct target *target,
125 const struct rtos_register_stacking *stacking,
126 int64_t stack_ptr,
127 struct rtos_reg **reg_list,
128 int *num_regs);
129 int gdb_thread_packet(struct connection *connection, char const *packet, int packet_size);
130 int rtos_get_gdb_reg(struct connection *connection, int reg_num);
131 int rtos_get_gdb_reg_list(struct connection *connection);
132 int rtos_update_threads(struct target *target);
133 void rtos_free_threadlist(struct rtos *rtos);
134 int rtos_smp_init(struct target *target);
135 /* function for handling symbol access */
136 int rtos_qsymbol(struct connection *connection, char const *packet, int packet_size);
137 int rtos_read_buffer(struct target *target, target_addr_t address,
138 uint32_t size, uint8_t *buffer);
139 int rtos_write_buffer(struct target *target, target_addr_t address,
140 uint32_t size, const uint8_t *buffer);
141
142 #endif /* OPENOCD_RTOS_RTOS_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)