Skip to content

Commit 0c7cbbb

Browse files
authored
Merge pull request #7 from Loken1016/patch-4
Update semihosting.md
2 parents 52395e2 + 507c88b commit 0c7cbbb

File tree

1 file changed

+19
-32
lines changed

1 file changed

+19
-32
lines changed

src/start/semihosting.md

Lines changed: 19 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
1-
# Semihosting
1+
# Semialojamiento (Semihosting)
22

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

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!":
127

138
[`cortex-m-semihosting`]: https://crates.io/crates/cortex-m-semihosting
149

@@ -29,8 +24,7 @@ fn main() -> ! {
2924
}
3025
```
3126

32-
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.
3428

3529
``` text
3630
$ openocd
@@ -39,17 +33,15 @@ Hello, world!
3933
(..)
4034
```
4135

42-
You do need to enable semihosting in OpenOCD from GDB first:
36+
Primero debes habilitar el semihosting en OpenOCD desde GDB:
4337
``` console
4438
(gdb) monitor arm semihosting enable
4539
semihosting is enabled
4640
```
4741

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
5345

5446
``` text
5547
$ # this program will block the terminal
@@ -58,10 +50,8 @@ $ cargo run
5850
Hello, world!
5951
```
6052

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

6656
```rust,ignore
6757
#![no_main]
@@ -94,12 +84,11 @@ $ echo $?
9484
1
9585
```
9686

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

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
91+
stderr (salida de errores) del host.
10392

10493
```rust,ignore
10594
#![no_main]
@@ -130,16 +119,14 @@ panicked at 'assertion failed: `(left == right)`
130119
$ echo $?
131120
1
132121
```
133-
134-
**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:
136123

137124
``` toml
138125
panic-semihosting = { version = "VERSION", features = ["exit"] }
139126
```
140127

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

144-
[`specifying dependencies`]:
130+
[`especificación de dependencias`]:
145131
https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html
132+

0 commit comments

Comments
 (0)