README.md
1# HPMicro HPM6300EVK 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 HPM6300EVK development board.
8
9The document consists of the following parts:
10
11- HPM6300EVK 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
19HPM6300EVK 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| Ethernet | √ | Supported by RT-Thread Industry IO |
33| GPIO | √ | |
34| SPI | √ | |
35| I2C | √ | |
36| SDIO | √ | |
37| RTC | √ | |
38| PWM | √ | |
39| On-Board Debugger | √ | ft2232 |
40
41
42## Execution Instruction
43
44### Quickly Getting Started
45
46The BSP support being build via the 'scons' command, below is the steps of compiling the example via the 'scons' command
47
48#### Parpare Environment
49- Step 1: Prepare [RT-Thread ENV](https://www.rt-thread.org/download.html#download-rt-thread-env-tool)
50- Step 2: Prepare [toolcahin](https://github.com/helloeagleyang/riscv32-gnu-toolchain-win/archive/2022.04.12.zip)
51 - Download the package and extract it into a specified directory, for example: `C:\DevTools\riscv32-gnu-toolchain`
52- Step 3: Set environment variable `RTT_RISCV_TOOLCHAIN` to `<TOOLCHAIN_DIR>\bin`
53 - For example: `C:\DevTools\riscv32-gnu-toolchain\bin`
54- Step 4: Prepare [OpenOCD](https://github.com/hpmicro/rtt-debugger-support-package/archive/v0.4.0.zip)
55 - Download and extract it to specified directory, for example: `C:\DevTools\openocd-hpmicro`
56 - Add `OpenOCD` environment variable `OPENOCD_HPMICRO` to `<OPENOCD_HPMICRO_DIR>\bin`
57 - For example: `C:\DevTools\openocd-hpmicro\bin`
58
59#### Configure and Build project
60
61Open RT-Thread ENV command-line, and change directory to this BSP directory, then users can:
62
63- Configure the project via `menuconfig` in `RT-Thread ENV`
64- Build the project using `scons -jN`, `N` equals to the number of CPU cores
65- Clean the project using `scons -c`
66
67#### Hardware Connection
68
69- Switch BOOT pin to 2'b00
70- Connect the `PWR_DEBUG` port to PC via TYPE-C cable
71
72
73#### Dowload / Debug
74
75- Users can download the project via the below command:
76 ```console
77 %OPENOCD_HPMICRO%\openocd.exe -f boards\debug_scripts\probes\ft2232.cfg -f boards\debug_scripts\soc\hpm6360.cfg -f boards\debug_scripts\boards\hpm6300evk.cfg -c "init; halt; flash write_image erase rtthread.elf; reset; shutdown"
78 ```
79
80- Users can debug the project via the below command:
81
82 - Connect debugger via `OpenOCD`:
83
84```console
85%OPENOCD_HPMICRO%\openocd.exe -f boards\debug_scripts\probes\ft2232.cfg -f boards\debug_scripts\soc\hpm6360.cfg -f boards\debug_scripts\boards\hpm6300evk.cfg
86```
87 - Start Debugger via `GDB`:
88
89```console
90%RTT_EXEC_PATH%\riscv32-unknown-elf-gdb.exe rtthread.elf
91```
92 - In the `gdb shell`, type the following commands:
93
94```console
95load
96c
97```
98
99### **Running Results**
100
101Once the project is successfully downloaded, the system runs automatically. The LED on the board will flash periodically.
102
103Connect 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:
104
105```
106 \ | /
107- RT - Thread Operating System
108 / | \ 5.0.1 build Aug 16 2023 18:18:18
109 2006 - 2023 Copyright by RT-Thread team
110```
111
112## **References**
113
114- [RT-Thread Documnent Center](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-standard/README)
115- [RT-Thread Env](https://github.com/RT-Thread/rtthread-manual-doc/blob/master/env/env.md)
116- [HPM6300EVK RT-Thread BSP Package](https://github.com/hpmicro/rtt-bsp-hpm6300evk)