Skip to content

Commit c720deb

Browse files
authored
HSLink-Pro: 2.3.1 (#29)
* update: 更新电源部分 * update: 更新原理图 * update: 更新PCB - 修改定位孔位置 - 修改Type-C位置 * update: 添加RTT LOGO * chore: 添加cJSON库 * feat: 添加与上位机的HID通信接口 * refactor: 重构命令解析部分代码 * fix: 修复描述符错误 * feat: 添加上位机下发设置功能 * feat: 添加数据保存 * fix: 修复可能的一些错误 * fix: 修复写入flash死机问题 * fix: 潜在的内存泄露问题 * chore: 添加tlsf * chore: 切换cJSON库位置 * feat: 内存管理切换为tlsf * feat: 添加首次默认设置 * feat: 添加硬件版本号 * feat: 添加获取设置 * chore: 将项目修改为cpp * feat: 重构为cpp * fix: 修复release下可能会崩溃的玄学问题 * chore: 删除cJSON库 * fix: 修复RapidJSON库所需内存 * fix: 修复nickname设置问题 * fix: BL工程编译失败 * fix: BL工程里面关闭所有输出 * fix: 修复一些warning * update: README * fix: get_setting字段错误 * update: 1.2.0硬件 * style: 统一接口命名 * feat: 添加upgrade命令 * fix: 将硬件版本号放在OTP寄存器中 * fix: 解决初始值问题 * fix: PWM输出极性反了 * fix: 1.2.0硬件修改IO * release: 2.3.1
1 parent 75de34e commit c720deb

37 files changed

+26525
-24599
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@
2121
*.uvguix.*
2222
*.scvd
2323
*.usb.tmp
24-
build
24+
build
25+
.DS_Store
26+
.idea

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,9 @@
77
[submodule "projects/HSLink-Pro/WS2812"]
88
path = projects/HSLink-Pro/WS2812
99
url = https://github.com/HalfSweet/HPM_WS2812.git
10+
[submodule "projects/HSLink-Pro/src/tlsf"]
11+
path = projects/HSLink-Pro/src/tlsf
12+
url = https://github.com/mattconte/tlsf.git
13+
[submodule "projects/HSLink-Pro/src/rapidjson"]
14+
path = projects/HSLink-Pro/src/rapidjson
15+
url = https://github.com/Tencent/rapidjson.git

DAP/Include/DAP.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,9 @@ void Set_Clock_Delay(uint32_t clock);
333333

334334
__STATIC_FORCEINLINE void PIN_DELAY_SLOW (uint32_t delay) {
335335
volatile uint32_t count = delay;
336-
while (--count);
336+
do {
337+
count -= 1;
338+
} while (count);
337339
}
338340

339341
// Fixed delay for fast clock generation

dap_main.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@
7373
#define CONFIG_UARTRX_RINGBUF_SIZE (8 * 1024)
7474
#define CONFIG_USBRX_RINGBUF_SIZE (8 * 1024)
7575

76+
#ifdef __cplusplus
77+
extern "C"
78+
{
79+
#endif
80+
7681
extern USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t uartrx_ringbuffer[CONFIG_UARTRX_RINGBUF_SIZE];
7782
extern USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t usbrx_ringbuffer[CONFIG_USBRX_RINGBUF_SIZE];
7883
extern USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t usb_tmpbuffer[DAP_PACKET_SIZE];
@@ -133,4 +138,8 @@ void chry_dap_usb2uart_uart_send_bydma(uint8_t *data, uint16_t len);
133138

134139
void chry_dap_usb2uart_uart_send_complete(uint32_t size);
135140

141+
#ifdef __cplusplus
142+
}
143+
#endif
144+
136145
#endif

projects/HSLink-Pro/README.md

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
11
# HSLink Pro
22

3-
## 升级流程
4-
5-
1. 长按`BL`按钮5秒以上即可进入升级模式,此时电脑上会出现一个`CHERRYUF2`的移动存储设备,将升级的`.uf2`文件拖入其中即可。最新的固件可以在<https://github.com/HalfSweet/CherryDAP/actions>或者QQ群内自行获取。
6-
7-
## FAQ
8-
9-
Q:为什么我插上去以后,`keil(MDK5)`没有反应?
10-
A:请检查版本号,只有5.27以上的版本才能支持CMSIS-DAP V2版本,如在此版本号以下的请自行升级。
11-
12-
## 已知问题
13-
14-
- [ ] VREF输出电平有误,实际为VREF/2
15-
- [ ] TVcc和5V输出引脚定义有误
16-
- [ ] PyOCD和Probe-rs无法正常连接
3+
详细说明见 <https://cherrydap.cherry-embedded.org/projects/HSLink%20Pro.html>

projects/HSLink-Pro/bootloader/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,5 @@ sdk_inc(src)
3232
sdk_inc(../common)
3333

3434
sdk_compile_definitions(-DPRODUCT_STRING="HSLink Pro")
35-
sdk_compile_definitions(-DCONFIG_USE_HID_CONFIG=1)
36-
sdk_app_src(../common/HSLink_Pro_expansion.c)
3735

3836
#generate_ide_projects()

projects/HSLink-Pro/bootloader/src/main.c

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@
33
#include "bootuf2.h"
44
#include "usb_config.h"
55
#include <board.h>
6+
#include <hpm_dma_mgr.h>
67
#include <hpm_gpio_drv.h>
78
#include <hpm_gpiom_drv.h>
89
#include <hpm_l1c_drv.h>
910
#include <usb_log.h>
10-
#include "HSLink_Pro_expansion.h"
11-
#include <hpm_dma_mgr.h>
1211

1312
ATTR_PLACE_AT(".bl_setting")
1413
static BL_Setting_t bl_setting;
1514

15+
static const uint32_t CONFIG_P_EN = IOC_PAD_PA31;
16+
static const uint32_t CONFIG_Port_EN = IOC_PAD_PA04;
17+
1618
static void jump_app(void)
1719
{
1820
fencei();
@@ -103,7 +105,7 @@ static void show_rainbow(void)
103105
WS2812_SetPixel(i, r, g, b);
104106
}
105107
WS2812_Update();
106-
board_delay_ms(10); // 纯阻塞,好孩子别学
108+
board_delay_ms(50); // 纯阻塞,好孩子别学
107109
}
108110
}
109111

