Commit 5ec6200d authored by Gallacchi Mattia's avatar Gallacchi Mattia
Browse files

Update build and docker image

parent 8f7167f0
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ Documents found that could be useful.
Program that run to the PC to configure the camera and acquire images.

## uc
Code of the Raspberry Pi Pico which generates trigger signal and flashs.
Code of the Raspberry Pi Pico which generates trigger signal and flash.
Can be controlled via UART. 

## ui
+6 −2
Original line number Diff line number Diff line
{
    "image" : "labinfo.ing.he-arc.ch:5050/igib/shared/ci-docker/pico-sdk:latest",
    "runArgs": ["--name", "pico-sdk-container"],
    "name": "pico-sdk",
    "name": "pi-etat-marche-sdk",
    "privileged": true,
    "updateRemoteUserUID": true,
    "postStartCommand": "sudo service ssh start && /bin/bash",
    "postAttachCommand": "/bin/bash",
    "customizations": {
        "vscode": {
            "extensions": [
                "ms-vscode.cpptools-extension-pack",
                "ms-vscode.cmake-tools"
                "ms-vscode.cmake-tools",
                "mcu-debug.debug-tracker-vscode",
                "marus25.cortex-debug"
            ]
        }

    }
}
 No newline at end of file
+37 −0
Original line number Diff line number Diff line
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "cwd": "${workspaceRoot}",
            "executable": "${workspaceRoot}/code/build/PI_ContrHorlo.elf",
            "name": "Debug with OpenOCD",
            "request": "launch",
            "type": "cortex-debug",
            "servertype": "openocd",
            "gdbPath": "arm-none-eabi-gdb",
            "device": "RP2040",
            "interface": "swd",
            "configFiles": [
                "interface/cmsis-dap.cfg",
                "target/rp2040.cfg"
            ],
            "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd",
            "searchDir": [
                "/usr/local/share/openocd/scripts/",
            ],
            "runToEntryPoint": "main",
            // Work around for stopping at main on restart
            "postRestartCommands": [
                "break main",
                "continue"
            ],
            "openOCDLaunchCommands": [
                "adapter speed 5000"
            ],
            "showDevDebugOutput": "vscode"
        }
    ]
}
 No newline at end of file
+35 −42
Original line number Diff line number Diff line
# Uc
Code created on the Raspberry Pi Pico platform. 
It generates a trigger signal and a series of flashes of light. 
It can be controlled via UART commands. 

# Installation

## Pi Debug
Download and install the OpenOCD dependencies:
To use the provided container simply login to gitlab with docker:

```bash
sudo apt install automake autoconf build-essential texinfo libtool libftdi-dev libusb-1.0-0-dev
docker login labinfo.ing.he-arc.ch:5050
```
Clone, build and install OpenOCD:

And then open the folder in the container.

## Build and flash

The container has a build and deploy script already installed.

```bash
cd /tmp/
git clone https://github.com/raspberrypi/openocd.git --branch rp2040-v0.12.0 --depth=1 --no-single-branch
cd openocd
./bootstrap
./configure
make -j4
sudo make install
Build Raspberry Pi Pico projects

Syntax: /usr/bin/pico_build [-b|c|d|f|h|p] <args>
[ -b ]        Build project.
[ -c ]        Clean
[ -d ]        Launch debugger
[ -f ]        Flash board
[ -h ]        Help
[ -p PATH ]   Set project path
```

Check OpenOCD version:
Example to build and deploy the firmware:

```bash
openocd --version
pico_build -p code -bf
```

Output: 
To build without the script:

```bash
Open On-Chip Debugger 0.12.0-g4d87f6d (2024-01-08-14:31)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html

cd code
mkdir -p build
cmake ..
make -j4
```

## Pi Debug

**This most be done on the host machine.**
Create a file with any name (ex. pico_openocd.rules) under /etc/udev/rules.d and put this line inside.

```bash
ATTRS{idVendor}=="2e8a", ATTRS{idProduct}=="000c", MODE="660", GROUP="plugdev", TAG+="uaccess"
```

## SDK Config
1. Clone repository https://labinfo.ing.he-arc.ch/gitlab/igib/public/raspberry-pi-pico/raspberry-pi-pico-sdk
2. Go in the folder and init it:
    ```
    cd raspberry-pi-pico-sdk
    git submodule update --recursive --init pico-sdk
    ```
3. Clone this git into the folder raspberry-pi-pico-sdk.
Then recompile and deploy your code with debug tags:


## Create docker image     
It is possible to directly create the docker image in the raspberry-pi-pico-sdk folder:
```
docker build -t pico-dev . 
```bash
cd code/build
cmake -DCMAKE_BUILD_TYPE=DEBUG
pico_build -p code -bf
```

## Build and flash

- Build only : ```./build.sh -b -p PI_ContrHorlo/uc/```
- Build and flash : ```./build.sh -bf -p PI_ContrHorlo/uc/```


## Configuration
- Raspberry Pi Pico
- Raspberry Pi Debug
- Ubuntu 22.04.4 LTS
 No newline at end of file
Using VScode debug tab lanuch a new debug session.
 No newline at end of file
+1 −2
Original line number Diff line number Diff line
BOARD_TYPE=pico
SRC_PATH=.
 No newline at end of file
Loading