Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1587daf5d1 | ||
|
|
4d631b12aa | ||
|
|
72532bcee1 | ||
|
|
6ed3b08955 | ||
|
|
254312a988 | ||
|
|
4b6be8fb61 | ||
|
|
74c52e42b6 | ||
|
|
74950c7a78 |
@@ -136,7 +136,7 @@ executing the binary usually has the operating system start by executing the C r
|
||||
This in turn invokes the Rust runtime, as marked by the `start` language item,
|
||||
which in turn invokes the main function.
|
||||
|
||||
Having enabled `no_std`, as we are targeting on a microcontroller,
|
||||
Having enabled `no_std`, as we are targeting a microcontroller,
|
||||
neither the crt0 nor the rust runtime are available,
|
||||
so even implementing `start` would not help us.
|
||||
We need to replace the operating system entry point.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
Flashing is the process of moving our program into the microcontroller's (persistent) memory. Once flashed, the microcontroller will execute the flashed program every time it is powered on.
|
||||
|
||||
In this case, our `rustled` program will be the only program in the microcontroller memory. By this I mean that there's nothing else running on the microcontroller: no OS, no daemon, nothing. `rustled` has full control over the device. This is what is meant by *bare-metal* programming.
|
||||
In this case, our `microrust-start` program will be the only program in the microcontroller memory. By this I mean that there's nothing else running on the microcontroller: no OS, no daemon, nothing. `microrust-start` has full control over the device. This is what is meant by *bare-metal* programming.
|
||||
|
||||
<dl>
|
||||
<dt>OS</dt>
|
||||
@@ -71,8 +71,8 @@ available.
|
||||
I mentioned that OpenOCD provides a GDB server so let's connect to that right now:
|
||||
|
||||
``` console
|
||||
$ arm-none-eabi-gdb -q target/thumbv6m-none-eabi/debug/rustled
|
||||
Reading symbols from target/thumbv6m-none-eabi/debug/rustled...done.
|
||||
$ arm-none-eabi-gdb -q target/thumbv6m-none-eabi/debug/microrust-start
|
||||
Reading symbols from target/thumbv6m-none-eabi/debug/microrust-start...done.
|
||||
(gdb)
|
||||
```
|
||||
|
||||
@@ -157,9 +157,9 @@ set print asm-demangle on
|
||||
# Load your program, breaks at entry
|
||||
load
|
||||
# (optional) Add breakpoint at function
|
||||
break rustled::main
|
||||
break main
|
||||
# Continue with execution
|
||||
continue
|
||||
```
|
||||
|
||||
Now we can learn how to debug code on the micro:bit.
|
||||
Now we can learn how to debug code on the micro:bit.
|
||||
|
||||
@@ -28,14 +28,14 @@ At this time, we are not interested in that "pre-main" part so let's skip right
|
||||
the `main` function. We'll do that using a breakpoint:
|
||||
|
||||
```
|
||||
(gdb) break rustled::main
|
||||
(gdb) break main
|
||||
Breakpoint 1 at 0x8000218: file src/main.rs, line 8.
|
||||
|
||||
(gdb) continue
|
||||
Continuing.
|
||||
Note: automatically using hardware breakpoints for read-only addresses.
|
||||
|
||||
Breakpoint 1, rustled::main () at src/rustled/src/main.rs:13
|
||||
Breakpoint 1, main () at src/microrust-start/src/main.rs:13
|
||||
13 let x = 42;
|
||||
```
|
||||
|
||||
|
||||
@@ -4,5 +4,5 @@ version = "0.2.0"
|
||||
|
||||
[dependencies]
|
||||
panic-halt = "~0.2"
|
||||
microbit="~0.7"
|
||||
microbit="~0.8"
|
||||
cortex-m-rt="~0.6"
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
|
||||
In this chapter, we will discuss the basic I/O of embedded development in rust.
|
||||
|
||||
After this chapter,you should have all the neccesary basic knowledge to do embedded development in Rust,
|
||||
After this chapter, you should have all the neccesary basic knowledge to do embedded development in Rust,
|
||||
with anything remaining being solution specific.
|
||||
|
||||
@@ -18,7 +18,7 @@ Bus 002 Device 033: ID 0d28:0204 NXP ARM mbed
|
||||
```
|
||||
|
||||
In my case, the micro:bit got connected to the bus #2 and got enumerated as the device #33.
|
||||
This means the file `/dev/bus/usb/002/033` *is* the Fmicro:bit3.
|
||||
This means the file `/dev/bus/usb/002/033` is the micro:bit.
|
||||
Let's check its permissions:
|
||||
|
||||
``` shell
|
||||
|
||||
Reference in New Issue
Block a user