Skip to content

Commit

Permalink
RT-Thread BSP v1.3.0 for HPM6300EVK
Browse files Browse the repository at this point in the history
- Integrated hpm_sdk v1.3.0
- Bugfixes and improvements in rt-thread driver wrappers

Signed-off-by: Fan YANG <[email protected]>
  • Loading branch information
helloeagleyang committed Nov 3, 2023
1 parent 703d3e5 commit bc18113
Show file tree
Hide file tree
Showing 411 changed files with 115,196 additions and 10,549 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,5 @@ dkms.conf

# Scons cache
*.dbsqlite

.vscode
16 changes: 16 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Change Log

## v1.3.0
- Integrated hpm_sdk v1.3.0
- Note:
- the docs, middleware, scripts, samples folder in SDK root directory were removed
- Updated:
- Added SVD support
- Added hardare filter support to `CAN` driver
- Disable PWM invert output by default
- Fixed:
- elf file generated by RT-Thread Studio cannot be recognized by Ozone properly
- online package `i2c tools` cannot work
- ethernet may fail to work when network storm happened
- audio channel control may be unexepcted if i2s overflow/underflow happened
- compiling error if `ADC12` is enabled
- GPIO cannot read back pin level correctly if it is configured as Open-Drain Pull-up mode

## v1.2.0
- Integrated hpm_sdk v1.2.0
- Note:
Expand Down
16 changes: 16 additions & 0 deletions ChangeLog_zh.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# 更新

## v1.3.0
- 整合了hpm_sdk v1.3.0
- 注:
- SDK根目录下的docs,middleware,samples, scripts等目录被移除
- 更新
- 增加了SVD文件的支持
- CAN: 增加了硬件过滤器支持
- 默认禁用了PWM输出反向
- 修复:
- RT-Thread Studio生成的elf文件无法被`Ozone`正确的识别
- 在线包`i2c tools`不工作
- 以太网在网络风暴产生后工作不正常
- 音频声道控制在产生上溢/下溢后产生异常
- 当开启`ADC12`后编译失败
- GPIO在配置为开漏极并上拉模式后无法正确的读出引脚的电平

## v1.2.0
- 整合了hpm_sdk v1.2.0
- 注:
Expand Down
28 changes: 14 additions & 14 deletions HPMicro-HPM6300EVK.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ features_zh:
- '调试接口: 板载FT2232'
pkg_type: Board_Support_Packages
pkg_vendor: HPMicro
pkg_version: 1.2.0
pkg_version: 1.3.0

