Skip to content

Commit

Permalink
Add HSLink Pro board (cherry-embedded#11)
Browse files Browse the repository at this point in the history
* The details are as follows:

- Distinguish between onboard 20P and custom pin
- Support IO over JTAG
- Support changing LED RST and other pins in cmakelists file
- support Adjust frequency for swj clock

* projects: hpm5301evklite: add jtag over single jtag

* add: Bootloader工程

* add: 添加App工程

* add: 添加Github Action

* fix: -Wattributes

* feat: 在bootloader里面加入对于外设的初始化

* update: 更新路径

* refactor: 不需要EXPANSION配置宏了

* chore: 可通过外部宏指定FW_VER

* feat: 添加用于配置的HID接口

* fix: SWD切换电平问题

* fix: 关闭HID接口的时候有些代码会编译出错

* chore: CI添加上传APP区域的bin文件

* fix: action语法错误

* release: 2.2.1

* chore: 更新CherryUSB库到1.4.0

* chore: 统一脚本路径

* chore: 添加合并的bin文件

* fix: 文件一起上传

* fix: 脚本路径错误

* chore: 使用dd来合并bin

* fix: some warning

* fix: HID部分接口更新到CherryUSB 1.4.0

* update: 更新WS2812库

* fix: 让退出bl的时候灯珠始终保持关闭

* chore: 将XPI0的长度修改为128k,方便检查

* feat: 添加唯一的serial number

* add: app中添加WS2812驱动

* format: 格式化代码

* feat: 增加运行时LED

* fix: SWDIO空闲的时候默认为输入状态,由target拉高

* release: 2.2.2

* add: 添加单SPI模拟JTAG

* fix: 增加对TMS的电平转换方向控制

* fix: JTAG下DIR有误

* update: 将初始化SWDIO部分放在APP区

* fix: 先使用GPIO模拟JTAG

* add: 添加README

* fix: 修改P_EN的IO端口

* fix: Vref计算有误

* fix: 加入了IO模拟SWD的DIR切换

* fix: UART引脚切换

* release: 2.2.3.IO

* fix: IO模拟SWD时序

* release: 2.2.4.IO

* fix: 减少兼容性问题

* Merge remote-tracking branch 'RCSN/feature/refine_the_options_for_swd_jtag' into HSLink-Pro

---------

Co-authored-by: Runcheng Lu <[email protected]>
  • Loading branch information
HalfSweet and RCSN authored Sep 5, 2024
1 parent 080250d commit 01d07e6
Show file tree
Hide file tree
Showing 44 changed files with 6,916 additions and 269 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/HPM-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
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" -DCONFIG_HSLINK_PRO_EXPANSION=ON -DCONFIG_SWDIO_DIR=IOC_PAD_PA30 . -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
22 changes: 22 additions & 0 deletions .github/workflows/create_riscv32_symlink.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

old_path="/home/runner/work/_temp/.setup-riscv-gnu-toolchain/bin"

new_path="/home/runner/risv32-unknown-elf/bin"
mkdir -p $new_path

cd $old_path

# 查找所有以 "riscv-none-elf-" 开头的文件
for file in riscv-none-elf-*; do
# 如果文件存在
if [[ -e "$file" ]]; then
# 构造新的链接名称
new_link="$new_path/riscv32-unknown-elf-${file#riscv-none-elf-}"

# 创建软链接
ln -s "$old_path/$file" "$new_link"

printf "Create symlink: %s -> %s\n" "$new_link" "$file"
fi
done
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "CherryRB"]
path = CherryRB
url = https://github.com/cherry-embedded/CherryRB.git
[submodule "projects/HSLink-Pro/WS2812"]
path = projects/HSLink-Pro/WS2812
url = https://github.com/HalfSweet/HPM_WS2812.git
2 changes: 1 addition & 1 deletion CherryUSB
2 changes: 2 additions & 0 deletions DAP/Include/DAP.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@


// DAP Firmware Version
#ifndef DAP_FW_VER
#ifdef DAP_FW_V1
#define DAP_FW_VER "1.3.0"
#else
#define DAP_FW_VER "2.1.1"
#endif
#endif

// DAP Command IDs
#define ID_DAP_Info 0x00U
Expand Down
15 changes: 8 additions & 7 deletions DAP/Source/DAP.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ static uint32_t DAP_SWJ_Clock(const uint8_t *request, uint8_t *response) {
#if ((DAP_SWD != 0) || (DAP_JTAG != 0))
uint32_t clock;
uint32_t delay;
(void)delay;

clock = (uint32_t)(*(request+0) << 0) |
(uint32_t)(*(request+1) << 8) |
Expand All @@ -417,7 +418,7 @@ static uint32_t DAP_SWJ_Clock(const uint8_t *request, uint8_t *response) {
return ((4U << 16) | 1U);
}

#ifndef USE_SPI_SWD
#if !defined(USE_SPI_SWD) && !defined(USE_SPI_JTAG)
Set_Clock_Delay(clock);
#else
set_swj_clock_frequency(clock);
Expand Down Expand Up @@ -557,12 +558,12 @@ static uint32_t DAP_JTAG_Sequence(const uint8_t *request, uint8_t *response) {

sequence_count = *request++;
while (sequence_count--) {
sequence_info = *request++;
count = sequence_info & JTAG_SEQUENCE_TCK;
if (count == 0U) {
count = 64U;
}
count = (count + 7U) / 8U;
sequence_info = *request++;
count = sequence_info & JTAG_SEQUENCE_TCK;
if (count == 0U) {
count = 64U;
}
count = (count + 7U) / 8U;
#if (DAP_JTAG != 0)
JTAG_Sequence(sequence_info, request, response);
#endif
Expand Down
Loading

0 comments on commit 01d07e6

Please sign in to comment.