RZV Flexible Software Package Documentation  Release v2.0.0

 
MPU Board Support Package

Functions

fsp_err_t R_FSP_VersionGet (fsp_pack_version_t *const p_version)
 
void Reset_Handler_NS (void)
 
void Default_Handler (void)
 
void NMI_Handler_NS (void)
 
void Reset_Handler_S (void)
 
void Default_Handler_S (void)
 
void NMI_Handler_S (void)
 
void SecureFault_Handler (void)
 
void SystemInit (void)
 
void R_BSP_WarmStart (bsp_warm_start_event_t event)
 
void R_BSP_SecurityInit (void)
 
void SystemInit_S (void)
 
 __attribute__ ((naked))
 
uint32_t R_FSP_SystemClockHzGet (fsp_priv_clock_t clock)
 
fsp_err_t R_BSP_ClockSelectorSet (fsp_priv_clock_selector_t selector, uint32_t clock_sel)
 
fsp_err_t R_BSP_ClockDividerSet (fsp_priv_clock_divider_t divider, uint32_t clock_div)
 
fsp_err_t R_BSP_VersionGet (fsp_version_t *p_version)
 
void R_BSP_SoftwareDelay (uint32_t delay, bsp_delay_units_t units)
 
fsp_err_t R_BSP_GroupIrqWrite (bsp_grp_irq_t irq, void(*p_callback)(bsp_grp_irq_t irq))
 
__STATIC_INLINE IRQn_Type R_FSP_CurrentIrqGet (void)
 
__STATIC_INLINE bsp_unique_id_t const * R_BSP_UniqueIdGet ()
 

Detailed Description

The BSP is responsible for getting the MCU from reset to the user's application. Before reaching the user's application, the BSP sets up the stacks, heap, clocks, interrupts, C runtime environment, and stack monitor.

Overview

BSP Features

BSP Clock Configuration

All system clocks are set up during BSP initialization based on the settings in bsp_clock_cfg.h. These settings are derived from clock configuration information provided from the Configuration editor Clocks tab.

System Interrupts

As RZ MPUs are based on the Cortex-M ARM architecture, the NVIC Nested Vectored Interrupt Controller (NVIC) handles exceptions and interrupt configuration, prioritization and interrupt masking. In the ARM architecture, the NVIC handles exceptions. Some exceptions are known as System Exceptions. System exceptions are statically located at the "top" of the vector table and occupy vector numbers 1 to 15. Vector zero is reserved for the MSP Main Stack Pointer (MSP). The remaining 15 system exceptions are shown below:

NMI and Hard Fault exceptions are enabled out of reset and have fixed priorities. Other exceptions have configurable priorities and some can be disabled.

Group Interrupts

Group Interrupts are not supported in this device.

External and Peripheral Interrupts

RZ MPU supports 480 interrupts by NVIC, and any factor can be registered in the vector table from the Interrupts tab of the Configuration editor.

BSP Weak Symbols

You might wonder how the BSP is able to place ISR addresses in the NVIC table without the user having explicitly defined one. All that is required by the BSP is that the interrupt event be given a priority.

This is accomplished through the use of the 'weak' attribute. The weak attribute causes the declaration to be emitted as a weak symbol rather than a global. A weak symbol is one that can be overridden by an accompanying strong reference with the same name. When the BSP declares a function as weak, user code can define the same function and it will be used in place of the BSP function. By defining all possible interrupt sources as weak, the vector table can be built at compile time and any user declarations (strong references) will be used at runtime.

Weak symbols are supported for ELF targets and also for a.out targets when using the GNU assembler and linker.

Note that in CMSIS system.c, there is also a weak definition (and a function body) for the Warm Start callback function R_BSP_WarmStart(). Because this function is defined in the same file as the weak declaration, it will be called as the 'default' implementation. The function may be overridden by the user by copying the body into their user application and modifying it as necessary. The linker identifies this as the 'strong' reference and uses it.

Warm Start Callbacks

As the BSP is in the process of bringing up the board out of reset, there are three points where the user can request a callback. These are defined as the 'Pre Clock Init', 'Post Clock Init' and 'Post C' warm start callbacks.

As described above, this function is already weakly defined as R_BSP_WarmStart(), so it is a simple matter of redefining the function or copying the existing body from CMSIS system.c into the application code to get a callback. R_BSP_WarmStart() takes an event parameter of type bsp_warm_start_event_t which describes the type of warm start callback being made.

This function is not enabled/disabled and is always called for both events as part of the BSP startup. Therefore it needs a function body, which will not be called if the user is overriding it. The function body is located in system.c. To use this function just copy this function into your own code and modify it to meet your needs.

C Runtime Initialization

This BSP configuration allows the user to skip the FSP C runtime initialization code by setting the "C Runtime Initialization" to "Disabled" on the BSP tab of the Configuration editor. Disabling this option is useful in cases where a non-standard linker script is being used or other modifications to the runtime initialization are desired. If this macro is disabled, the user must use the 'Post Clock Init' event from the warm start (described above) to run their own runtime initialization code.

