Skip to content

For Developers

R. van Twisk edited this page Sep 16, 2024 · 4 revisions

For developers

This section describes how to make code modifications and create a new uf2 file that can be put on OpenAce.

For simple changes or small bug fixes it's usually easer to use the docker container. Compilation will be slower and you have to copy the openace.uf2 file manually to your PICO. However, you only need docker install and all work is done in the container

For all methods, you do need a the repository installed locally, here is how to do that:

Getting the source

This will get the repository, and get all submodules

git clone --recurse-submodules https://github.com/rvt/OpenAce

How to build with docker

Within the OpenAce directory issue:

cd src
docker build -t openace-build-image .

And to build the project itself you only have to issue in the same src directory.

docker run --rm -v $(pwd):/opt/src openace-build-image

The first build will take some time to complete. However when you modify the subsequent build files they will be a lot faster because the docker container has been build and all your compiled modules will be re-used and only teh changes will be compiled.

How to setup the development environment

Installing the Tools (MAC)

Caution

How have not tested this in a while, do let me know if you find any issues with this.

Documentation used:

I have installed everything in a directory called /opt/pico to keep things together.

  • Install the SDK:
    • In Terminal, go to your projects directory, eg. /opt/pico
    • Run git clone -b master --recurse-submodules https://github.com/raspberrypi/pico-sdk.git
    • Edit your .bash_profile or .zshrc and add: export PICO_SDK_PATH="/opt/pico/pico-sdk"
  • Install FreeRTOS
    git clone -b master --recurse-submodules https://github.com/FreeRTOS/FreeRTOS-Kernel
    Edit your .bash_profile or .zshrc and add: `export FREERSTOS_KERNEL_PATH="/opt/pico/FreeRTOS-Kernel"
    

* Install the toolchain, don't use brew it seems to be broken:
  * Download toolchain from [Arm GNU Toolchain](https://developer.arm.com/downloads/-/gnu-rm)
  * Add `export PATH=/Applications/ARM/bin:$PATH` to you `.zshrc` or `.bash_profile`
  * Add `export PICO_TOOLCHAIN_PATH="/Applications/ARM"`
* Configure the IDE:
  * Run — or install and then run — Microsoft Visual Studio Code.
  * Click on the Extensions icon.
  * Enter CMake Tools in the search field.
  * Locate CMake Tools by Microsoft and click Install.

* From within Visual Studio Code, open the folder src.
* When CMakeTools asks you if to configure project, say yes.
* When asked to select a kit, select GCC for arm-none-eabi x.y.z.

Install OpenOCD (Strongly recommended if you want to develop on this board) from [openocd](https://github.com/xpack-dev-tools/openocd-xpack/releases) the one from brew did not work
and set "cortex-debug.openocdPath": `<your install path>/bin/openocd` in `settings.json`

A launch configuration is included for Visual Studio Code

```json
        { "name": "Pico Debug",
        "device": "RP2040",
        "gdbPath": "arm-none-eabi-gdb",
        "cwd": "${workspaceRoot}",
        "executable": "${command:cmake.launchTargetPath}",
        "request": "launch",
        "type": "cortex-debug",
        "servertype": "openocd",
        "configFiles": [
          "interface/cmsis-dap.cfg",
          "target/rp2040.cfg"
        ],
        "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd",
        "runToEntryPoint": "",
        "showDevDebugOutput": "raw",
        "postRestartCommands": [
          "break main",
          "continue"
        ]
      },

If you get something like adapter speed then add adapter speed 12000 to target/rp2040.cfg (in openocd configuration directory)