Skip to content

Commit

Permalink
Update 05-led-roulette/my-solution.md and examples/my-solution.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
nikgul committed Jun 19, 2024
1 parent 9707b7e commit 019afa9
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 29 deletions.
7 changes: 7 additions & 0 deletions microbit/src/05-led-roulette/examples/my-solution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ fn main() -> ! {
rtt_init_print!();

let board = Board::take().unwrap();

let mut timer = Timer::new(board.TIMER0);
let mut display = Display::new(board.display_pins);

// Setup the display delay so the math works as expected later.
display.set_delay_ms(1);

let mut leds = [
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0],
Expand All @@ -37,7 +42,9 @@ fn main() -> ! {
for current_led in PIXELS.iter() {
leds[last_led.0][last_led.1] = 0;
leds[current_led.0][current_led.1] = 1;

display.show(&mut timer, leds, 30);

last_led = *current_led;
}
}
Expand Down
60 changes: 31 additions & 29 deletions microbit/src/05-led-roulette/my-solution.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ $ cargo embed --features v1 --target thumbv6m-none-eabi --release
(...)
```

If you want to debug your "release" mode binary you'll have to use a different GDB command:
If you want to debug your "release" mode binary you'll have to use a different GDB command to load the other binary:

``` console
# For micro:bit v2
Expand All @@ -41,49 +41,51 @@ $ cargo size --features v2 --target thumbv7em-none-eabihf -- -A
led-roulette :
section size addr
.vector_table 256 0x0
.text 26984 0x100
.rodata 2732 0x6a68
.text 33564 0x100
.rodata 4824 0x6a68
.data 0 0x20000000
.gnu.sgstubs 0 ox9700
.bss 1092 0x20000000
.uninit 0 0x20000444
.debug_abbrev 33941 0x0
.debug_info 494113 0x0
.debug_aranges 23528 0x0
.debug_ranges 130824 0x0
.debug_str 498781 0x0
.debug_pubnames 143351 0x0
.debug_pubtypes 124464 0x0
.debug_loc 5446 0x0
.debug_abbrev 22709 0x0
.debug_info 630006 0x0
.debug_aranges 22488 0x0
.debug_ranges 186616 0x0
.debug_str 726748 0x0
.comment 64 0x0
.ARM.attributes 58 0x0
.debug_frame 69128 0x0
.debug_line 290580 0x0
.debug_loc 1449 0x0
.comment 109 0x0
Total 1841390
.debug_frame 71712 0x0
.debug_line 320979 0x0
.debug_pubnames 702 0x0
.debug_pubtypes 71 0x0
Total 2027335


$ cargo size --features v2 --target thumbv7em-none-eabihf --release -- -A
Finished release [optimized + debuginfo] target(s) in 0.02s
led-roulette :
section size addr
.vector_table 256 0x0
.text 6332 0x100
.rodata 648 0x19bc
.text 6516 0x100
.rodata 612 0x19bc
.data 0 0x20000000
.gnu.sgstubs 0 0x1ce0
.bss 1076 0x20000000
.uninit 0 0x20000434
.debug_loc 9036 0x0
.debug_abbrev 2754 0x0
.debug_info 96460 0x0
.debug_aranges 1120 0x0
.debug_ranges 11520 0x0
.debug_str 71325 0x0
.debug_pubnames 32316 0x0
.debug_pubtypes 29294 0x0
.debug_loc 10784 0x0
.debug_abbrev 3159 0x0
.debug_info 63612 0x0
.debug_aranges 1040 0x0
.debug_ranges 11576 0x0
.debug_str 69813 0x0
.comment 64 0x0
.ARM.attributes 58 0x0
.debug_frame 2108 0x0
.debug_line 19303 0x0
.comment 109 0x0
Total 283715
.debug_frame 2084 0x0
.debug_line 18180 0x0
.debug_pubnames 702 0x0
.debug_pubtypes 71 0x0
Total 189603

# micro:bit v1
$ cargo size --features v1 --target thumbv6m-none-eabi -- -A
Expand Down

0 comments on commit 019afa9

Please sign in to comment.