You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Step number one is to set a default compilation target in`.cargo/config.toml`.
50
+
El paso número uno es establecer un destino de compilación predeterminado en`.cargo/config.toml`.
53
51
54
52
```console
55
53
tail -n5 .cargo/config.toml
@@ -63,13 +61,12 @@ tail -n5 .cargo/config.toml
63
61
target = "thumbv7em-none-eabihf"# Cortex-M4F and Cortex-M7F (with FPU)
64
62
```
65
63
66
-
We'll use `thumbv7em-none-eabihf`as that covers the Cortex-M4F core.
67
-
> **NOTE**: As you may remember from the previous chapter, we have to install
68
-
> all targets and this is a new one. So don't forget to run the installation
69
-
> process `rustup target add thumbv7em-none-eabihf`for this target.
64
+
Usaremos `thumbv7em-none-eabihf`ya que cubre el núcleo Cortex-M4F.
65
+
> **NOTA**: Como recordarás del capítulo anterior, debemos instalar todos los objetivos,
66
+
> y este es uno nuevo. Así que no olvides ejecutar el proceso de instalación `
67
+
> rustup target add thumbv7em-none-eabihf` para este objetivo.
70
68
71
-
The second step is to enter the memory region information into the `memory.x`
72
-
file.
69
+
El segundo paso es ingresar la información de la región de memoria en el archivo `memory.x`.
73
70
74
71
```text
75
72
$ cat memory.x
@@ -81,80 +78,74 @@ MEMORY
81
78
RAM : ORIGIN = 0x20000000, LENGTH = 40K
82
79
}
83
80
```
84
-
> **NOTE**: If you for some reason changed the`memory.x`file after you had made
85
-
> the first build of a specific build target, then do `cargo clean`before
86
-
> `cargo build`, because `cargo build`may not track updates of`memory.x`.
81
+
> **NOTA**: Si por alguna razón modificó el archivo`memory.x`después de haber realizado
82
+
> la primera compilación de un objetivo de compilación específico, ejecute `cargo clean`
83
+
> antes de `cargo build`, ya que `cargo build`podría no rastrear las actualizaciones de`memory.x`.
87
84
88
-
We'll start with the hello example again, but first we have to make a small
89
-
change.
85
+
Comenzaremos nuevamente con el ejemplo de hola, pero primero tenemos que hacer un pequeño cambio.
90
86
91
-
In `examples/hello.rs`, make sure the `debug::exit()` call is commented out or
92
-
removed. It is used only for running in QEMU.
87
+
En `examples/hello.rs`, asegúrese de que la llamada `debug::exit()` esté comentada o eliminada. Solo se usa para ejecutarse en QEMU.
93
88
94
89
```rust,ignore
95
90
#[entry]
96
91
fn main() -> ! {
97
92
hprintln!("Hello, world!").unwrap();
98
93
99
-
// exit QEMU
100
-
// NOTE do not run this on hardware; it can corrupt OpenOCD state
94
+
// salir de QEMU
95
+
// NOTA no ejecute esto en el hardware; puede dañar el estado de OpenOCD
101
96
// debug::exit(debug::EXIT_SUCCESS);
102
97
103
98
loop {}
104
99
}
105
100
```
106
101
107
-
You can now cross compile programs using`cargo build`
108
-
and inspect the binaries using`cargo-binutils` as you did before. The
109
-
`cortex-m-rt` crate handles all the magic required to get your chip running,
110
-
as helpfully, pretty much all Cortex-M CPUs boot in the same fashion.
102
+
Ahora puedes compilar programas de forma cruzada usando`cargo build`
103
+
e inspeccionar los binarios con`cargo-binutils`, como antes. El paquete `cortex-m-rt`
104
+
gestiona todo el proceso necesario para que tu chip funcione, ya que, afortunadamente,
105
+
prácticamente todas las CPU Cortex-M arrancan de la misma manera.
111
106
112
107
```console
113
108
cargo build --example hello
114
109
```
115
110
116
-
## Debugging
111
+
## Depuración
112
+
La depuración será un poco diferente. De hecho, los primeros pasos pueden variar según el dispositivo de destino.
113
+
En esta sección, mostraremos los pasos necesarios para depurar un programa que se ejecuta en el STM32F3DISCOVERY.
114
+
Esto sirve como referencia; para obtener información específica sobre la depuración del dispositivo, consulte [el Debugonomicon](https://github.com/rust-embedded/debugonomicon).
117
115
118
-
Debugging will look a bit different. In fact, the first steps can look different
119
-
depending on the target device. In this section we'll show the steps required to
120
-
debug a program running on the STM32F3DISCOVERY. This is meant to serve as a
121
-
reference; for device specific information about debugging check out [the
Como antes, realizaremos depuración remota y el cliente será un proceso GDB.
117
+
1Sin embargo, esta vez, el servidor será OpenOCD.
123
118
124
-
As before we'll do remote debugging and the client will be a GDB process. This
125
-
time, however, the server will be OpenOCD.
126
-
127
-
As done during the [verify] section connect the discovery board to your laptop /
128
-
PC and check that the ST-LINK header is populated.
119
+
Como se hizo durante la sección [verify], conecte la placa de descubrimiento a su computadora portátil/PC y verifique que el encabezado ST-LINK esté completo.
129
120
130
121
[verify]: ../intro/install/verify.md
131
122
132
-
On a terminal run`openocd`to connect to the ST-LINK on the discovery board.
133
-
Run this command from the root of the template; `openocd`will pick up the
134
-
`openocd.cfg` file which indicates which interface file and target file to use.
123
+
En una terminal, ejecute`openocd`para conectarse al ST-LINK en la placa Discovery.
124
+
Ejecute este comando desde el root del template; `openocd`recuperará el archivo `openocd.cfg`,
125
+
que indica qué archivo de interfaz y archivo de destino usar.
135
126
136
127
```console
137
128
cat openocd.cfg
138
129
```
139
130
140
131
```text
141
-
# Sample OpenOCD configuration for the STM32F3DISCOVERY development board
132
+
# Muestra de configuración OpenOCD para la placa de desarrollo STM32F3DISCOVERY.
142
133
143
-
# Depending on the hardware revision you got you'll have to pick ONE of these
144
-
# interfaces. At any time only one interface should be commented out.
134
+
# Dependiendo de la revisión de hardware que tengas, tendrás que elegir UNO de estas
135
+
# Interfaces. En cualquier momento solo se debe comentar una interfaz.
145
136
146
-
# Revision C (newer revision)
137
+
# Revisión C (revisión mas nueva)
147
138
source [find interface/stlink.cfg]
148
139
149
-
# Revision A and B (older revisions)
140
+
# Revisión A y B (revisiones viejas)
150
141
# source [find interface/stlink-v2.cfg]
151
142
152
143
source [find target/stm32f3x.cfg]
153
144
```
154
145
155
-
> **NOTE**If you found out that you have an older revision of the discovery
156
-
> board during the [verify] section then you should modify the `openocd.cfg`
157
-
> file at this point to use`interface/stlink-v2.cfg`.
146
+
> **NOTA**Si descubrió que tiene una revisión anterior de la
147
+
> placa de descubrimiento durante la sección [verificar], debe modificar el
148
+
> 1archivo `openocd.cfg` en este punto para usar`interface/stlink-v2.cfg`.
158
149
159
150
```text
160
151
$ openocd
@@ -176,26 +167,26 @@ Info : Target voltage: 2.913879
176
167
Info : stm32f3x.cpu: hardware has 6 breakpoints, 4 watchpoints
177
168
```
178
169
179
-
On another terminal run GDB, also from the root of the template.
170
+
En otra terminal ejecute GDB, también desde el root de la template.
The program is now loaded. This program uses semihosting so before we do any
210
-
semihosting call we have to tell OpenOCD to enable semihosting. You can send
211
-
commands to OpenOCD using the `monitor` command.
200
+
El programa ya está cargado. Este programa usa semihosting, así que antes de realizar cualquier llamada a semihosting,
201
+
debemos indicarle a OpenOCD que lo habilite. Puedes enviar comandos a OpenOCD usando el comando `monitor`.
212
202
213
203
```console
214
204
(gdb) monitor arm semihosting enable
215
205
semihosting is enabled
216
206
```
217
207
218
-
> You can see all the OpenOCD commands by invoking the `monitor help` command.
208
+
> Puede ver todos los comandos de OpenOCD invocando el comando `monitor help`.
219
209
220
-
Like before we can skip all the way to `main`using a breakpoint and the
221
-
`continue` command.
210
+
Como antes, podemos saltar directamente a `main`usando un punto de interrupción y el
211
+
comando `continue`.
222
212
223
213
```console
224
214
(gdb) break main
@@ -232,12 +222,12 @@ Breakpoint 1, hello::__cortex_m_rt_main_trampoline () at examples/hello.rs:11
232
222
11 #[entry]
233
223
```
234
224
235
-
> **NOTE**If GDB blocks the terminal instead of hitting the breakpoint after
236
-
> you issue the `continue`command above, you might want to double check that
237
-
> the memory region information in the `memory.x`file is correctly set up
238
-
> for your device (both the starts *and* lengths).
225
+
> **NOTA**Si GDB bloquea la terminal en lugar de alcanzar el punto de interrupción después
226
+
> de emitir el comando `continue`anterior, es posible que desee verificar que la información de la región de
227
+
> memoria en el archivo `memory.x`esté configurada correctamente
228
+
> para su dispositivo (tanto los inicios *como* las longitudes).
239
229
240
-
Step into the main function with`step`.
230
+
Ingrese a la función principal con`step`.
241
231
242
232
```console
243
233
(gdb) step
@@ -246,8 +236,8 @@ hello::__cortex_m_rt_main () at examples/hello.rs:13
246
236
13 hprintln!("Hello, world!").unwrap();
247
237
```
248
238
249
-
After advancing the program with `next` you should see "Hello, world!" printed on the OpenOCD console,
250
-
among other stuff.
239
+
Después de avanzar el programa con `siguiente` deberías ver "¡Hola, mundo!" impreso en la consola OpenOCD,
240
+
entre otras cosas.
251
241
252
242
```console
253
243
$ openocd
@@ -261,9 +251,9 @@ Info : halted: PC: 0x080004b4
261
251
Info : halted: PC: 0x080004b8
262
252
Info : halted: PC: 0x080004bc
263
253
```
264
-
The message is only displayed once as the program is about to enter the infinite loop defined in line 19: `loop {}`
254
+
El mensaje solo se muestra una vez porque el programa está a punto de ingresar al bucle infinito definido en la línea 19: `loop {}`
265
255
266
-
You can now exit GDB using the `quit` command.
256
+
Ahora puedes salir de GDB usando el comando `quit`.
267
257
268
258
```console
269
259
(gdb) quit
@@ -274,8 +264,8 @@ A debugging session is active.
274
264
Quit anyway? (y or n)
275
265
```
276
266
277
-
Debugging now requires a few more steps so we have packed all those steps into a
278
-
single GDB script named `openocd.gdb`. The file was created during the `cargo generate`step, and should work without any modifications. Let's have a peek:
267
+
La depuración ahora requiere algunos pasos adicionales, por lo que los hemos agrupado en un solo script de GDB llamado `openocd.gdb`.
268
+
El archivo se creó durante el paso `cargo generate`y debería funcionar sin modificaciones. Echemos un vistazo:
279
269
280
270
```console
281
271
cat openocd.gdb
@@ -284,10 +274,10 @@ cat openocd.gdb
284
274
```text
285
275
target extended-remote :3333
286
276
287
-
# print demangled symbols
277
+
# imprimir símbolos desenredados
288
278
set print asm-demangle on
289
279
290
-
# detect unhandled exceptions, hard faults and panics
280
+
# Detectar excepciones no controladas, fallos graves y pánicos
291
281
break DefaultHandler
292
282
break HardFault
293
283
break rust_begin_unwind
@@ -296,29 +286,28 @@ monitor arm semihosting enable
296
286
297
287
load
298
288
299
-
# start the process but immediately halt the processor
289
+
# Iniciar el proceso pero detener inmediatamente el procesador
300
290
stepi
301
291
```
302
292
303
-
Now running `<gdb> -x openocd.gdb target/thumbv7em-none-eabihf/debug/examples/hello`will immediately connect GDB to
304
-
OpenOCD, enable semihosting, load the program and start the process.
293
+
Ahora, al ejecutar `<gdb> -x openocd.gdb target/thumbv7em-none-eabihf/debug/examples/hello`se conectará inmediatamente GDB a
294
+
OpenOCD, habilitará el semihosting, cargará el programa e iniciará el proceso.
305
295
306
-
Alternatively, you can turn `<gdb> -x openocd.gdb` into a custom runner to make
307
-
`cargo run` build a program *and* start a GDB session. This runner is included
308
-
in `.cargo/config.toml` but it's commented out.
296
+
Como alternativa, puedes convertir `<gdb> -x openocd.gdb` en un ejecutor personalizado para que
297
+
`cargo run` cree un programa *e* inicie una sesión de GDB. Este ejecutor está incluido en `.cargo/config.toml`, pero está comentado.
309
298
310
299
```console
311
300
head -n10 .cargo/config.toml
312
301
```
313
302
314
303
```toml
315
304
[target.thumbv7m-none-eabi]
316
-
#uncomment this to make `cargo run` execute programs on QEMU
305
+
#Descomente esto para hacer que `cargo run` ejecute programas en QEMU
0 commit comments