|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Power-mode profiler smoke app for the EK-RA8D2. More...
#include <stdint.h>#include "ra8_board_ek_ra8d2.h"#include "ra8_boot_entry.h"#include "ra8_cgc.h"#include "ra8_err.h"#include "ra8_isr.h"#include "ra8_lpm.h"#include "ra8_mstp.h"#include "ra8_power_profile.h"#include "ra8_time.h"Go to the source code of this file.
Enumerations | |
| enum | pp_demo_const_t : uint32_t { k_pp_demo_baud = 115200U , k_pp_demo_period_ms = 1000U , k_pp_demo_busy_iters = 100000U , k_pp_demo_us_per_ms = 1000U } |
| App-wide tunables. More... | |
| enum | pp_demo_byte_t : uint8_t { k_pp_demo_ascii_zero = '0' , k_pp_demo_dec_base = 10U , k_pp_demo_uint_dec_max = 10U , k_pp_demo_print_buf = 96U } |
| Single-byte ASCII conversion constants. More... | |
Functions | |
| static void | pp_demo_panic_halt (void) |
| Park forever after a fatal init failure. | |
| static uint64_t | pp_demo_now_us (void *ctx) |
| Time-base hook for the profiler – wraps ra8_time_ms to us. | |
| static void | pp_demo_clocks_or_halt (void) |
| Bring CGC + SysTick + MSTP + UART console up. | |
| static void | pp_demo_modules_or_halt (void) |
| Bring LPM + power profiler + LEDs up; panic-halts on fail. | |
| static void | pp_demo_setup_or_halt (void) |
| static bool | pp_demo_cycle_modes (void) |
| Cycle through ACTIVE -> SLEEP -> DEEP_SLEEP -> SOFTWARE_STANDBY, marking entry/exit on each. | |
| static uint8_t | pp_demo_uint_to_dec (uint8_t *buf, uint64_t v) |
| Write a decimal uint64 (low 32 bits) into buf. | |
| static uint32_t | pp_demo_append (uint8_t *buf, uint32_t off, const char *tag, uint64_t val) |
Append tag then the decimal of val to buf at off. | |
| static uint32_t | pp_demo_format_line (uint8_t *out, const ra8_power_profile_stats_t *stats) |
Format the per-cycle stats line into out. | |
| void | main (void) |
| Application entry. | |
Variables | |
| static const uint8_t | k_pp_demo_pass_msg [] = "pp: profile OK\r\n" |
| Success verdict line emitted only when a full mode cycle and the stats read both returned k_ra8_ok (never on a "pp: FAIL" path); this is the success-only string the HIL scrape keys on. | |
Power-mode profiler smoke app for the EK-RA8D2.
Standalone EVM-tier app that drives the libs/ra8_power_profile/inc/ra8_power_profile.h accumulator across the four interesting RA8D2 low-power modes – ACTIVE, SLEEP, DEEP_SLEEP, and SOFTWARE_STANDBY – and reports the dwell time of each region over SCI8.
Each cycle:
LED1 toggles per cycle. LED2 latches on if any HAL call hard-fails.
Bare EK-RA8D2 only – no extra pins required. The profiler hooks into ra8_time_ms for the timestamp source so accumulation works on the host test build under RA8_OFF_TARGET as well.
Definition in file main.c.
| enum pp_demo_byte_t : uint8_t |
| enum pp_demo_const_t : uint32_t |
| void main | ( | void | ) |
Application entry.
The application entry point Reset_Handler hands control to.
Profiles power modes once a second.
Definition at line 313 of file main.c.
References k_pp_demo_pass_msg, k_pp_demo_period_ms, k_pp_demo_print_buf, k_ra8_board_led1, k_ra8_board_led2, k_ra8_ok, pp_demo_cycle_modes(), pp_demo_format_line(), pp_demo_panic_halt(), pp_demo_setup_or_halt(), ra8_board_led_on(), ra8_board_led_toggle(), ra8_board_uart_console_write(), ra8_delay_ms(), ra8_isr_globals_enable(), and ra8_power_profile_get_stats().
|
static |
Append tag then the decimal of val to buf at off.
| [in,out] | buf | Destination buffer. |
| [in] | off | Current offset (updated in-place). |
| [in] | tag | NUL-terminated label. |
| [in] | val | 64-bit decimal value to append. |
Definition at line 255 of file main.c.
References pp_demo_uint_to_dec().
Referenced by pp_demo_format_line().
|
static |
Bring CGC + SysTick + MSTP + UART console up.
Definition at line 106 of file main.c.
References k_pp_demo_baud, k_ra8_clock_id_cpuclk0, k_ra8_ok, pp_demo_panic_halt(), ra8_board_uart_console_init(), ra8_cgc_get_clock_hz(), ra8_cgc_init(), ra8_mstp_init(), and ra8_time_init().
Referenced by pp_demo_setup_or_halt().
|
static |
Cycle through ACTIVE -> SLEEP -> DEEP_SLEEP -> SOFTWARE_STANDBY, marking entry/exit on each.
Each region is "open" for at least one millisecond so the profiler accumulator records a measurable delta. SOFTWARE_STANDBY is the deepest mode safely entered from this demo because deep- standby resets the CPU and would not return into this loop.
Definition at line 179 of file main.c.
References k_pp_demo_busy_iters, k_ra8_ok, k_ra8_power_profile_region_active, k_ra8_power_profile_region_sleep, k_ra8_sleep_mode_sleep, ra8_lpm_enter_sleep(), ra8_power_profile_mark_enter(), and ra8_power_profile_mark_exit().
Referenced by main().
|
static |
Format the per-cycle stats line into out.
| [out] | out | Destination buffer (>= k_pp_demo_print_buf bytes). |
| [in] | stats | Stats snapshot. |
Definition at line 278 of file main.c.
References k_ra8_power_profile_region_active, k_ra8_power_profile_region_deep_standby, k_ra8_power_profile_region_sleep, k_ra8_power_profile_region_software_standby, pp_demo_append(), ra8_power_profile_stats_t::regions, and ra8_power_profile_region_stats_t::total_time_us.
Referenced by main().
|
static |
Bring LPM + power profiler + LEDs up; panic-halts on fail.
Definition at line 127 of file main.c.
References k_ra8_board_led1, k_ra8_board_led2, k_ra8_lpm_dcssmode_128us, k_ra8_lpm_ss2lp_default, k_ra8_ok, pp_demo_now_us(), pp_demo_panic_halt(), ra8_board_led_init(), ra8_lpm_init(), and ra8_power_profile_init().
Referenced by pp_demo_setup_or_halt().
|
static |
Time-base hook for the profiler – wraps ra8_time_ms to us.
| [in] | ctx | Unused. |
Definition at line 99 of file main.c.
References k_pp_demo_us_per_ms, and ra8_time_ms().
Referenced by pp_demo_modules_or_halt().
|
static |
Park forever after a fatal init failure.
Definition at line 82 of file main.c.
Referenced by main(), pp_demo_clocks_or_halt(), and pp_demo_modules_or_halt().
|
static |
Definition at line 156 of file main.c.
References pp_demo_clocks_or_halt(), and pp_demo_modules_or_halt().
Referenced by main().
|
static |
Write a decimal uint64 (low 32 bits) into buf.
| [out] | buf | Destination (must hold at least 10 chars). |
| [in] | v | Value to render. |
Definition at line 221 of file main.c.
References k_pp_demo_ascii_zero, k_pp_demo_dec_base, and k_pp_demo_uint_dec_max.
Referenced by pp_demo_append().
|
static |