Skip to content

Commit 3d0fc2d

Browse files
authored
Merge pull request #5 from Loken1016/patch-2
Update hardware.md
2 parents c31006d + 4f1d2d5 commit 3d0fc2d

File tree

1 file changed

+91
-102
lines changed

1 file changed

+91
-102
lines changed

src/start/hardware.md

Lines changed: 91 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,42 @@
11
# Hardware
22

3-
By now you should be somewhat familiar with the tooling and the development
4-
process. In this section we'll switch to real hardware; the process will remain
5-
largely the same. Let's dive in.
3+
A estas alturas, ya deberías estar familiarizado con las herramientas
4+
y el proceso de desarrollo. En esta sección, hablaremos de hardware real;
5+
el proceso se mantendrá prácticamente igual. Profundicemos.
66

7-
## Know your hardware
7+
## Conoce tu hardware
88

9-
Before we begin you need to identify some characteristics of the target device
10-
as these will be used to configure the project:
9+
Antes de comenzar, es necesario identificar algunas características del dispositivo de destino,
10+
ya que se utilizarán para configurar el proyecto:
1111

12-
- The ARM core. e.g. Cortex-M3.
12+
- El núcleo ARM, Cortex-M3 por ejemplo.
1313

14-
- Does the ARM core include an FPU? Cortex-M4**F** and Cortex-M7**F** cores do.
14+
- ¿El núcleo ARM incluye una FPU? Los núcleos Cortex-M4**F** y Cortex-M7**F** sí la incluyen.
1515

16-
- How much Flash memory and RAM does the target device have? e.g. 256 KiB of
17-
Flash and 32 KiB of RAM.
16+
- ¿Cuánta memoria Flash y RAM tiene el dispositivo de destino? Por ejemplo,
17+
256 KiB de Flash y 32 KiB de RAM.
1818

19-
- Where are Flash memory and RAM mapped in the address space? e.g. RAM is
20-
commonly located at address `0x2000_0000`.
19+
- ¿Dónde se asignan la memoria flash y la RAM en el espacio de direcciones?
20+
Por ejemplo, la RAM suele ubicarse en la dirección `0x2000_0000`.
2121

22-
You can find this information in the data sheet or the reference manual of your
23-
device.
22+
Puede encontrar esta información en la hoja de datos o en el manual de referencia de su dispositivo.
2423

25-
In this section we'll be using our reference hardware, the STM32F3DISCOVERY.
26-
This board contains an STM32F303VCT6 microcontroller. This microcontroller has:
24+
En esta sección, utilizaremos nuestro hardware de referencia, el STM32F3DISCOVERY.
25+
Esta placa contiene un microcontrolador STM32F303VCT6. Este microcontrolador tiene:
2726

28-
- A Cortex-M4F core that includes a single precision FPU
27+
- Un núcleo Cortex-M4F que incluye una única FPU de precisión
2928

30-
- 256 KiB of Flash located at address 0x0800_0000.
29+
- 256 KiB de Flash ubicado en la dirección 0x0800_0000.
3130

32-
- 40 KiB of RAM located at address 0x2000_0000. (There's another RAM region but
33-
for simplicity we'll ignore it).
31+
- 40 KiB de RAM ubicados en la dirección 0x2000_0000. (Hay otra región de RAM,
32+
pero para simplificar, la ignoraremos).
3433

35-
## Configuring
34+
## Configurando
3635

37-
We'll start from scratch with a fresh template instance. Refer to the
38-
[previous section on QEMU] for a refresher on how to do this without
39-
`cargo-generate`.
36+
Empezaremos desde cero con una nueva instancia de plantilla.
37+
Consulta la sección anterior sobre [QEMU] para repasar cómo hacerlo sin ``cargo-generate`.
4038

41-
[previous section on QEMU]: qemu.md
39+
[QEMU]: qemu.md
4240

4341
``` text
4442
$ cargo generate --git https://github.com/rust-embedded/cortex-m-quickstart
@@ -49,7 +47,7 @@ $ cargo generate --git https://github.com/rust-embedded/cortex-m-quickstart
4947
$ cd app
5048
```
5149

52-
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`.
5351

5452
``` console
5553
tail -n5 .cargo/config.toml
@@ -63,13 +61,12 @@ tail -n5 .cargo/config.toml
6361
target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU)
6462
```
6563

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.
7068
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`.
7370

7471
``` text
7572
$ cat memory.x
@@ -81,80 +78,74 @@ MEMORY
8178
RAM : ORIGIN = 0x20000000, LENGTH = 40K
8279
}
8380
```
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`.
8784
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.
9086

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.
9388

9489
```rust,ignore
9590
#[entry]
9691
fn main() -> ! {
9792
hprintln!("Hello, world!").unwrap();
9893
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
10196
// debug::exit(debug::EXIT_SUCCESS);
10297
10398
loop {}
10499
}
105100
```
106101

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.
111106

