Skip to content

Commit

Permalink
Add pico-sdk as submodule
Browse files Browse the repository at this point in the history
The project uses pico-sdk framework, which must be installed and
configured on the build system. In order to simplify the build process,
add the pico-sdk framework v 1.5.1 to the project as sub-module.

Signed-off-by: Tzvetomir Stoyanov <[email protected]>
  • Loading branch information
tzstoyanov committed Jan 17, 2024
1 parent ef0b04f commit 41a4bff
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 39 deletions.
42 changes: 7 additions & 35 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,57 +7,29 @@ on:
- cron: '0 15 * * THU'
workflow_dispatch:

env:
PICO_SDK_VER: 1.5.1

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build-fixed
working-directory: ${{runner.workspace}}/
shell: bash
run: |
sudo apt-get update
sudo apt-get install build-essential git cmake binutils-dev -y
sudo apt install gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib -y
git clone --depth 1 --recurse-submodules --branch $PICO_SDK_VER https://github.com/raspberrypi/pico-sdk pico-sdk-$PICO_SDK_VER
export PICO_SDK_PATH=${{runner.workspace}}/pico-sdk-$PICO_SDK_VER
cd ${{runner.workspace}}/herak-raspberry/
git submodule update --init --recursive
cp -f ${{runner.workspace}}/herak-raspberry/scripts/params_ci.txt /${{runner.workspace}}/herak-raspberry/app/solar/params.txt
mkdir ${{runner.workspace}}/herak-raspberry/build/solar-$PICO_SDK_VER
cd ${{runner.workspace}}/herak-raspberry/build/solar-$PICO_SDK_VER
cmake ../../app/solar
make
ls -al ${{runner.workspace}}/herak-raspberry/build/solar-$PICO_SDK_VER/herak-solar.uf2
cp -f ${{runner.workspace}}/herak-raspberry/scripts/params_ci.txt /${{runner.workspace}}/herak-raspberry/app/shaft/params.txt
mkdir ${{runner.workspace}}/herak-raspberry/build/shaft-$PICO_SDK_VER
cd ${{runner.workspace}}/herak-raspberry/build/shaft-$PICO_SDK_VER
cmake ../../app/shaft
make
ls -al ${{runner.workspace}}/herak-raspberry/build/shaft-$PICO_SDK_VER/herak-shaft.uf2
- name: Build-latest
- name: Build
working-directory: ${{runner.workspace}}/
shell: bash
run: |
sudo apt-get update
sudo apt-get install build-essential git cmake binutils-dev -y
sudo apt install gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib -y
git clone --depth 1 --recurse-submodules https://github.com/raspberrypi/pico-sdk pico-sdk-latest
export PICO_SDK_PATH=${{runner.workspace}}/pico-sdk-latest
cd ${{runner.workspace}}/herak-raspberry/
git submodule update --init --recursive
cp -f ${{runner.workspace}}/herak-raspberry/scripts/params_ci.txt /${{runner.workspace}}/herak-raspberry/app/solar/params.txt
mkdir ${{runner.workspace}}/herak-raspberry/build/solar-latest
cd ${{runner.workspace}}/herak-raspberry/build/solar-latest
mkdir ${{runner.workspace}}/herak-raspberry/build/solar-ci
cd ${{runner.workspace}}/herak-raspberry/build/solar-ci
cmake ../../app/solar
make
ls -al ${{runner.workspace}}/herak-raspberry/build/solar-latest/herak-solar.uf2
ls -al ${{runner.workspace}}/herak-raspberry/build/solar-ci/herak-solar.uf2
cp -f ${{runner.workspace}}/herak-raspberry/scripts/params_ci.txt /${{runner.workspace}}/herak-raspberry/app/shaft/params.txt
mkdir ${{runner.workspace}}/herak-raspberry/build/shaft-latest
cd ${{runner.workspace}}/herak-raspberry/build/shaft-latest
mkdir ${{runner.workspace}}/herak-raspberry/build/shaft-ci
cd ${{runner.workspace}}/herak-raspberry/build/shaft-ci
cmake ../../app/shaft
make
ls -al ${{runner.workspace}}/herak-raspberry/build/shaft-latest/herak-shaft.uf2
ls -al ${{runner.workspace}}/herak-raspberry/build/shaft-ci/herak-shaft.uf2
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ build/
.settings/
libs/one-wire/*
libs/pio-usb/*
libs/pio-sdk/*
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "libs/one-wire"]
path = libs/one-wire
url = https://github.com/adamboardman/pico-onewire
[submodule "libs/pico-sdk"]
path = libs/pico-sdk
url = https://github.com/raspberrypi/pico-sdk
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,14 @@ a remote MQTT server.
### Prerequisites
- Raspberry Pico W.
- Wiring, depending on the use case.
- [Raspberry C SDK](https://github.com/raspberrypi/pico-sdk)

### Get the code
The project uses sub-modules, so clone the repo with all sub-modules:
```
git clone --recurse-submodules https://github.com/tzstoyanov/herak-raspberry
```

### Build
- Export PICO_SDK_PATH variable with the path to the Raspberry C SDK.
- Copy [params-example.txt](app/params_example.txt) file as params.txt in the application directory
and modify it with your configuration.
- In the `build/<application>` directory, run `cmake ../../app/<applicattion>`
Expand Down
3 changes: 2 additions & 1 deletion app/shaft/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
cmake_minimum_required(VERSION 3.12)

# Include build functions from Pico SDK
set(PROJECT_LIB_DIR ${CMAKE_CURRENT_LIST_DIR}/../../libs)
set(ENV{PICO_SDK_PATH} "${PROJECT_LIB_DIR}/pico-sdk")
include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)

# Set name of project (as PROJECT_NAME) and C/C++ standards
Expand All @@ -13,7 +15,6 @@ set(PICO_BOARD pico_w)
add_compile_definitions(CYW43_HOST_NAME=\"${PROJECT_NAME}\")

set(PROJECT_TOP_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
set(PROJECT_LIB_DIR ${CMAKE_CURRENT_LIST_DIR}/../../libs)
set(PROJECT_INLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/../../include)
set(PARAMS_FILE params)
set(PARAMS_TEMPLETE ${PROJECT_TOP_DIR}/app/params_example)
Expand Down
3 changes: 2 additions & 1 deletion app/solar/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
cmake_minimum_required(VERSION 3.12)

# Include build functions from Pico SDK
set(PROJECT_LIB_DIR ${CMAKE_CURRENT_LIST_DIR}/../../libs)
set(ENV{PICO_SDK_PATH} "${PROJECT_LIB_DIR}/pico-sdk")
include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)

# Set name of project (as PROJECT_NAME) and C/C++ standards
Expand All @@ -14,7 +16,6 @@ set(ADD_USB true)
add_compile_definitions(CYW43_HOST_NAME=\"${PROJECT_NAME}\")

set(PROJECT_TOP_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
set(PROJECT_LIB_DIR ${CMAKE_CURRENT_LIST_DIR}/../../libs)
set(PROJECT_INLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/../../include)
set(PARAMS_FILE params)
set(PARAMS_TEMPLETE ${PROJECT_TOP_DIR}/app/params_example)
Expand Down
1 change: 1 addition & 0 deletions libs/pico-sdk
Submodule pico-sdk added at 6a7db3

0 comments on commit 41a4bff

Please sign in to comment.