Heap Allocation

The relatively low amount of on-chip SRAM available and lack of memory protection in an MPU means that heap use must be very carefully controlled to avoid memory leaks, overruns and attempted overallocation. Further, many RTOSes provide their own dynamic memory allocation system. For these reasons the default heap size is set at 0 bytes, effectively disabling dynamic memory. If it is required for an application setting a positive value to the "Heap size (bytes)" option in the Common configurations on the BSP tab will allocate a heap.

Note
When using printf/sprintf (and other variants) to output floating point numbers a heap is required. A minimum size of 0x1000 (4096) bytes is recommended when starting development in this case.

Error Logging

When error logging is enabled, the error logging function can be redefined on the command line by defining FSP_ERROR_LOG(err) to the desired function call. The default function implementation is FSP_ERROR_LOG(err)=fsp_error_log(err, FILE, LINE). This implementation uses the predefined macros FILE and LINE to help identify the location where the error occurred. Removing the line from the function call can reduce code size when error logging is enabled. Some compilers may support other predefined macros like FUNCTION, which could be helpful for customizing the error logger.

Register Protection

This feature is not supported on this device.

ID Codes

This feature is not supported on this device.

Software Delay

Implements a blocking software delay. A delay can be specified in microseconds, milliseconds or seconds. The delay is implemented based on the system clock rate.

/* Delay at least 1 second. Depending on the number of wait states required for the region of memory
* that the software_delay_loop has been linked in this could take longer. The default is 4 cycles per loop.
* This can be modified by redefining DELAY_LOOP_CYCLES. BSP_DELAY_UNITS_SECONDS, BSP_DELAY_UNITS_MILLISECONDS,
* and BSP_DELAY_UNITS_MICROSECONDS can all be used with R_BSP_SoftwareDelay. */

Critical Section Macros

Implements a critical section. Some MPUs (MPUs with the BASEPRI register) support allowing high priority interrupts to execute during critical sections. On these MPUs, interrupts with priority less than or equal to BSP_CFG_IRQ_MASK_LEVEL_FOR_CRITICAL_SECTION are not serviced in critical sections. Interrupts with higher priority than BSP_CFG_IRQ_MASK_LEVEL_FOR_CRITICAL_SECTION still execute in critical sections.

FSP_CRITICAL_SECTION_DEFINE;
/* Store the current interrupt posture. */
/* Interrupts cannot run in this section unless their priority is less than BSP_CFG_IRQ_MASK_LEVEL_FOR_CRITICAL_SECTION. */
/* Restore saved interrupt posture. */

OctaClock Update

This feature is not supported on this device.

Board Specific Features

The BSP will call the board's initialization function (bsp_init) which can initialize board specific features.

Configuration

The BSP is heavily data driven with most features and functionality being configured based on the content from configuration files. Configuration files represent the settings specified by the user and are generated when the project is built and/or when the Generate Project Content button is clicked in the Configuration editor.

Build Time Configurations for fsp_common

The following build time configurations are defined in fsp_cfg/bsp/bsp_cfg.h:

ConfigurationOptionsDefaultDescription
Secure stack size (bytes)Value must be an integer multiple of 8 and between 8 and 0xFFFFFFFF0x200 Set the size of the secure program stack.

NOTE: This entry is for the secure stack.
Main stack size (bytes)Value must be an integer multiple of 8 and between 8 and 0xFFFFFFFF0x200 Set the size of the main program stack.

NOTE: This entry is for the main stack. When using an RTOS, thread stacks can be configured in the properties for each thread.
Heap size (bytes)Value must be 0 or an integer multiple of 8 between 8 and 0xFFFFFFFF.0 The main heap is disabled by default. Set the heap size to a positive integer divisible by 8 to enable it.

A minimum of 4K (0x1000) is recommended if standard library functions are to be used.
MCU Vcc (mV)Value must between 0 and 5500 (5.5V)3300 Some peripherals require different settings based on the supplied voltage. Entering Vcc here (in mV) allows the relevant driver modules to configure the associated peripherals accordingly.
Parameter checking
  • Enabled
  • Disabled
Disabled When enabled, parameter checking for the BSP is turned on. In addition, any modules whose parameter checking configuration is set to 'Default (BSP)' will perform parameter checking as well.
Assert Failures
  • Return FSP_ERR_ASSERTION
  • Call fsp_error_log then Return FSP_ERR_ASSERTION
  • Use assert() to Halt Execution
  • Disable checks that would return FSP_ERR_ASSERTION
Return FSP_ERR_ASSERTION Define the behavior of the FSP_ASSERT() macro.
Error Log
  • No Error Log
  • Errors Logged via fsp_error_log
No Error Log Specify error logging behavior.
PFS Protect
  • Disabled
  • Enabled
Enabled Keep the PFS registers locked when they are not being modified. If disabled they will be unlocked during startup.
C Runtime Initialization
  • Enabled
  • Disabled
