8 Commits
6 changed files with 11 additions and 11 deletions
+1 -1
View File
@@ -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, This in turn invokes the Rust runtime, as marked by the `start` language item,
which in turn invokes the main function. 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, neither the crt0 nor the rust runtime are available,
so even implementing `start` would not help us. so even implementing `start` would not help us.
We need to replace the operating system entry point. We need to replace the operating system entry point.
+4 -4
View File
@@ -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. 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> <dl>
<dt>OS</dt> <dt>OS</dt>
@@ -71,8 +71,8 @@ available.
I mentioned that OpenOCD provides a GDB server so let's connect to that right now: I mentioned that OpenOCD provides a GDB server so let's connect to that right now:
``` console ``` console
$ arm-none-eabi-gdb -q target/thumbv6m-none-eabi/debug/rustled $ arm-none-eabi-gdb -q target/thumbv6m-none-eabi/debug/microrust-start
Reading symbols from target/thumbv6m-none-eabi/debug/rustled...done. Reading symbols from target/thumbv6m-none-eabi/debug/microrust-start...done.
(gdb) (gdb)
``` ```
@@ -157,7 +157,7 @@ set print asm-demangle on
# Load your program, breaks at entry # Load your program, breaks at entry
load load
# (optional) Add breakpoint at function # (optional) Add breakpoint at function
break rustled::main break main
# Continue with execution # Continue with execution
continue continue
``` ```
+2 -2
View File
@@ -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: 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. Breakpoint 1 at 0x8000218: file src/main.rs, line 8.
(gdb) continue (gdb) continue
Continuing. Continuing.
Note: automatically using hardware breakpoints for read-only addresses. 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; 13 let x = 42;
``` ```
+1 -1
View File
@@ -4,5 +4,5 @@ version = "0.2.0"
[dependencies] [dependencies]
panic-halt = "~0.2" panic-halt = "~0.2"
microbit="~0.7" microbit="~0.8"
cortex-m-rt="~0.6" cortex-m-rt="~0.6"
+1 -1
View File
@@ -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. 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: Let's check its permissions:
``` shell ``` shell