@@ -115,12 +117,31 @@ static void TurnOffLED(void)
115117
;
116118
}
117119

120+
static void IOInit(void)
121+
{
122+
// 将输出全部设置为高阻态
123+
124+
// PowerEN
125+
HPM_IOC->PAD[CONFIG_P_EN].FUNC_CTL = IOC_PAD_FUNC_CTL_ALT_SELECT_SET(0);
126+
127+
gpiom_set_pin_controller(HPM_GPIOM, GPIO_GET_PORT_INDEX(CONFIG_P_EN), GPIO_GET_PIN_INDEX(CONFIG_P_EN), gpiom_soc_gpio0);
128+
gpio_set_pin_output(HPM_GPIO0, GPIO_GET_PORT_INDEX(CONFIG_P_EN), GPIO_GET_PIN_INDEX(CONFIG_P_EN));
129+
gpio_write_pin(HPM_GPIO0, GPIO_GET_PORT_INDEX(CONFIG_P_EN), GPIO_GET_PIN_INDEX(CONFIG_P_EN), 0);
130+
131+
// PortEN
132+
HPM_IOC->PAD[CONFIG_Port_EN].FUNC_CTL = IOC_PAD_FUNC_CTL_ALT_SELECT_SET(0);
133+
134+
gpiom_set_pin_controller(HPM_GPIOM, GPIO_GET_PORT_INDEX(CONFIG_Port_EN), GPIO_GET_PIN_INDEX(CONFIG_Port_EN), gpiom_soc_gpio0);
135+
gpio_set_pin_output(HPM_GPIO0, GPIO_GET_PORT_INDEX(CONFIG_Port_EN), GPIO_GET_PIN_INDEX(CONFIG_Port_EN));
136+
gpio_write_pin(HPM_GPIO0, GPIO_GET_PORT_INDEX(CONFIG_Port_EN), GPIO_GET_PIN_INDEX(CONFIG_Port_EN), 0);
137+
}
138+
118139
int main(void)
119140
{
120141
board_init();
142+
IOInit();
121143
dma_mgr_init();
122144
show_logo();
123-
HSP_Init(); // 关闭电源输出,将电平修改为3.3V
124145
board_init_usb(HPM_USB0);
125146
bootloader_button_init();
126147
WS2812_Init();

projects/HSLink-Pro/bootloader/src/usb_config.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
#include "hpm_soc_feature.h"
1111

12-
#define CHERRYUSB_VERSION 0x010300
13-
#define CHERRYUSB_VERSION_STR "v1.3.0"
12+
//#define CHERRYUSB_VERSION 0x010300
13+
//#define CHERRYUSB_VERSION_STR "v1.3.0"
1414

1515
/* ================ USB common Configuration ================ */
1616

0 commit comments

Comments
 (0)