Enabled Select if the C runtime initialization in the BSP is to be used. If disabled, use the BSP_WARM_START_POST_CLOCK event to run user defined equivalent.

Secure state of CR8 cores (RZ/V2H)

The default setting for bus access from the Cortex-R8 core is Non-Secure access.

If you want to change to secure and privileged access, change the setting value of the SYS_MSTACCCTL2 register in src/cr8_start.c to 0x00999999.

src/cr8_start.c

Modules

 RZV2H
 
 RZV2L
 

Macros

#define R_BSP_MODULE_START(ip, ch)
 
#define R_BSP_MODULE_STOP(ip, ch)
 
#define R_BSP_MODULE_START_FSP_IP_GTM(ip, ch)
 
#define R_BSP_MODULE_STOP_FSP_IP_GTM(ip, ch)
 
#define R_BSP_MODULE_START_FSP_IP_GPT(ip, ch)
 
#define R_BSP_MODULE_STOP_FSP_IP_GPT(ip, ch)
 
#define R_BSP_MODULE_START_FSP_IP_CANFD(ip, ch)
 
#define R_BSP_MODULE_STOP_FSP_IP_CANFD(ip, ch)
 
#define R_BSP_MODULE_START_FSP_IP_ADC(ip, ch)
 
#define R_BSP_MODULE_STOP_FSP_IP_ADC(ip, ch)
 
#define R_BSP_MODULE_START_FSP_IP_MHU(ip, ch)
 
#define R_BSP_MODULE_STOP_FSP_IP_MHU(ip, ch)
 
#define R_BSP_MODULE_START_FSP_IP_POEG(ip, ch)
 
#define R_BSP_MODULE_STOP_FSP_IP_POEG(ip, ch)
 
#define R_BSP_MODULE_START_FSP_IP_RIIC(ip, ch)
 
#define R_BSP_MODULE_STOP_FSP_IP_RIIC(ip, ch)
 
#define R_BSP_MODULE_START_FSP_IP_SCI(ip, ch)
 
#define R_BSP_MODULE_STOP_FSP_IP_SCI(ip, ch)
 
#define R_BSP_MODULE_START_FSP_IP_RSPI(ip, ch)
 
#define R_BSP_MODULE_STOP_FSP_IP_RSPI(ip, ch)
 
#define R_BSP_MODULE_START_FSP_IP_TSU(ip, ch)
 
#define R_BSP_MODULE_STOP_FSP_IP_TSU(ip, ch)
 
#define R_BSP_MODULE_START_FSP_IP_SCIF(ip, ch)
 
#define R_BSP_MODULE_STOP_FSP_IP_SCIF(ip, ch)
 
#define R_BSP_MODULE_START_FSP_IP_DMAC(ip, ch)
 
#define R_BSP_MODULE_STOP_FSP_IP_DMAC(ip, ch)
 
#define R_BSP_MODULE_START_FSP_IP_WDT(ip, ch)
 
#define R_BSP_MODULE_STOP_FSP_IP_WDT(ip, ch)
 
#define R_BSP_MODULE_START_FSP_IP_MTU3(ip, ch)
 
#define R_BSP_MODULE_STOP_FSP_IP_MTU3(ip, ch)
 
#define R_BSP_MSTP_START(ip, channel)
 
#define R_BSP_MSTP_STOP(ip, channel)
 
#define BSP_IRQ_DISABLED
 
#define FSP_RETURN(err)
 
#define FSP_ERROR_LOG(err)
 
#define FSP_ASSERT(a)
 
#define FSP_ERROR_RETURN(a, err)
 
#define FSP_CRITICAL_SECTION_ENTER
 
#define FSP_CRITICAL_SECTION_EXIT
 
#define FSP_INVALID_VECTOR
 
#define BSP_CFG_HANDLE_UNRECOVERABLE_ERROR(x)
 
#define BSP_STACK_ALIGNMENT
 
#define BSP_IRQ_DISABLED
 
#define FSP_RETURN(err)
 
#define FSP_ERROR_LOG(err)
 
#define FSP_ASSERT(a)
 
#define FSP_ERROR_RETURN(a, err)
 
#define FSP_CRITICAL_SECTION_ENTER
 
#define FSP_CRITICAL_SECTION_EXIT
 
#define FSP_INVALID_VECTOR
 
#define BSP_CFG_HANDLE_UNRECOVERABLE_ERROR(x)
 
#define BSP_STACK_ALIGNMENT
 

Enumerations

enum  fsp_ip_t
 
enum  bsp_delay_units_t
 
enum  bsp_grp_irq_t
 
enum  bsp_warm_start_event_t
 
enum  bsp_warm_start_event_t
 

Variables

uint32_t SystemCoreClock
 
uint32_t SystemCoreClock
 
const fsp_version_t g_bsp_version
 Default initialization function. More...
 
const fsp_version_t g_bsp_version
 Default initialization function. More...
 

