This post was last edited by qinyunti on 2022-11-12 10:27
Prepare
The prerequisite is that MDK and JLINK have been installed.
MDK version V5.37
JLINK version V7.82 (V7.5 or above)
Development board reference
https://www2.renesas.cn/cn/zh/products/microcontrollers-microprocessors/ra-cortex-m-mcus/cpk-ra2l1-evaluation-board#overview
Code Download
git clone https://github.com/RT-Thread/rt-thread.git
Double-click rt-thread\bsp\renesas\ra2l1-cpk\project.uvprojx
The package installation prompt will pop up automatically, just click Install to install it.
If prompted to upgrade Jlink, click on it.
Project Configuration
Right click on the project directory on the left
Target1->Options for Target 'Target1'
Select the chip as follows
Fix compilation errors
If there are compilation errors, please refer to the following modifications
rt-thread\bsp\renesas\ra2l1-cpk\ra\fsp\src\r_icu\r_icu.c
Comment out #include "r_icu_cfg.h"
rt-thread\bsp\renesas\ra2l1-cpk\rtconfig.h
#define RT_CONSOLE_DEVICE_NAME "uart" to
#define RT_CONSOLE_DEVICE_NAME "uart9"
Comment out
#define RT_USING_DFS
#define DFS_USING_POSIX
#define RT_USING_SERIAL_V1
Change to
#define RT_USING_SERIAL_V2
#define BSP_USING_UART
Change to
#define BSP_USING_UART9
Add two lines after
#define BSP_UART9_RX_BUFSIZE 128
#define BSP_UART9_TX_BUFSIZE 128
Compile
JFlashLite Download
JFlashLite.exe
Select the file rt-thread\bsp\renesas\ra2l1-cpk\Objects\rtthread.hex
JLink Simulation Debug
After confirming that the project configuration is set up, you can enter the simulation environment
There is a pit here. If the following information is prompted
Then check the file JLinkSettings.ini in the project directory
Put the inside
Device="xxxx"
Change to
Device="R7FA2L1AB"
Even if you select the chip in the project configuration, it will not be automatically modified here and needs to be modified manually.
Debug serial port
rtconfig.h
#define RT_CONSOLE_DEVICE_NAME "uart"
Change to
#define RT_CONSOLE_DEVICE_NAME "uart9"
wiring
UART9: P109(TXD)-J2-2, P110(RXD)-J2-3 GND-J2-8
The serial port is disconnected, the parameters are 115200-8-n-1 without flow control.
You can see the print by running the program. You can enter help to view the command.