Skip to content

Commit

Permalink
Merge branch 'develop' of JF/PineTime into master
Browse files Browse the repository at this point in the history
  • Loading branch information
JF002 authored and Gitea committed Oct 16, 2022
2 parents 286690e + b56c5f2 commit e823c8e
Show file tree
Hide file tree
Showing 189 changed files with 4,698 additions and 69,390 deletions.
25 changes: 10 additions & 15 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# VS Code Dev Container
This is a docker-based interactive development environment using VS Code and Docker Dev Containers removing the need to install any tools locally*


This is a docker-based interactive development environment using VS Code and Docker Dev Containers removing the need to install any tools locally\*

## Requirements

Expand All @@ -16,45 +15,41 @@ This is a docker-based interactive development environment using VS Code and Doc

1. Clone InfiniTime and update submodules
2. Launch VS Code
3. Open InfiniTime directory,
4. Allow VS Code to open folder with devcontainer.
3. Open InfiniTime directory,
4. Allow VS Code to open folder with devcontainer.

After this the environment will be built if you do not currently have a container setup, it will install all the necessary tools and extra VSCode extensions.
After this the environment will be built if you do not currently have a container setup, it will install all the necessary tools and extra VSCode extensions.

In order to build InfiniTime we need to run the initial submodule init and CMake commands.

#### Manually
#### Manually

You can use the VS Code terminal to run the CMake commands as outlined in the [build instructions](blob/develop/doc/buildAndProgram.md)
You can use the VS Code terminal to run the CMake commands as outlined in the [build instructions](blob/develop/doc/buildAndProgram.md)

#### Script

The dev environment comes with some scripts to make this easier, They are located in /opt/.

There are also VS Code tasks provided should you desire to use those.
There are also VS Code tasks provided should you desire to use those.

The task "update submodules" will update the git submodules



### Build

You can use the build.sh script located in /opt/

CMake is also configured and controls for the CMake plugin are available in VS Code



### Debugging

Docker on windows does not support passing USB devices to the underlying WSL2 subsystem, To get around this we use OpenOCD in server mode running on the host.

`openocd -f <yourinterface> -f <nrf52.cfg target file>`

This will launch OpenOCD in server mode and attach it to the MCU.
This will launch OpenOCD in server mode and attach it to the MCU.

The default launch.json file expects OpenOCD to be listening on port 3333, edit if needed


## Current Issues
Currently WSL2 Has some real performance issues with IO on a windows host. Accessing files on the virtualized filesystem is much faster. Using VS Codes "clone in container" feature of the Remote - Containers will get around this. After the container is built you will need to update the submodules and follow the build instructions like normal

Currently WSL2 Has some real performance issues with IO on a windows host. Accessing files on the virtualized filesystem is much faster. Using VS Codes "clone in container" feature of the Remote - Containers will get around this. After the container is built you will need to update the submodules and follow the build instructions like normal
1 change: 0 additions & 1 deletion .devcontainer/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ CmakeGenerate() {

cmake -G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DUSE_OPENOCD=1 \
-DARM_NONE_EABI_TOOLCHAIN_PATH="$TOOLS_DIR/$GCC_ARM_VER" \
-DNRF5_SDK_PATH="$TOOLS_DIR/$NRF_SDK_VER" \
"$SOURCES_DIR"
Expand Down
70 changes: 70 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Build and push Docker image

on:
push:
branches: [ develop ]
paths:
- 'docker/**'
pull_request:
branches: [ develop ]
paths:
- 'docker/**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
env:
USERNAME: infinitime
steps:
- uses: actions/checkout@v3

- name: Log in to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_LOGIN_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Set up Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ secrets.DOCKER_HUB_IMAGE_USERNAME || env.USERNAME }}/infinitime-build
tags: |
type=sha
type=raw,value=latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Build and push
if: github.event_name != 'pull_request'
uses: docker/build-push-action@v3
with:
context: ./docker/
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_IMAGE_USERNAME || env.USERNAME }}/infinitime-build:buildcache
cache-to: type=registry,ref=${{ secrets.DOCKER_HUB_IMAGE_USERNAME || env.USERNAME }}/infinitime-build:buildcache,mode=max

- name: Build
if: github.event_name == 'pull_request'
uses: docker/build-push-action@v3
with:
context: ./docker/
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
builder: ${{ steps.buildx.outputs.name }}
push: false
cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_IMAGE_USERNAME || env.USERNAME }}/infinitime-build:buildcache
41 changes: 37 additions & 4 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Code formatting

on:
pull_request:
branches: [ master, develop ]
branches: [ develop ]
paths:
- '**.cpp'
- '**.h'
Expand All @@ -17,9 +17,8 @@ jobs:
with:
fetch-depth: 1000

