ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_nsc_log.c
Go to the documentation of this file.
1
17
18#include <stdint.h>
19
20#include "ra8_attributes.h"
21#include "ra8_check.h"
22#include "ra8_err.h"
23#include "ra8_log.h"
24#include "ra8_nsc.h"
25#include "ra8_nsc_veneer.h"
26
27static const char* s_tag = "NSCLOG";
28
40
60static void internal_safe_strcpy(char* dst, const char* src, uint32_t cap)
61{
62 uint32_t i = 0U;
63 for (i = 0U; i < (cap - 1U); ++i) {
64 const char c = src[i];
65 dst[i] = c;
66 if (c == '\0') {
67 return;
68 }
69 }
70 dst[cap - 1U] = '\0';
71}
72
94RA8_NSC_VENEER ra8_err_t ra8_nsc_log_emit(const char* tag, const char* message)
95{
96 RA8_CHECK_NULL_PTR(tag, s_tag, "log_emit: tag");
97 RA8_CHECK_NULL_PTR(message, s_tag, "log_emit: message");
98 /* Bound check the cap; cmse_check_address_range only validates
99 * the prefix we are about to copy. */
105 return k_ra8_ok;
106}
static const char * s_tag
Logging / check tag.
Definition ra8_app.c:17
Annotation-attribute framework macros for ra8-firmware.
#define RA8_NSC_VENEER
Mark a TrustZone Secure-to-Non-Secure entry-point veneer.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
Definition ra8_check.h:243
Error Code Definitions for ra8-firmware.
@ 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
Lightweight Logging Interface for ra8-firmware.
#define ra8_log_info(tag, message)
RA8 log info.
Definition ra8_log.h:364
Non-Secure Callable veneers – the only NS->S gateway.
@ k_ra8_nsc_log_msg_max_len
Truncated copy size for logs.
Definition ra8_nsc.h:410
static char s_tag_scratch[k_ra8_nsc_log_msg_max_len]
Secure scratch for the (tag, message) copy.
Definition ra8_nsc_log.c:38
static char s_msg_scratch[k_ra8_nsc_log_msg_max_len]
Definition ra8_nsc_log.c:39
ra8_err_t ra8_nsc_log_emit(const char *tag, const char *message)
NSC veneer: emit a log line from Non-Secure code.
Definition ra8_nsc_log.c:94
static void internal_safe_strcpy(char *dst, const char *src, uint32_t cap)
Length-bounded string copy with NUL terminator.
Definition ra8_nsc_log.c:60
Macros for declaring Non-Secure Callable veneer functions.
#define RA8_NSC_CHECK_NS_RANGE_R(ptr, len)
RA8 NSC CHECK NS RANGE r.