Macro Definition Documentation

◆ R_BSP_MODULE_START

#define R_BSP_MODULE_START (   ip,
  ch 
)

Cancels the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be started
chThe channel. Use channel 0 for modules without channels.

◆ R_BSP_MODULE_STOP

#define R_BSP_MODULE_STOP (   ip,
  ch 
)

Enables the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be stopped
chThe channel. Use channel 0 for modules without channels.

◆ R_BSP_MODULE_START_FSP_IP_GTM

#define R_BSP_MODULE_START_FSP_IP_GTM (   ip,
  ch 
)

Cancel the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be stopped
chThe channel. Use channel 0 for modules without channels.

◆ R_BSP_MODULE_STOP_FSP_IP_GTM

#define R_BSP_MODULE_STOP_FSP_IP_GTM (   ip,
  ch 
)

Enables the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be stopped
chThe channel. Use channel 0 for modules without channels.

◆ R_BSP_MODULE_START_FSP_IP_GPT

#define R_BSP_MODULE_START_FSP_IP_GPT (   ip,
  ch 
)

Cancel the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be stopped
chThe channel. Use channel 0 for modules without channels.

◆ R_BSP_MODULE_STOP_FSP_IP_GPT

#define R_BSP_MODULE_STOP_FSP_IP_GPT (   ip,
  ch 
)

Enables the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be stopped
chThe channel. Use channel 0 for modules without channels.

◆ R_BSP_MODULE_START_FSP_IP_CANFD

#define R_BSP_MODULE_START_FSP_IP_CANFD (   ip,
  ch 
)

Cancel the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be stopped
chThe channel. Use channel 0 for modules without channels.

◆ R_BSP_MODULE_STOP_FSP_IP_CANFD

#define R_BSP_MODULE_STOP_FSP_IP_CANFD (   ip,
  ch 
)

Enables the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be stopped
chThe channel. Use channel 0 for modules without channels.

◆ R_BSP_MODULE_START_FSP_IP_ADC

#define R_BSP_MODULE_START_FSP_IP_ADC (   ip,
  ch 
)

Cancel the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be stopped
chThe channel. Use channel 0 for modules without channels.

◆ R_BSP_MODULE_STOP_FSP_IP_ADC

#define R_BSP_MODULE_STOP_FSP_IP_ADC (   ip,
  ch 
)

Enables the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be stopped
chThe channel. Use channel 0 for modules without channels.

◆ R_BSP_MODULE_START_FSP_IP_MHU

#define R_BSP_MODULE_START_FSP_IP_MHU (   ip,
  ch 
)

Cancel the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be stopped
chThe channel. Use channel 0 for modules without channels.

◆ R_BSP_MODULE_STOP_FSP_IP_MHU

#define R_BSP_MODULE_STOP_FSP_IP_MHU (   ip,
  ch 
)

Enables the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be stopped
chThe channel. Use channel 0 for modules without channels.

◆ R_BSP_MODULE_START_FSP_IP_POEG

#define R_BSP_MODULE_START_FSP_IP_POEG (   ip,
  ch 
)

Cancel the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be stopped
chThe channel. Use channel 0 for modules without channels.

◆ R_BSP_MODULE_STOP_FSP_IP_POEG

#define R_BSP_MODULE_STOP_FSP_IP_POEG (   ip,
  ch 
)

Enables the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be stopped
chThe channel. Use channel 0 for modules without channels.

◆ R_BSP_MODULE_START_FSP_IP_RIIC

#define R_BSP_MODULE_START_FSP_IP_RIIC (   ip,
  ch 
)

Cancel the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be stopped
chThe channel. Use channel 0 for modules without channels.

◆ R_BSP_MODULE_STOP_FSP_IP_RIIC

#define R_BSP_MODULE_STOP_FSP_IP_RIIC (   ip,
  ch 
)

Enables the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be stopped
chThe channel. Use channel 0 for modules without channels.

◆ R_BSP_MODULE_START_FSP_IP_SCI

#define R_BSP_MODULE_START_FSP_IP_SCI (   ip,
  ch 
)

Cancel the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be stopped
chThe channel. Use channel 0 for modules without channels.

◆ R_BSP_MODULE_STOP_FSP_IP_SCI

#define R_BSP_MODULE_STOP_FSP_IP_SCI (   ip,
  ch 
)

Enables the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be stopped
chThe channel. Use channel 0 for modules without channels.

◆ R_BSP_MODULE_START_FSP_IP_RSPI

#define R_BSP_MODULE_START_FSP_IP_RSPI (   ip,
  ch 
)

Cancel the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be stopped
chThe channel. Use channel 0 for modules without channels.

◆ R_BSP_MODULE_STOP_FSP_IP_RSPI

#define R_BSP_MODULE_STOP_FSP_IP_RSPI (   ip,
  ch 
)

Enables the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be stopped
chThe channel. Use channel 0 for modules without channels.