- name: Configure git
run: |
git fetch origin "$GITHUB_BASE_REF":"$GITHUB_BASE_REF" --depth=1000
- name: Fetch base branch
run: git fetch origin "$GITHUB_BASE_REF":"$GITHUB_BASE_REF"

- name: Install clang-format
run: |
Expand All @@ -35,3 +34,37 @@ jobs:
with:
name: Patches
path: ./*.patch
test-clang-tidy:
runs-on: ubuntu-latest
container:
image: infinitime/infinitime-build
steps:
# This workaround fixes the error "unsafe repository (REPO is owned by someone else)".
# See https://github.com/actions/checkout/issues/760 and https://github.com/actions/checkout/issues/766
# The fix in "actions/checkout@v2" was not sufficient as the build process also uses git (to get the current
# commit hash, for example).
- name: Workaround permission issues
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Checkout source files
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 1000
- name: Fetch base branch
run: git fetch origin "$GITHUB_BASE_REF":"$GITHUB_BASE_REF"
- name: Install clang-tidy
run: |
apt-get update
apt-get -y install clang-tidy-12
- name: Prepare environment
shell: bash
env:
SOURCES_DIR: .
run: |
. docker/build.sh
GetGcc
# I guess these already exist inside the docker?
#GetNrfSdk
#GetMcuBoot
CmakeGenerate
- run: tests/test-tidy.sh
66 changes: 0 additions & 66 deletions .github/workflows/lv_sim.yml

This file was deleted.

64 changes: 56 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
# GitHub Actions Workflow to build FreeRTOS Firmware for PineTime Smart Watch
# See https://lupyuen.github.io/pinetime-rust-mynewt/articles/cloud
# Based on https://github.com/JF002/InfiniTime/blob/master/doc/buildAndProgram.md
# and https://github.com/JF002/InfiniTime/blob/master/bootloader/README.md

name: Build PineTime Firmware
name: CI

# Run this workflow whenever the build may be affected
on:
push:
branches: [ master, develop ]
paths-ignore:
- 'doc/**'
- '**.md'
pull_request:
branches: [ master, develop ]
branches: [ develop ]
paths-ignore:
- 'doc/**'
- '**.md'


jobs:
build:
build-firmware:
runs-on: ubuntu-latest
container:
image: infinitime/infinitime-build
Expand Down Expand Up @@ -45,3 +48,48 @@ jobs:
with:
name: InfiniTime MCUBoot image ${{ github.head_ref }}
path: ./build/output/pinetime-mcuboot-app-image-*.bin
- name: Upload resources artifacts
uses: actions/upload-artifact@v3
with:
name: InfiniTime resources ${{ github.head_ref }}
path: ./build/output/infinitime-resources-*.zip

build-simulator:
runs-on: ubuntu-latest
steps:
- name: Install cmake
uses: lukka/[email protected]

- name: Install SDL2 development package
run: |
sudo apt-get update
sudo apt-get -y install libsdl2-dev
- name: Install lv_font_conv
run:
npm i -g [email protected]

- name: Checkout source files
uses: actions/checkout@v2
with:
submodules: recursive

- name: Get InfiniSim repo
run: |
git clone https://github.com/InfiniTimeOrg/InfiniSim.git --depth 1 --branch main
git -C InfiniSim submodule update --init lv_drivers libpng
- name: CMake
# disable BUILD_RESOURCES as this is already done when building the firmware
run: |
cmake -G Ninja -S InfiniSim -B build_lv_sim -DInfiniTime_DIR="${PWD}" -DBUILD_RESOURCES=OFF
- name: Build simulator executable
run: |
cmake --build build_lv_sim
- name: Upload simulator executable
uses: actions/upload-artifact@v3
with:
name: infinisim-${{ github.head_ref }}
path: build_lv_sim/infinisim
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
[submodule "src/libs/QCBOR"]
path = src/libs/QCBOR
url = https://github.com/laurencelundblade/QCBOR.git
[submodule "src/libs/date"]
path = src/libs/date
url = https://github.com/HowardHinnant/date.git
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"servertype": "openocd",
"runToMain": true,
// Only use armToolchainPath if your arm-none-eabi-gdb is not in your path (some GCC packages does not contain arm-none-eabi-gdb)
"armToolchainPath": "${workspaceRoot}/../gcc-arm-11.2-2022.02-x86_64-arm-none-eabi/bin",
"armToolchainPath": "${workspaceRoot}/../gcc-arm-none-eabi-10.3-2021.10/bin",
"svdFile": "${workspaceRoot}/nrf52.svd",
"configFiles": [
"interface/stlink.cfg",
Expand Down
Loading

0 comments on commit e823c8e

Please sign in to comment.