112107
``` console
113108
cargo build --example hello
114109
```
115110

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).
117115

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
122-
Debugonomicon](https://github.com/rust-embedded/debugonomicon).
116+
Como antes, realizaremos depuración remota y el cliente será un proceso GDB.
117+
1Sin embargo, esta vez, el servidor será OpenOCD.
123118

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.
129120

130121
[verify]: ../intro/install/verify.md
131122

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.
135126

136127
``` console
137128
cat openocd.cfg
138129
```
139130

140131
``` text
141-
# Sample OpenOCD configuration for the STM32F3DISCOVERY development board
132+
# Muestra de configuración OpenOCD para la placa de desarrollo STM32F3DISCOVERY.
142133
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.
145136
146-
# Revision C (newer revision)
137+
# Revisión C (revisión mas nueva)
147138
source [find interface/stlink.cfg]
148139
149-
# Revision A and B (older revisions)
140+
# Revisión A y B (revisiones viejas)
150141
# source [find interface/stlink-v2.cfg]
151142
152143
source [find target/stm32f3x.cfg]
153144
```
154145

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`.
158149
159150
``` text
160151
$ openocd
@@ -176,26 +167,26 @@ Info : Target voltage: 2.913879
176167
Info : stm32f3x.cpu: hardware has 6 breakpoints, 4 watchpoints
177168
```
178169

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.
180171

181172
``` text
182173
gdb-multiarch -q target/thumbv7em-none-eabihf/debug/examples/hello
183174
```
184175

185-
**NOTE**: like before you might need another version of gdb instead of `gdb-multiarch` depending
186-
on which one you installed in the installation chapter. This could also be
187-
`arm-none-eabi-gdb` or just `gdb`.
176+
**NOTA**: Al igual que antes, podría necesitar otra versión de gdb en lugar de `gdb-multiarch`,
177+
dependiendo de la que haya instalado en el capítulo de instalación.
178+
También podría ser `arm-none-eabi-gdb` o simplemente `gdb`.
188179

189-
Next connect GDB to OpenOCD, which is waiting for a TCP connection on port 3333.
180+
A continuación, conecte GDB a OpenOCD, que está esperando una conexión TCP en el puerto 3333.
190181

191182
``` console
192183
(gdb) target remote :3333
193184
Remote debugging using :3333
194185
0x00000000 in ?? ()
195186
```
196187

197-
Now proceed to *flash* (load) the program onto the microcontroller using the
198-
`load` command.
188+
Ahora proceda a *cargar* el programa en el microcontrolador usando el
189+
comando `load`.
199190

200191
``` console
201192
(gdb) load
@@ -206,19 +197,18 @@ Start address 0x08000400, load size 7468
206197
Transfer rate: 13 KB/sec, 2489 bytes/write.
207198
```
208199

209-
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`.
212202

213203
``` console
214204
(gdb) monitor arm semihosting enable
215205
semihosting is enabled
216206
```
217207

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`.
219209
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`.
222212

223213
``` console
224214
(gdb) break main
@@ -232,12 +222,12 @@ Breakpoint 1, hello::__cortex_m_rt_main_trampoline () at examples/hello.rs:11
232222
11 #[entry]
233223
```
234224

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).
239229
240-
Step into the main function with `step`.
230+
Ingrese a la función principal con `step`.
241231

242232
``` console
243233
(gdb) step
@@ -246,8 +236,8 @@ hello::__cortex_m_rt_main () at examples/hello.rs:13
246236
13 hprintln!("Hello, world!").unwrap();
247237
```
248238

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.
251241

252242
``` console
253243
$ openocd
@@ -261,9 +251,9 @@ Info : halted: PC: 0x080004b4
261251
Info : halted: PC: 0x080004b8
262252
Info : halted: PC: 0x080004bc
263253
```
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 {}`
265255

266-
You can now exit GDB using the `quit` command.
256+
Ahora puedes salir de GDB usando el comando `quit`.
267257

268258
``` console
269259
(gdb) quit
@@ -274,8 +264,8 @@ A debugging session is active.
274264
Quit anyway? (y or n)
275265
```
276266

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:
279269

280270
``` console
281271
cat openocd.gdb
@@ -284,10 +274,10 @@ cat openocd.gdb
284274
``` text
285275
target extended-remote :3333
286276
287-
# print demangled symbols
277+
# imprimir símbolos desenredados
288278
set print asm-demangle on
289279
290-
# detect unhandled exceptions, hard faults and panics
280+
# Detectar excepciones no controladas, fallos graves y pánicos
291281
break DefaultHandler
292282
break HardFault
293283
break rust_begin_unwind
@@ -296,29 +286,28 @@ monitor arm semihosting enable
296286
297287
load
298288
299-
# start the process but immediately halt the processor
289+
# Iniciar el proceso pero detener inmediatamente el procesador
300290
stepi
301291
```
302292

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.
305295

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.
309298

310299
``` console
311300
head -n10 .cargo/config.toml
312301
```
313302

314303
``` toml
315304
[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
317306
# runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel"
318307

319308
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
320-
# uncomment ONE of these three option to make `cargo run` start a GDB session
321-
# which option to pick depends on your system
309+
# Descomente UNA de estas tres opciones para hacer que `cargo run` inicie una sesión GDB
310+
# La opción a elegir depende de su sistema.
322311
runner = "arm-none-eabi-gdb -x openocd.gdb"
323312
# runner = "gdb-multiarch -x openocd.gdb"
324313
# runner = "gdb -x openocd.gdb"

0 commit comments

Comments
 (0)