◆ R_BSP_MODULE_START_FSP_IP_TSU

#define R_BSP_MODULE_START_FSP_IP_TSU (   ip,
  ch 
)

Cancel the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be stopped
chThe channel. Use channel 0 for modules without channels.

◆ R_BSP_MODULE_STOP_FSP_IP_TSU

#define R_BSP_MODULE_STOP_FSP_IP_TSU (   ip,
  ch 
)

Enables the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be stopped
chThe channel. Use channel 0 for modules without channels.

◆ R_BSP_MODULE_START_FSP_IP_SCIF

#define R_BSP_MODULE_START_FSP_IP_SCIF (   ip,
  ch 
)

Cancel the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be stopped
chThe channel. Use channel 0 for modules without channels.

◆ R_BSP_MODULE_STOP_FSP_IP_SCIF

#define R_BSP_MODULE_STOP_FSP_IP_SCIF (   ip,
  ch 
)

Enables the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be stopped
chThe channel. Use channel 0 for modules without channels.

◆ R_BSP_MODULE_START_FSP_IP_DMAC

#define R_BSP_MODULE_START_FSP_IP_DMAC (   ip,
  ch 
)

Cancel the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be stopped
chThe channel. Use channel 0 for modules without channels.

◆ R_BSP_MODULE_STOP_FSP_IP_DMAC

#define R_BSP_MODULE_STOP_FSP_IP_DMAC (   ip,
  ch 
)

Enables the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be stopped
chThe channel. Use channel 0 for modules without channels.

◆ R_BSP_MODULE_START_FSP_IP_WDT

#define R_BSP_MODULE_START_FSP_IP_WDT (   ip,
  ch 
)

Cancel the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be stopped
chThe channel. Use channel 0 for modules without channels.

◆ R_BSP_MODULE_STOP_FSP_IP_WDT

#define R_BSP_MODULE_STOP_FSP_IP_WDT (   ip,
  ch 
)

Enables the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be stopped
chThe channel. Use channel 0 for modules without channels.

◆ R_BSP_MODULE_START_FSP_IP_MTU3

#define R_BSP_MODULE_START_FSP_IP_MTU3 (   ip,
  ch 
)

Cancel the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be stopped
chThe channel. Use channel 0 for modules without channels.

◆ R_BSP_MODULE_STOP_FSP_IP_MTU3

#define R_BSP_MODULE_STOP_FSP_IP_MTU3 (   ip,
  ch 
)

Enables the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be stopped
chThe channel. Use channel 0 for modules without channels.

◆ R_BSP_MSTP_START

#define R_BSP_MSTP_START (   ip,
  channel 
)

Cancels the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be started.
channelThe channel. Use ch 0 for modules without channels.

◆ R_BSP_MSTP_STOP

#define R_BSP_MSTP_STOP (   ip,
  channel 
)

Enables the module stop state.

Parameters
ipfsp_ip_t enum value for the module to be stopped.
channelThe channel. Use ch 0 for modules without channels.

◆ BSP_IRQ_DISABLED [1/2]

#define BSP_IRQ_DISABLED

Used to signify that an interrupt factor is not available.

◆ FSP_RETURN [1/2]

#define FSP_RETURN (   err)

Macro to log and return error without an assertion.

◆ FSP_ERROR_LOG [1/2]

#define FSP_ERROR_LOG (   err)

This function is called before returning an error code. To stop on a runtime error, define fsp_error_log in user code and do required debugging (breakpoints, stack dump, etc) in this function.

◆ FSP_ASSERT [1/2]

#define FSP_ASSERT (   a)

Default assertion calls FSP_ERROR_RETURN if condition "a" is false. Used to identify incorrect use of API's in FSP functions.

◆ FSP_ERROR_RETURN [1/2]

#define FSP_ERROR_RETURN (   a,
  err 
)

All FSP error codes are returned using this macro. Calls FSP_ERROR_LOG function if condition "a" is false. Used to identify runtime errors in FSP functions.

◆ FSP_CRITICAL_SECTION_ENTER [1/2]

#define FSP_CRITICAL_SECTION_ENTER

This macro temporarily saves the current interrupt state and disables interrupts.

◆ FSP_CRITICAL_SECTION_EXIT [1/2]

#define FSP_CRITICAL_SECTION_EXIT

This macro restores the previously saved interrupt state, reenabling interrupts.

◆ FSP_INVALID_VECTOR [1/2]

#define FSP_INVALID_VECTOR

Used to signify that the requested IRQ vector is not defined in this system.

◆ BSP_CFG_HANDLE_UNRECOVERABLE_ERROR [1/2]

#define BSP_CFG_HANDLE_UNRECOVERABLE_ERROR (   x)

In the event of an unrecoverable error the BSP will by default call the __BKPT() intrinsic function which will alert the user of the error. The user can override this default behavior by defining their own BSP_CFG_HANDLE_UNRECOVERABLE_ERROR macro.

◆ BSP_STACK_ALIGNMENT [1/2]

