README.md
1# HPMicro HPM5301EVKLITE BSP(Board Support Package) Introduction
2
3[中文页](README_zh.md) |
4
5## Introduction
6
7This document provides brief introduction of the BSP (board support package) for the HPM5301EVKLITE development board.
8
9The document consists of the following parts:
10
11- HPM5301EVKLITE Board Resources Introduction
12- Quickly Getting Started
13- Refreences
14
15By reading the Quickly Get Started section developers can quickly get their hands on this BSP and run RT-Thread on the board. More advanced features will be introduced in the Advanced Features section to help developers take advantage of RT-Thread to drive more on-board resources.
16
17## Board Resources Introduction
18
19HPM5301EVKLITE is a development board based on the RISC-V core launched by HPMicro, with rich on-board resources and on-chip resources for motor control, etc.
20
21
22
23## Peripheral Condition
24
25Each peripheral supporting condition for this BSP is as follows:
26
27
28| **On-board Peripherals** | **Support** | **Note** |
29| ------------------------ | ----------- | ------------------------------------- |
30| USB | √ | |
31| QSPI Flash | √ | |
32| GPIO | √ | |
33| SPI | √ | |
34| I2C | √ | |
35| On-Board Debugger | x | 20-PIN Standard JTAG Port |
36
37
38## Execution Instruction
39
40### Quickly Getting Started
41
42The BSP support being build via the 'scons' command, below is the steps of compiling the example via the 'scons' command
43
44#### Parpare Environment
45- Step 1: Prepare [RT-Thread ENV](https://www.rt-thread.org/download.html#download-rt-thread-env-tool)
46- Step 2: Prepare [toolcahin](https://github.com/helloeagleyang/riscv32-gnu-toolchain-win/archive/2022.04.12.zip)
47 - Download the package and extract it into a specified directory, for example: `C:\DevTools\riscv32-gnu-toolchain`
48- Step 3: Set environment variable `RTT_RISCV_TOOLCHAIN` to `<TOOLCHAIN_DIR>\bin`
49 - For example: `C:\DevTools\riscv32-gnu-toolchain\bin`
50- Step 4: Prepare [OpenOCD](https://github.com/hpmicro/rtt-debugger-support-package/archive/v0.4.0.zip)
51 - Download and extract it to specified directory, for example: `C:\DevTools\openocd-hpmicro`
52 - Add `OpenOCD` environment variable `OPENOCD_HPMICRO` to `<OPENOCD_HPMICRO_DIR>\bin`
53 - For example: `C:\DevTools\openocd-hpmicro\bin`
54
55#### Configure and Build project
56
57Open RT-Thread ENV command-line, and change directory to this BSP directory, then users can:
58
59- Configure the project via `menuconfig` in `RT-Thread ENV`
60- Build the project using `scons -jN`, `N` equals to the number of CPU cores
61- Clean the project using `scons -c`
62
63#### Hardware Connection
64
65- Switch BOOT pin to 2'b00
66- Connect the `PWR_DEBUG` port to PC via TYPE-C cable
67
68
69#### Dowload / Debug
70
71- Users can download the project via the below command:
72 ```console
73 %OPENOCD_HPMICRO%\openocd.exe -f boards\debug_scripts\probes\cmsis_dap.cfg -f boards\debug_scripts\soc\hpm5300.cfg -f boards\debug_scripts\boards\hpm5301evklite.cfg -c "init; halt; flash write_image erase rtthread.elf; reset; shutdown"
74 ```
75
76- Users can debug the project via the below command:
77
78 - Connect debugger via `OpenOCD`:
79
80```console
81%OPENOCD_HPMICRO%\openocd.exe -f boards\debug_scripts\probes\cmsis_dap.cfg -f boards\debug_scripts\soc\hpm5300.cfg -f boards\debug_scripts\boards\hpm5301evklite.cfg
82```
83 - Start Debugger via `GDB`:
84
85```console
86%RTT_EXEC_PATH%\riscv32-unknown-elf-gdb.exe rtthread.elf
87```
88 - In the `gdb shell`, type the following commands:
89
90```console
91load
92c
93```
94
95### **Running Results**
96
97Once the project is successfully downloaded, the system runs automatically. The LED on the board will flash periodically.
98
99Connect the serial port of the board to the PC, communicate with it via a serial terminal tool(115200-8-1-N). Reset the board and the startup information of RT-Thread will be observed:
100
101```
102 \ | /
103- RT - Thread Operating System
104 / | \ 5.1.0 build Aug 16 2023 18:18:18
105 2006 - 2024 Copyright by RT-Thread team
106```
107
108## **References**
109
110- [RT-Thread Documnent Center](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-standard/README)
111- [RT-Thread Env](https://github.com/RT-Thread/rtthread-manual-doc/blob/master/env/env.md)
112- [HPM5301EVKLITE RT-Thread BSP Package](https://github.com/hpmicro/rtt-bsp-hpm5301evklite)