fix: 修复了SWD和JTAG相互切换无法识别的情况 #23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: HPM Build | |
on: | |
push: | |
paths: | |
- '.github/workflows/HPM-build.yml' | |
- 'projects/HSLink-Pro/**' | |
pull_request: | |
paths: | |
- '.github/workflows/HPM-build.yml' | |
- 'projects/HSLink-Pro/**' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: gregdavill/[email protected] | |
# 创建riscv-none-elf-到riscv32-unknown-elf-的软链接 | |
- name: Create riscv-none-elf- to riscv32-unknown-elf- symlink | |
run: | | |
sudo bash ./.github/workflows/create_riscv32_symlink.sh | |
- name: Install HPM SDK | |
run: | | |
cd ~ | |
git clone https://github.com/hpmicro/sdk_env.git --recursive | |
- name: Create Python Venv | |
run: | | |
python3 -m venv ~/HPM_PYTHON | |
source ~/HPM_PYTHON/bin/activate | |
pip install pyyaml jinja2 | |
- uses: seanmiddleditch/gha-setup-ninja@master | |
- name: Build bootloader | |
run: | | |
cd projects/HSLink-Pro/bootloader | |
export HPM_SDK_BASE=~/sdk_env/hpm_sdk | |
export GNURISCV_TOOLCHAIN_PATH=~/risv32-unknown-elf | |
export HPM_SDK_TOOLCHAIN_VARIANT=gcc | |
export PYTHON_EXECUTABLE=~/HPM_PYTHON/bin/python3 | |
cmake -GNinja -DBOARD=hpm5301evklite -DHPM_BUILD_TYPE=flash_xip -DCMAKE_BUILD_TYPE=release -Dpython_exec="~/HPM_PYTHON/bin/python3" -DRV_ARCH="rv32imac_zicsr_zifencei" . -B=./build | |
cmake --build ./build | |
- name: Build APP | |
run: | | |
cd projects/HSLink-Pro/src | |
export HPM_SDK_BASE=~/sdk_env/hpm_sdk | |
export GNURISCV_TOOLCHAIN_PATH=~/risv32-unknown-elf | |
export HPM_SDK_TOOLCHAIN_VARIANT=gcc | |
export PYTHON_EXECUTABLE=~/HPM_PYTHON/bin/python3 | |
cmake -GNinja -DBOARD=hpm5301evklite -DHPM_BUILD_TYPE=flash_uf2 -DCMAKE_BUILD_TYPE=release -Dpython_exec="~/HPM_PYTHON/bin/python3" -DRV_ARCH="rv32imac_zicsr_zifencei" . -B=./build | |
cmake --build ./build | |
- name: Merge Bin | |
run: | | |
cd projects/HSLink-Pro | |
cp bootloader/build/output/HSLink-Pro-Bootloader.bin Merger.bin | |
dd if=src/build/output/HSLink-Pro.bin of=Merger.bin bs=1024 seek=127 conv=notrunc | |
- run: | | |
mkdir -p releases | |
cd releases | |
cp ../projects/HSLink-Pro/bootloader/build/output/HSLink-Pro-Bootloader.bin HSLink-Pro-Bootloader.bin | |
cp ../projects/HSLink-Pro/src/build/output/HSLink-Pro.uf2 HSLink-Pro.uf2 | |
cp ../projects/HSLink-Pro/src/build/output/HSLink-Pro.bin HSLink-Pro.bin | |
cp ../projects/HSLink-Pro/Merger.bin Merger.bin | |
- name: Upload file | |
uses: actions/upload-artifact@v4 | |
with: | |
name: release | |
path: | | |
releases/HSLink-Pro-Bootloader.bin | |
releases/HSLink-Pro.uf2 | |
releases/HSLink-Pro.bin | |
releases/Merger.bin |