#define BSP_STACK_ALIGNMENT

Stacks (and heap) must be sized and aligned to an integer multiple of this number.

◆ BSP_IRQ_DISABLED [2/2]

#define BSP_IRQ_DISABLED

Used to signify that an interrupt factor is not available.

◆ FSP_RETURN [2/2]

#define FSP_RETURN (   err)

Macro to log and return error without an assertion.

◆ FSP_ERROR_LOG [2/2]

#define FSP_ERROR_LOG (   err)

This function is called before returning an error code. To stop on a runtime error, define fsp_error_log in user code and do required debugging (breakpoints, stack dump, etc) in this function.

◆ FSP_ASSERT [2/2]

#define FSP_ASSERT (   a)

Default assertion calls FSP_ERROR_RETURN if condition "a" is false. Used to identify incorrect use of API's in FSP functions.

◆ FSP_ERROR_RETURN [2/2]

#define FSP_ERROR_RETURN (   a,
  err 
)

All FSP error codes are returned using this macro. Calls FSP_ERROR_LOG function if condition "a" is false. Used to identify runtime errors in FSP functions.

◆ FSP_CRITICAL_SECTION_ENTER [2/2]

#define FSP_CRITICAL_SECTION_ENTER

This macro temporarily saves the current interrupt state and disables interrupts.

◆ FSP_CRITICAL_SECTION_EXIT [2/2]

#define FSP_CRITICAL_SECTION_EXIT

This macro restores the previously saved interrupt state, reenabling interrupts.

◆ FSP_INVALID_VECTOR [2/2]

#define FSP_INVALID_VECTOR

Used to signify that the requested IRQ vector is not defined in this system.

◆ BSP_CFG_HANDLE_UNRECOVERABLE_ERROR [2/2]

#define BSP_CFG_HANDLE_UNRECOVERABLE_ERROR (   x)

In the event of an unrecoverable error the BSP will by default call the __BKPT() intrinsic function which will alert the user of the error. The user can override this default behavior by defining their own BSP_CFG_HANDLE_UNRECOVERABLE_ERROR macro.

◆ BSP_STACK_ALIGNMENT [2/2]

#define BSP_STACK_ALIGNMENT

Stacks (and heap) must be sized and aligned to an integer multiple of this number.

Enumeration Type Documentation

◆ fsp_ip_t

enum fsp_ip_t

Available modules.

Enumerator
FSP_IP_GTM 

General Timer.

FSP_IP_GPT 

General PWM Timer.

FSP_IP_POEG 

Port Output Enable for GPT.

FSP_IP_PORT 

I/O Ports.

FSP_IP_IM33 

IM33 (Interrupt controller)

FSP_IP_SCIF 

Serial Communications Interface with FIFO.

FSP_IP_RIIC 

I2C Bus Interface.

FSP_IP_RSPI 

Renesas Serial Peripheral Interface.

FSP_IP_MHU 

Message Handling Unit.

FSP_IP_DMAC 

Direct Memory Access Controller.

FSP_IP_SSI 

Serial Sound Interface.

FSP_IP_CANFD 

CANFD Interface (RS-CANFD)

FSP_IP_SCI 

Serial Communications Interface.

FSP_IP_MTU3 

Multi-Function Timer Pulse Unit 3.

FSP_IP_GTM 

General Timer.

FSP_IP_GPT 

General PWM Timer.

FSP_IP_POEG 

Port Output Enable for GPT.

FSP_IP_PORT 

I/O Ports.

FSP_IP_IM33 

IM33 (Interrupt controller)

FSP_IP_SCIF 

Serial Communications Interface with FIFO.

FSP_IP_RIIC 

I2C Bus Interface.

FSP_IP_RSPI 

Renesas Serial Peripheral Interface.

FSP_IP_MHU 

Message Handling Unit.

FSP_IP_DMAC 

Direct Memory Access Controller.

FSP_IP_DMAC_s 

Direct Memory Access Controller.

FSP_IP_SSI 

Serial Sound Interface.

FSP_IP_CANFD 

CANFD Interface (RS-CANFD)

FSP_IP_ADC 

A/D Converter.

FSP_IP_TSU 

Thermal Sensor Unit.

FSP_IP_WDT 

Watchdog Timer.

FSP_IP_SCI 

Serial Communications Interface.

FSP_IP_CMTW 

Compare Match Timer W.

FSP_IP_XSPI 

Expanded Serial Peripheral Interface.

FSP_IP_CRC 

Cyclic redundancy check (CRC) operation units.

FSP_IP_I3C 

I3C Bus Interface.

FSP_IP_RTC 

Realtime Clock.

FSP_IP_SYC 

System counter.

◆ bsp_delay_units_t

Available delay units for R_BSP_SoftwareDelay(). These are ultimately used to calculate a total # of microseconds

Enumerator
BSP_DELAY_UNITS_SECONDS 

Requested delay amount is in seconds.

