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
Copy file name to clipboardExpand all lines: src/start/semihosting.md
+19-32Lines changed: 19 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,9 @@
1
-
# Semihosting
1
+
# Semialojamiento (Semihosting)
2
2
3
-
Semihosting is a mechanism that lets embedded devices do I/O on the host and is
4
-
mainly used to log messages to the host console. Semihosting requires a debug
5
-
session and pretty much nothing else (no extra wires!) so it's super convenient
6
-
to use. The downside is that it's super slow: each write operation can take
7
-
several milliseconds depending on the hardware debugger (e.g. ST-Link) you use.
3
+
El semihosting es un mecanismo que permite a los dispositivos embebidos realizar operaciones de E/S en el host y se utiliza principalmente para registrar mensajes en la consola del host. El semihosting requiere una sesión de depuración y prácticamente nada más (¡sin cables adicionales!), por lo que es muy práctico. La desventaja es su lentitud: cada operación de escritura puede tardar varios milisegundos, dependiendo del depurador de hardware que se utilice (por ejemplo, ST-Link).
8
4
9
-
The [`cortex-m-semihosting`] crate provides an API to do semihosting operations
10
-
on Cortex-M devices. The program below is the semihosting version of "Hello,
11
-
world!":
5
+
La crate [`cortex-m-semihosting`] crate proporciona una API para realizar operaciones de semihosting
6
+
en dispositivos Cortex-M. El programa siguiente es la versión de semihosting de "¡Hola, mundo!":
If you run this program on hardware you'll see the "Hello, world!" message
33
-
within the OpenOCD logs.
27
+
Si ejecutas este programa en hardware, verás el mensaje "¡Hola, mundo!" en los registros de OpenOCD.
34
28
35
29
```text
36
30
$ openocd
@@ -39,17 +33,15 @@ Hello, world!
39
33
(..)
40
34
```
41
35
42
-
You do need to enable semihosting in OpenOCD from GDB first:
36
+
Primero debes habilitar el semihosting en OpenOCD desde GDB:
43
37
```console
44
38
(gdb) monitor arm semihosting enable
45
39
semihosting is enabled
46
40
```
47
41
48
-
QEMU understands semihosting operations so the above program will also work with
49
-
`qemu-system-arm` without having to start a debug session. Note that you'll
50
-
need to pass the `-semihosting-config` flag to QEMU to enable semihosting
51
-
support; these flags are already included in the `.cargo/config.toml` file of the
52
-
template.
42
+
QEMU entiende las operaciones de semihosting, por lo que el programa anterior también funcionará con
43
+
`qemu-system-arm` sin necesidad de iniciar una sesión de depuración. Tenga en cuenta que deberá pasar la opción `-semihosting-config` a QEMU para habilitar la compatibilidad con semihosting
44
+
estas banderas ya están incluidas en el archivo `.cargo/config.toml` de la plantilla
53
45
54
46
```text
55
47
$ # this program will block the terminal
@@ -58,10 +50,8 @@ $ cargo run
58
50
Hello, world!
59
51
```
60
52
61
-
There's also an `exit` semihosting operation that can be used to terminate the
62
-
QEMU process. Important: do **not** use `debug::exit` on hardware; this function
63
-
can corrupt your OpenOCD session and you will not be able to debug more programs
64
-
until you restart it.
53
+
También existe una operación de semihosting `exit` que se puede usar para finalizar el proceso QEMU. Importante: **no** utilice `debug::exit` en hardware; esta función
54
+
puede dañar su sesión de OpenOCD y no podrá depurar más programas hasta que reinicie la sesión.
65
55
66
56
```rust,ignore
67
57
#![no_main]
@@ -94,12 +84,11 @@ $ echo $?
94
84
1
95
85
```
96
86
97
-
One last tip: you can set the panicking behavior to `exit(EXIT_FAILURE)`. This
98
-
will let you write `no_std` run-pass tests that you can run on QEMU.
87
+
Un último consejo: puedes configurar el comportamiento en caso de pánico a `exit(EXIT_FAILURE)`. Esto te permitirá escribir pruebas de ejecución y aprobación `no_std` que puedes ejecutar en QEMU.
99
88
100
-
For convenience, the `panic-semihosting`crate has an "exit" feature that when
101
-
enabled invokes `exit(EXIT_FAILURE)`after logging the panic message to the host
102
-
stderr.
89
+
Para mayor comodidad, la crate `panic-semihosting`tiene una función "exit" que cuando
90
+
se activa, invoca `exit(EXIT_FAILURE)`después de registrar el mensaje de pánico en el
**NOTE**: To enable this feature on `panic-semihosting`, edit your
135
-
`Cargo.toml` dependencies section where `panic-semihosting` is specified with:
122
+
**NOTA**: Para habilitar esta función en `panic-semihosting`, edite la sección de dependencias de su archivo `Cargo.toml` donde se especifica `panic-semihosting` con:
136
123
137
124
```toml
138
125
panic-semihosting = { version = "VERSION", features = ["exit"] }
139
126
```
140
127
141
-
where `VERSION` is the version desired. For more information on dependencies
142
-
features check the [`specifying dependencies`] section of the Cargo book.
128
+
donde `VERSION` es la versión deseada. Para obtener más información sobre las dependencias, consulte la sección [`especificación de dependencias`] del libro de Cargo.
0 commit comments