Skip to content

Commit

Permalink
Merge pull request #23 from NiklasRentzCAU/nre/fixes
Browse files Browse the repository at this point in the history
Minor fixes
  • Loading branch information
edwardalee authored Mar 8, 2024
2 parents 09f02b4 + cadf7dc commit 93a7361
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/Debugger.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ target C {
name: "rp2040",
board: "pololu_3pi_2040_robot"
},
threading: false,
single-threaded: true,
build-type: debug
}
```
Expand Down Expand Up @@ -152,7 +152,7 @@ In a separate terminal window, run the following `gdb` session specifying the `.
gdb bin/Blink.elf
```
Once the GDB environment is opened, connect to the debug server using the following. Each of the two cores exposes its own port.
With `threading` set to `false` in the target directive, `core0` runs the main thread, so you want to connect gdb to port `3333`:
With `single-threaded` set to `true` in the target directive, `core0` runs the main thread, so you want to connect gdb to port `3333`:

```bash
(gdb) target extended-remote localhost:3333
Expand Down
2 changes: 1 addition & 1 deletion src/Interrupts.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ sure to understand static variables in C.
name: "rp2040",
board: "pololu_3pi_2040_robot"
},
threading: false,
single-threaded: true,
keepalive: true
}
```
Expand Down
4 changes: 2 additions & 2 deletions src/Sensors.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ You should see the display light up looking something like this:

2. Notice the `target` specification at the top of each of the .lf files. What do you think is the significance of the directive:

```threading: false```
```single-threaded: true```
**CHECKOFF:** Explain what the four reactions do and the importance of threading being turned off.
**CHECKOFF:** Explain what the four reactions do and the importance of single-threaded being turned on.

## 4.3 Measuring Tilt

Expand Down
10 changes: 6 additions & 4 deletions src/Tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ $ screen -r

To permanently end screen, type Control-A k (for kill).

If screen immediately exits with the message `[screen is terminating]`, you might need to execute it with root rights.

**Checkoff:** Show ON-OFF output.

## 3.5 Modular Reusable Reactors
Expand All @@ -294,7 +296,7 @@ target C {
name: "rp2040",
board: "pololu_3pi_2040_robot"
},
threading: false,
single-threaded: true: false,
}
preamble {=
#include <hardware/gpio.h>
Expand All @@ -316,7 +318,7 @@ Then create a new LF file called `ToolsLEDSolution.lf` that imports this reactor

- [Inputs and Outputs](https://www.lf-lang.org/docs/handbook/inputs-and-outputs?target=c)
- [Composing Reactors](https://www.lf-lang.org/docs/handbook/composing-reactors?target=c)
- [Reactions and Methods](https://www.lf-lang.org/docs/handbook/reactions-and-methods?target=c)
- [Reactions](https://www.lf-lang.org/docs/handbook/reactions?target=c)

You have probably noticed some patterns here. E.g., each LF file begins with this:

Expand All @@ -326,11 +328,11 @@ target C {
name: "rp2040",
board: "pololu_3pi_2040_robot"
},
threading: false,
single-threaded: true,
}
```

This specifies that the target language is C, so the `lfc` compiler generates C programs. The platform specification indicates that the C runtime system for the Raspberry Pi 2040 should be used and that the target board is the Pololu robot. The `threading` directive indicates that the target is bare metal machine with no operating system and no thread library.
This specifies that the target language is C, so the `lfc` compiler generates C programs. The platform specification indicates that the C runtime system for the Raspberry Pi 2040 should be used and that the target board is the Pololu robot. The `single-threaded` directive indicates that the target is bare metal machine with no operating system and no thread library.

To initialize and toggle the LED, we are using library functions like `gpio_put` which are declared in a header file `gpio.h` that is part of the standard Pico SDK.
Inclusion of this header file is a consequence of this directive:
Expand Down

0 comments on commit 93a7361

Please sign in to comment.