template_projects:
- project_name: blink_led
Expand Down Expand Up @@ -92,7 +92,7 @@ template_projects:
- package_name: OpenOCD-HPMicro
package_type: Debugger_Support_Packages
package_vendor: 'HPMicro'
package_version: 0.3.0
package_version: 0.4.0
source_path_offset: ''
target_path_offset: ''
files_and_folders: []
Expand Down Expand Up @@ -145,7 +145,7 @@ example_projects:
- package_name: OpenOCD-HPMicro
package_type: Debugger_Support_Packages
package_vendor: 'HPMicro'
package_version: 0.3.0
package_version: 0.4.0
source_path_offset: ''
target_path_offset: ''
files_and_folders: []
Expand Down Expand Up @@ -190,7 +190,7 @@ example_projects:
- package_name: OpenOCD-HPMicro
package_type: Debugger_Support_Packages
package_vendor: 'HPMicro'
package_version: 0.3.0
package_version: 0.4.0
source_path_offset: ''
target_path_offset: ''
files_and_folders: []
Expand Down Expand Up @@ -235,7 +235,7 @@ example_projects:
- package_name: OpenOCD-HPMicro
package_type: Debugger_Support_Packages
package_vendor: 'HPMicro'
package_version: 0.3.0
package_version: 0.4.0
source_path_offset: ''
target_path_offset: ''
files_and_folders: []
Expand Down Expand Up @@ -280,7 +280,7 @@ example_projects:
- package_name: OpenOCD-HPMicro
package_type: Debugger_Support_Packages
package_vendor: 'HPMicro'
package_version: 0.3.0
package_version: 0.4.0
source_path_offset: ''
target_path_offset: ''
files_and_folders: []
Expand Down Expand Up @@ -325,7 +325,7 @@ example_projects:
- package_name: OpenOCD-HPMicro
package_type: Debugger_Support_Packages
package_vendor: 'HPMicro'
package_version: 0.3.0
package_version: 0.4.0
source_path_offset: ''
target_path_offset: ''
files_and_folders: []
Expand Down Expand Up @@ -370,7 +370,7 @@ example_projects:
- package_name: OpenOCD-HPMicro
package_type: Debugger_Support_Packages
package_vendor: 'HPMicro'
package_version: 0.3.0
package_version: 0.4.0
source_path_offset: ''
target_path_offset: ''
files_and_folders: []
Expand Down Expand Up @@ -415,7 +415,7 @@ example_projects:
- package_name: OpenOCD-HPMicro
package_type: Debugger_Support_Packages
package_vendor: 'HPMicro'
package_version: 0.3.0
package_version: 0.4.0
source_path_offset: ''
target_path_offset: ''
files_and_folders: []
Expand Down Expand Up @@ -461,7 +461,7 @@ example_projects:
- package_name: OpenOCD-HPMicro
package_type: Debugger_Support_Packages
package_vendor: 'HPMicro'
package_version: 0.3.0
package_version: 0.4.0
source_path_offset: ''
target_path_offset: ''
files_and_folders: []
Expand Down Expand Up @@ -507,7 +507,7 @@ example_projects:
- package_name: OpenOCD-HPMicro
package_type: Debugger_Support_Packages
package_vendor: 'HPMicro'
package_version: 0.3.0
package_version: 0.4.0
source_path_offset: ''
target_path_offset: ''
files_and_folders: []
Expand Down Expand Up @@ -553,7 +553,7 @@ example_projects:
- package_name: OpenOCD-HPMicro
package_type: Debugger_Support_Packages
package_vendor: 'HPMicro'
package_version: 0.3.0
package_version: 0.4.0
source_path_offset: ''
target_path_offset: ''
files_and_folders: []
Expand Down Expand Up @@ -600,7 +600,7 @@ example_projects:
- package_name: OpenOCD-HPMicro
package_type: Debugger_Support_Packages
package_vendor: 'HPMicro'
package_version: 0.3.0
package_version: 0.4.0
source_path_offset: ''
target_path_offset: ''
files_and_folders: []
Expand Down Expand Up @@ -646,7 +646,7 @@ example_projects:
- package_name: OpenOCD-HPMicro
package_type: Debugger_Support_Packages
package_vendor: 'HPMicro'
package_version: 0.3.0
package_version: 0.4.0
source_path_offset: ''
target_path_offset: ''
files_and_folders: []
Expand Down
56 changes: 34 additions & 22 deletions board/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,31 +415,43 @@ void board_init_clock(void)
clock_set_source_divider(clock_aud1, clk_src_pll2_clk0, 46); /* config clock_aud1 for 44100*n sample rate */
}

