diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..0a01108 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,89 @@ +name: totp + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: MinSizeRel + +jobs: + build: + # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. + # You can convert this to a matrix build if you need cross-platform coverage. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: ubuntu-latest + + strategy: + matrix: + cpu: [ lpc1756, lpc1759 ] + + steps: + - name: Fetching klib + uses: actions/checkout@v3 + with: + repository: itzandroidtab/klib + + - name: removing example project content + # create a main file that includes all the header files for the current target + run: | + rm -rf ${{github.workspace}}/project/* + + - name: Fetching project + uses: actions/checkout@v3 + with: + path: "${{github.workspace}}/project/" + + - name: arm-none-eabi-gcc install + uses: carlosperate/arm-none-eabi-gcc-action@v1.6.0 + with: + release: '12.2.Rel1' + + - name: arm-none-eabi-gcc version + run: arm-none-eabi-gcc --version + + - name: getting arm headers + uses: actions/checkout@v3 + with: + repository: ARM-software/CMSIS_5 + ref: 'develop' + fetch-depth: '1' + path: './CMSIS' + + - name: moving arm headers + run: | + cp ${{github.workspace}}/CMSIS/CMSIS/Core/Include/* ${{github.workspace}}/targets/arm/ + + - name: generating header + run: | + mkdir -p ${{github.workspace}}/targets/${{matrix.cpu}}/docs + wget -q -O ${{github.workspace}}/targets/${{matrix.cpu}}/docs/${{matrix.cpu}}.svd https://raw.githubusercontent.com/itzandroidtab/klib-svd/master/${{matrix.cpu}}.svd + wget -q -O ${{github.workspace}}/svdconv.tbz2 https://github.com/Open-CMSIS-Pack/devtools/releases/download/tools%2Fsvdconv%2F3.3.44/svdconv-3.3.44-linux64-amd64.tbz2 + tar -xf ${{github.workspace}}/svdconv.tbz2 + chmod +x ${{github.workspace}}/svdconv + + ${{github.workspace}}/svdconv ${{github.workspace}}/targets/${{matrix.cpu}}/docs/${{matrix.cpu}}.svd --generate=header -o ${{github.workspace}}/targets/${{matrix.cpu}}/ > /dev/null || true + sed -i '/#include "system_/d' ${{github.workspace}}/targets/${{matrix.cpu}}/${{matrix.cpu}}.h + + - name: Configure CMake + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: CC=arm-none-eabi-gcc CXX=arm-none-eabi-g++ cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DTARGET_CPU=${{matrix.cpu}} + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - name: Uploading artifact + uses: actions/upload-artifact@v3 + # upload the elf file as a artifact + with: + name: ${{matrix.cpu}} + path: | + ${{github.workspace}}/build/project/klib.elf + ${{github.workspace}}/build/project/klib.map + ${{github.workspace}}/build/project/klib.lss + ${{github.workspace}}/build/project/klib.memory diff --git a/readme.md b/readme.md index f43f678..9cfc86a 100644 --- a/readme.md +++ b/readme.md @@ -29,5 +29,8 @@ Additional pictures can be found [here](./img/) * support for 8 digit keys * add support for more than 32 profiles (needs a rework if more profiles are required. The profiles are copied to ram and there is not enough for more at the moment. If we leave them in flash we can store a lot more) +### Compiling +TOTP uses [klib](https://github.com/itzandroidtab/klib). This repo can be cloned in the klib project folder. See [build.yml](./.github/workflows/build.yml) for more info on compiling this project. + ### Extra Is intended to be used with [USB dfu bootloader](https://github.com/itzandroidtab/dfu_bootloader). To build without bootloader support delete `set(TARGET_LINKERSCRIPT ...)` from the `CMakeLists.txt` in this project. \ No newline at end of file