BSP_DELAY_UNITS_MILLISECONDS 

Requested delay amount is in milliseconds.

BSP_DELAY_UNITS_MICROSECONDS 

Requested delay amount is in microseconds.

◆ bsp_grp_irq_t

Which interrupts can have callbacks registered.

Enumerator
BSP_GRP_IRQ_UNSUPPORTED 

NMI Group IRQ are not supported in this device.

◆ bsp_warm_start_event_t [1/2]

Different warm start entry locations in the BSP.

Enumerator
BSP_WARM_START_RESET 

Called almost immediately after reset. No C runtime environment, clocks, or IRQs.

BSP_WARM_START_POST_CLOCK 

Called after clock initialization. No C runtime environment or IRQs.

BSP_WARM_START_POST_C 

Called after clocks and C runtime environment have been set up.

BSP_WARM_START_RESET 

Called almost immediately after reset. No C runtime environment, clocks, or IRQs.

BSP_WARM_START_POST_CLOCK 

Called after clock initialization. No C runtime environment or IRQs.

BSP_WARM_START_POST_C 

Called after clocks and C runtime environment have been set up.

◆ bsp_warm_start_event_t [2/2]

Different warm start entry locations in the BSP.

Enumerator
BSP_WARM_START_RESET 

Called almost immediately after reset. No C runtime environment, clocks, or IRQs.

BSP_WARM_START_POST_CLOCK 

Called after clock initialization. No C runtime environment or IRQs.

BSP_WARM_START_POST_C 

Called after clocks and C runtime environment have been set up.

BSP_WARM_START_RESET 

Called almost immediately after reset. No C runtime environment, clocks, or IRQs.

BSP_WARM_START_POST_CLOCK 

Called after clock initialization. No C runtime environment or IRQs.

BSP_WARM_START_POST_C 

Called after clocks and C runtime environment have been set up.

Function Documentation

◆ R_FSP_VersionGet()

fsp_err_t R_FSP_VersionGet ( fsp_pack_version_t *const  p_version)

Get the FSP version based on compile time macros.

Parameters
[out]p_versionMemory address to return version information to.
Return values
FSP_SUCCESSVersion information stored.
FSP_ERR_ASSERTIONThe parameter p_version is NULL.

◆ Reset_Handler_NS()

void Reset_Handler_NS ( void  )

MPU starts executing here out of reset. Main stack pointer is set up already.

◆ Default_Handler()

void Default_Handler ( void  )

Default exception handler.

◆ NMI_Handler_NS()

void NMI_Handler_NS ( void  )

Non-maskable interrupt handler.

◆ Reset_Handler_S()

void Reset_Handler_S ( void  )

MPU starts executing here out of reset. Main stack pointer is set up already.

◆ Default_Handler_S()

void Default_Handler_S ( void  )

Default exception handler.

◆ NMI_Handler_S()

void NMI_Handler_S ( void  )

Non-maskable interrupt handler.

◆ SecureFault_Handler()

void SecureFault_Handler ( void  )

SecureFault_Handler

◆ SystemInit()

void SystemInit ( void  )

Initialize the MPU and the runtime environment.

◆ R_BSP_WarmStart()

void R_BSP_WarmStart ( bsp_warm_start_event_t  event)

This function is called at various points during the startup process. This function is declared as a weak symbol higher up in this file because it is meant to be overridden by a user implemented version. One of the main uses for this function is to call functional safety code during the startup process. To use this function just copy this function into your own code and modify it to meet your needs.

Parameters
[in]eventWhere the code currently is in the start up process

◆ R_BSP_SecurityInit()

void R_BSP_SecurityInit ( void  )

Initialize security features for TrustZone.

This function initializes security register for secure projects.

◆ SystemInit_S()

void SystemInit_S ( void  )

Initialize the MPU and the runtime environment.

◆ __attribute__()

__attribute__ ( (naked)  )

In the Cortex-M33 CPU core of this device, the secure vector address must be set to SYS_CM33_CFG2 before WarmReset is executed. Also, the non-secure vector address must be set to SYS_CM33_CFG3 before WarmReset is executed. The Cortex-M33's program works on the assumption that the appropriate vector address values have been set in SYS_CM33_CFG2 and SYS_CM33_CFG3 in the Cortex-A55 program.

Entry function when debugging RAM load using a debugger

◆ R_FSP_SystemClockHzGet()

uint32_t R_FSP_SystemClockHzGet ( fsp_priv_clock_t  clock)

Get the system clock frequency.

Parameters
[in]clockElement number of the array that defines the frequency of the bus clock.
Return values
g_clock_freq[clock]System clock frequency.

◆ R_BSP_ClockSelectorSet()

fsp_err_t R_BSP_ClockSelectorSet ( fsp_priv_clock_selector_t  selector,
uint32_t  clock_sel 
)

Set a clock selector.