uint32_t board_init_adc16_clock(ADC16_Type *ptr)
uint32_t board_init_adc16_clock(ADC16_Type *ptr, bool clk_src_ahb)
{
uint32_t freq = 0;
switch ((uint32_t) ptr) {
case HPM_ADC0_BASE:
/* Configure the ADC clock to 200MHz */
clock_set_adc_source(clock_adc0, clk_adc_src_ana);
clock_set_source_divider(clock_ana0, clk_src_pll1_clk1, 2U);

if (ptr == HPM_ADC0) {
if (clk_src_ahb) {
/* Configure the ADC clock from AHB (@160MHz by default)*/
clock_set_adc_source(clock_adc0, clk_adc_src_ahb0);
} else {
/* Configure the ADC clock from pll0_clk1 divided by 2 (@166MHz by default) */
clock_set_adc_source(clock_adc0, clk_adc_src_ana0);
clock_set_source_divider(clock_ana0, clk_src_pll0_clk1, 2U);
}

freq = clock_get_frequency(clock_adc0);
break;
case HPM_ADC1_BASE:
/* Configure the ADC clock to 200MHz */
clock_set_adc_source(clock_adc1, clk_adc_src_ana);
clock_set_source_divider(clock_ana0, clk_src_pll1_clk1, 2U);
} else if (ptr == HPM_ADC1) {
if (clk_src_ahb) {
/* Configure the ADC clock from AHB (@160MHz by default)*/
clock_set_adc_source(clock_adc1, clk_adc_src_ahb0);
} else {
/* Configure the ADC clock from pll1_clk1 divided by 2 (@166MHz by default) */
clock_set_adc_source(clock_adc1, clk_adc_src_ana1);
clock_set_source_divider(clock_ana1, clk_src_pll0_clk1, 2U);
}

freq = clock_get_frequency(clock_adc1);
break;
case HPM_ADC2_BASE:
/* Configure the ADC clock to 200MHz */
clock_set_adc_source(clock_adc2, clk_adc_src_ana);
clock_set_source_divider(clock_ana0, clk_src_pll1_clk1, 2U);
} else if (ptr == HPM_ADC2) {
if (clk_src_ahb) {
/* Configure the ADC clock from AHB (@160MHz by default)*/
clock_set_adc_source(clock_adc2, clk_adc_src_ahb0);
} else {
/* Configure the ADC clock from pll1_clk1 divided by 2 (@166MHz by default) */
clock_set_adc_source(clock_adc2, clk_adc_src_ana2);
clock_set_source_divider(clock_ana2, clk_src_pll0_clk1, 2U);
}

freq = clock_get_frequency(clock_adc2);
break;
default:
/* Invalid ADC instance */
break;
}

return freq;
Expand Down Expand Up @@ -468,10 +480,10 @@ uint32_t board_init_dac_clock(DAC_Type *ptr, bool clk_src_ahb)
if (ptr == HPM_DAC) {
if (clk_src_ahb == true) {
/* Configure the DAC clock to 160MHz */
clock_set_dac_source(clock_dac0, clk_dac_src_ahb);
clock_set_dac_source(clock_dac0, clk_dac_src_ahb0);
} else {
/* Configure the DAC clock to 166MHz */
clock_set_dac_source(clock_dac0, clk_dac_src_ana);
clock_set_dac_source(clock_dac0, clk_dac_src_ana3);
clock_set_source_divider(clock_ana3, clk_src_pll0_clk1, 2);
}

Expand Down
2 changes: 1 addition & 1 deletion board/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ void board_init_clock(void);

uint32_t board_init_spi_clock(SPI_Type *ptr);

uint32_t board_init_adc16_clock(ADC16_Type *ptr);
uint32_t board_init_adc16_clock(ADC16_Type *ptr, bool clk_src_ahb);

uint32_t board_init_dac_clock(DAC_Type *ptr, bool clk_src_ahb);

Expand Down
4 changes: 2 additions & 2 deletions board/rtt_board.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "hpm_sysctl_drv.h"
#include <rthw.h>
#include <rtthread.h>
#include "hpm_dma_manager.h"
#include "hpm_dma_mgr.h"

void os_tick_config(void);

Expand All @@ -27,7 +27,7 @@ void rtt_board_init(void)
board_init_console();
board_init_pmp();

dma_manager_init();
dma_mgr_init();

/* initialize memory system */
rt_system_heap_init(RT_HW_HEAP_BEGIN, RT_HW_HEAP_END);
Expand Down
2 changes: 2 additions & 0 deletions common/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.gitattributes export-ignore
.gitignore export-ignore
67 changes: 67 additions & 0 deletions common/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Prerequisites
*.d

# Object files
*.o
*.ko
*.obj
*.elf

# Linker output
*.ilk
*.map
*.exp

# Precompiled Headers
*.gch
*.pch

# Libraries
*.lib
*.a
*.la
*.lo

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

# Debug files
*.dSYM/
*.su
*.idb
*.pdb

# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf

# Paython cache
*.pyc

# Scons cache
*.dbsqlite

# hpm_sdk docs
libraries/hpm_sdk/**/doc
libraries/hpm_sdk/**/docs
libraries/hpm_sdk/**/test
*.yaml

#dir
.vscode
2 changes: 1 addition & 1 deletion common/libraries/Kconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
config SOC_HPM6000_SERIES
config SOC_SERIES_HPM5000
bool
select ARCH_RISCV32
select ARCH_RISCV_DPU
3 changes: 3 additions & 0 deletions common/libraries/drivers/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ if GetDepend('BSP_USING_RTC'):
if GetDepend('BSP_USING_WDG'):
src += ['drv_wdt.c']

if GetDepend('BSP_USING_EWDG'):
src += ['drv_ewdt.c']

if GetDepend('BSP_USING_ETH'):
src += ['drv_enet.c']

Expand Down
Loading

0 comments on commit bc18113

Please sign in to comment.