【瑞萨EK-RA4C1评估套件】建立e2Studio开发环境,完成点灯测试
本帖最后由 suncat0504 于 2026-5-27 22:06 编辑开发板拿到手的这两天,着手准备开发环境。默认想使用官方的e2Studio开发环境。于是去官网下载了一堆软件,主要是不知道哪些有用,哪些没用。刚好最近瑞萨有直播,讲解如何使用e2Studio开发示例程序。而且e2Studio本身自带类似CubeMX那样的集成工具,可以直观地设计,非常方便。我之前安装过e2Studio,跟着直播学习的时候。在建立新工程时,在选择设备页面中FSP版本所在的下拉列表框中没有任何数据出现, 于是又去以下网址https://github.com/renesas/fsp/releases下载了“setup_fsp_v6_4_0_e2s_v2025-12.exe”程序,并执行安装,终于成功。在该页面按照以下方式设置后,执行下一步, 选择非操作系统模式,继续下一步, 设位置不变,下一步,
设位置不变,继续下一步, 选择“Blinky”,点击完成后,成功建立测试工程。文件hal_entry.c中程序代码:/*
* Copyright (c) 2020 - 2026 Renesas Electronics Corporation and/or its affiliates
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "hal_data.h"
extern bsp_leds_t g_bsp_leds;
/*******************************************************************************************************************//**
* @briefBlinky example application
*
* Blinks all leds at a rate of 1 second using the software delay function provided by the BSP.
*
**********************************************************************************************************************/
void hal_entry(void)
{
#if BSP_TZ_SECURE_BUILD
/* Enter non-secure code */
R_BSP_NonSecureEnter();
#endif
/* Define the units to be used with the software delay function */
const bsp_delay_units_t bsp_delay_units = BSP_DELAY_UNITS_MILLISECONDS;
/* Set the blink frequency (must be <= bsp_delay_units / 2) */
const uint32_t freq_in_hz = 1;
/* Calculate the delay in terms of bsp_delay_units */
const uint32_t delay = bsp_delay_units / (freq_in_hz * 2);
/* LED type structure */
bsp_leds_t leds = g_bsp_leds;
/* Wake up 2nd core if this is first core and we are inside a multicore project. */
#if (0 == _RA_CORE) && (1 == BSP_MULTICORE_PROJECT) && !BSP_TZ_NONSECURE_BUILD
R_BSP_SecondaryCoreStart();
#endif
/* If this board has no LEDs then trap here */
if (0 == leds.led_count)
{
while (1)
{
; // There are no LEDs on this board
}
}
/* Holds level to set for pins */
bsp_io_level_t pin_level = BSP_IO_LEVEL_LOW;
while (1)
{
/* Enable access to the PFS registers. If using r_ioport module then register protection is automatically
* handled. This code uses BSP IO functions to show how it is used.
*/
R_BSP_PinAccessEnable ();
#if BSP_NUMBER_OF_CORES == 1
/* Update all board LEDs */
for (uint32_t i = 0; i < leds.led_count; i++)
{
/* Get pin to toggle */
uint32_t pin = leds.p_leds;
/* Write to this pin */
R_BSP_PinWrite ((bsp_io_port_pin_t) pin, pin_level);
}
#else
/* Update LED that is at the index of this core. */
R_BSP_PinWrite((bsp_io_port_pin_t) leds.p_leds, pin_level);
#endif
/* Protect PFS registers */
R_BSP_PinAccessDisable ();
/* Toggle level for next write */
if (BSP_IO_LEVEL_LOW == pin_level)
{
pin_level = BSP_IO_LEVEL_HIGH;
}
else
{
pin_level = BSP_IO_LEVEL_LOW;
}
/* Delay */
R_BSP_SoftwareDelay (delay, bsp_delay_units);
}
}
什么都不用改,点击工具条中的小榔头,编译程序,没有任何问题。然后接下来在调试时出了问题。按照以往的经验,在工程上设置调试/运行配置,使用默认配置,直接调试/运行就应该会自动完成烧录并启动运行,结果失败。 最后使用以下方式成功: 成功后再去配置页面看,是这样的结果: 看到开发板上三个颜色的指示灯同时周期性亮、灭,一位置打通了e2Studio下最简单的程序开发过程。
页:
[1]