Parameters
[in]selectorElement number of the array that defines the clock selector.
[in]clock_selValue to set in Mux Control register.
Return values
FSP_SUCCESSSelector configuration changes completed.
FSP_ERR_INVALID_ARGUMENTUndefined selector specified.
FSP_ERR_PLL_SRC_INACTIVEClock source PLL is reset state.
Note
This function assumes that a source clock is supplied. If the source clock is not supplied, the selector setting process cannot be completed successfully.

◆ R_BSP_ClockDividerSet()

fsp_err_t R_BSP_ClockDividerSet ( fsp_priv_clock_divider_t  divider,
uint32_t  clock_div 
)

Set a clock division ratio.

Parameters
[in]dividerElement number of the array that defines the clock divider.
[in]clock_divValue to set in Gear Control register.
Return values
FSP_SUCCESSDivider configuration changes completed.
FSP_ERR_INVALID_ARGUMENTUndefined divider specified.
FSP_ERR_PLL_SRC_INACTIVEClock source PLL is reset state.
Note
This function assumes that a source clock is supplied. If the source clock is not supplied, the divider setting process cannot be completed successfully.

◆ R_BSP_VersionGet()

fsp_err_t R_BSP_VersionGet ( fsp_version_t p_version)

Get the BSP version based on compile time macros.

Parameters
[out]p_versionMemory address to return version information to.
Return values
FSP_SUCCESSVersion information stored.
FSP_ERR_ASSERTIONThe parameter p_version is NULL.

◆ R_BSP_SoftwareDelay()

void R_BSP_SoftwareDelay ( uint32_t  delay,
bsp_delay_units_t  units 
)

Delay for at least the specified duration in units and return. This function shouldn't be used to generate an accurate delay time. A running time of the function is depending on the region of memory where the function is excuted on and a frequency of the CPU clock.

The funcion calls bsp_prv_software_delay_loop() which loops over the requested delay time. One loop time through bsp_prv_software_delay_loop() takes roughly 500ns. This value is based on the actual measured time in the condition that a frequency of the CPU clock is 200MHz and the code is excuted on DDR3L-1333 DRAM(133MHz). One loop running time of software_delay_loop() can be modified by redefining BSP_FEATURE_BSP_DELAY_LOOP_CYCLES.

Parameters
[in]delayThe number of 'units' to delay.
[in]unitsThe 'base' (bsp_delay_units_t) for the units specified. Valid values are: BSP_DELAY_UNITS_SECONDS, BSP_DELAY_UNITS_MILLISECONDS, BSP_DELAY_UNITS_MICROSECONDS.
For example:
One run through bsp_prv_software_delay_loop() takes roughly 500ns. A delay of 100 us therefore requires 100000ns/500ns -> 200 loops.

The 'theoretical' maximum delay that may be obtained is determined by a full 32 bit loop count and the system clock rate. @200MHz: ((0xFFFFFFFF loops * 500ns) = 2147 seconds.

Note that requests for very large delays will be affected by rounding in the calculations and the actual delay achieved may be slightly off of a setting time.

Note also that if the calculations result in a loop_cnt of zero, the bsp_prv_software_delay_loop() function is not called at all. In this case the requested delay is too small (nanoseconds) to be carried out by the loop itself, and the overhead associated with executing the code to just get to this point has certainly satisfied the requested delay.

Note
This function uses SystemCoreClock and therefore requires that the BSP has already initialized the variable (which it does as part of the SystemInit). Care should be taken to ensure this remains the case if in the future this function were to be called as part of the BSP initialization.

◆ R_BSP_GroupIrqWrite()

fsp_err_t R_BSP_GroupIrqWrite ( bsp_grp_irq_t  irq,
void(*)(bsp_grp_irq_t irq)  p_callback 
)

Register a callback function for supported interrupts. If NULL is passed for the callback argument then any previously registered callbacks are unregistered.

Parameters
[in]irqInterrupt for which to register a callback.
[in]p_callbackPointer to function to call when interrupt occurs.
Return values
FSP_ERR_UNSUPPORTEDNMI Group IRQ are not supported in this device.

◆ R_FSP_CurrentIrqGet()

__STATIC_INLINE IRQn_Type R_FSP_CurrentIrqGet ( void  )

Return active interrupt vector number value

Returns
Active interrupt vector number value

◆ R_BSP_UniqueIdGet()

__STATIC_INLINE bsp_unique_id_t const * R_BSP_UniqueIdGet ( )

Get unique ID is not supported in this device.

Returns
A pointer to the unique identifier structure

Variable Documentation

◆ SystemCoreClock [1/2]

uint32_t SystemCoreClock

System Clock Frequency (Core Clock)

◆ SystemCoreClock [2/2]

uint32_t SystemCoreClock

System Clock Frequency (Core Clock)

◆ g_bsp_version [1/2]

const fsp_version_t g_bsp_version

Default initialization function.

Version data structure used by error logger macro.

◆ g_bsp_version [2/2]

const fsp_version_t g_bsp_version

Default initialization function.

Version data structure used by error logger macro.