Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 0 additions & 45 deletions src/Debugger.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,48 +227,3 @@ _lf_invoke_reaction (env=env@entry=0x200018d0 <envs>, reaction=reaction@entry=0x

At this point, the LED should have gone from off to on (or on to off, depending on its state when you connected gdb).

### Visual Studio Code

Breakpoints can be placed in generated lingua franca project source code within **vscode**.
As a part of the code generation process, each lfc generates a ``.vscode`` directory in the program ``src-gen`` folder.
This is populated with settings to configure and run ``gdb``, ``openocd`` and ``cmake``.

Run the following after generating code for the desired lf program:

```bash
$ code src-gen/Blink/
```

In vscode, navigate to the run and debug tab on the left. A **Pico Debug** option should appear at the top as shown here:

<img src="img/vscode-debug.png" alt="Debugging in VSCode"/>

First, you will need for VS Code to build the project. Clean up from the previous `lfc` builds as follows:

```bash
rm -rf src-gen/Blink/build
```

Then click on the blue `Build` button at the bottom of the VS Code window.

Make sure the *picoprobe* is connected and wired as noted above and click run (the green triangle). The debugger should automatically break
at the ``main`` method of the application. Breakpoints can be visually inserted and other debugger options are accessible through
the IDE gui.

**Troubleshooting:** Depending on the platform you are running on and how `gdb` was installed, you may see the following error when try to run the program:

<img src="img/vscode-error.png" alt="VS Code error screen" width="50%"/>

Click on `Open 'launch.json'` and edit this line:

```
"gdbPath" : "gdb-multiarch",
```

This line specifies the `gdb` program to use. It may be simply:

```
"gdbPath" : "gdb",
```


18 changes: 18 additions & 0 deletions src/Non-Nix.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,24 @@ $ echo "export PICO_SDK_PATH=$PICO_SDK_PATH" >> ~/.profile

__Caution__: Depending on what operating system and terminal you use, and how it is configured, you may need to find some other way to set this environment variable.

### Robot Board Header
To support different pin configurations for rp2040 based boards, pico-sdk uses board header files found in `pico-sdk/src/boards/include/boards`.
When building binaries for boards other than the raspberrypi pico, `-DPICO_BOARD=<board_name>` can be passed to the cmake command
where `<board_name>` is the header name.

The board header for the 3pi robot in the repo might not correctly map the uart pins. Modify `pololu_3pi_2040_robot.h` in the board header directory
to include the following lines:

``` C
#ifndef PICO_DEFAULT_UART_TX_PIN
#define PICO_DEFAULT_UART_TX_PIN 28
#endif

#ifndef PICO_DEFAULT_UART_RX_PIN
#define PICO_DEFAULT_UART_RX_PIN 29
#endif
```

## Install `picotool`
To build and install `picotool` from source, run the following commands:

Expand Down
4 changes: 0 additions & 4 deletions src/Prerequisites.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,11 @@ Please ensure that you have the following extensions installed:
- `ms-vscode.cpptools` — [C/C++ IntelliSense, debugging, and code browsing](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools)
- `lf-lang.vscode-lingua-franca` — [Lingua Franca for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=lf-lang.vscode-lingua-franca)

For debugging support in VS Code:
- `marus25.cortex-debug` — [ARM Cortex-M GDB Debugger support for VSCode](https://marketplace.visualstudio.com/items?itemName=marus25.cortex-debug)

To install them from the command line, run:
```bash
$ code --install-extension ms-vscode.cmake-tools
$ code --install-extension ms-vscode.cpptools
$ code --install-extension lf-lang.vscode-lingua-franca --pre-release
$ code --install-extension marus25.cortex-debug
```

## Permissions
Expand Down
Binary file removed src/img/vscode-debug.png
Binary file not shown.
Binary file removed src/img/vscode-error.png
Binary file not shown.