ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_infrastructure.c
Go to the documentation of this file.
1
22
23#include "ra8_infrastructure.h"
24
25#include <stdint.h>
26
27#include "ra8_attributes.h"
28#include "ra8_err.h"
29#include "ra8_log.h"
30#include "ra8_pin_validator.h"
31
32/* =============================================================================
33 * Stack canary sentinel
34 * =============================================================================
35 */
36
37#ifndef RA8_OFF_TARGET
38extern uint32_t g_ra8_ls_stack_canary_start[];
39extern uint32_t g_ra8_ls_stack_canary_end[];
40#endif
41
42typedef enum : uint32_t {
45
63{
64#ifndef RA8_OFF_TARGET
65 for (uint32_t* w = g_ra8_ls_stack_canary_start; w < g_ra8_ls_stack_canary_end; w++) {
66 *w = (uint32_t)k_ra8_stack_canary_pattern;
67 }
68#endif
69}
70
87{
88 /* Logging backend first so the rest of the init flow can emit. */
90
91 /* Clear pin-ownership bookkeeping. */
93
94 /* Seed the stack overflow sentinel. */
96
97 ra8_log_info("INFRA", "infrastructure ready");
98}
99
121{
122#ifndef RA8_OFF_TARGET
123 for (uint32_t* w = g_ra8_ls_stack_canary_start; w < g_ra8_ls_stack_canary_end; w++) {
124 if (*w != (uint32_t)k_ra8_stack_canary_pattern) {
126 }
127 }
128#endif
129 return k_ra8_ok;
130}
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Error Code Definitions for ra8-firmware.
@ k_ra8_err_validation_failed
Validation rule failed (caller-supplied invariant not satisfied).
Definition ra8_err.h:459
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
Definition ra8_err.h:119
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
uint32_t g_ra8_ls_stack_canary_end[]
ra8_err_t ra8_stack_canary_check(void)
Implementation of ra8_stack_canary_check() – sentinel check.
uint32_t g_ra8_ls_stack_canary_start[]
void ra8_infrastructure_init(void)
Implementation of ra8_infrastructure_init() – bring-up.
ra8_stack_canary_pattern_t
@ k_ra8_stack_canary_pattern
RA8 stack canary pattern.
static void internal_write_stack_canary(void)
Fill .stack_canary with the sentinel pattern.
Bring-up Helpers Called Before Any Driver Init.
Lightweight Logging Interface for ra8-firmware.
void ra8_log_init(void)
Initialise the logging backend.
Definition ra8_log.c:379
#define ra8_log_info(tag, message)
RA8 log info.
Definition ra8_log.h:364
Runtime Pin-Ownership Validator.
void ra8_pin_validator_reset(void)
Reset the validator (release every pin).