lib: os: cbprintf: Extend API to support new packaging modes
Added new flags to packaging API: - CBPRINTF_PACKAGE_ADD_RO_STR_IDXS - when set, read-only string locations are appended to the package - CBPRINTF_PACKAGE_ADD_RW_STR_IDXS - when set, read-write string locations are appended to the package (instead of appending actual strings) - CBPRINTF_PACKAGE_FIRST_RO_STR_CNT(n) - indicate that n first strings are known to be read only. Ignored in runtime packaging. Add function for copying packages with optional appending strings. Changed CBPRINTF_MUST_RUNTIME_PACKAGE to use same flags as packaging. Aligned logging and test to those changes. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
parent
c31cb0075a
commit
c917e6c2ce
10 changed files with 532 additions and 158 deletions
|
@ -399,7 +399,7 @@ void z_log_vprintk(const char *fmt, va_list ap)
|
|||
|
||||
if (!IS_ENABLED(CONFIG_LOG1)) {
|
||||
z_log_msg2_runtime_vcreate(CONFIG_LOG_DOMAIN_ID, NULL,
|
||||
LOG_LEVEL_INTERNAL_RAW_STRING, NULL, 0,
|
||||
LOG_LEVEL_INTERNAL_RAW_STRING, NULL, 0, 0,
|
||||
fmt, ap);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ static inline void z_vrfy_z_log_msg2_static_create(const void *source,
|
|||
|
||||
void z_impl_z_log_msg2_runtime_vcreate(uint8_t domain_id, const void *source,
|
||||
uint8_t level, const void *data, size_t dlen,
|
||||
const char *fmt, va_list ap)
|
||||
uint32_t package_flags, const char *fmt, va_list ap)
|
||||
{
|
||||
int plen;
|
||||
|
||||
|
@ -62,8 +62,8 @@ void z_impl_z_log_msg2_runtime_vcreate(uint8_t domain_id, const void *source,
|
|||
va_list ap2;
|
||||
|
||||
va_copy(ap2, ap);
|
||||
plen = cbvprintf_package(NULL, Z_LOG_MSG2_ALIGN_OFFSET, 0,
|
||||
fmt, ap2);
|
||||
plen = cbvprintf_package(NULL, Z_LOG_MSG2_ALIGN_OFFSET,
|
||||
package_flags, fmt, ap2);
|
||||
__ASSERT_NO_MSG(plen >= 0);
|
||||
va_end(ap2);
|
||||
} else {
|
||||
|
@ -82,7 +82,7 @@ void z_impl_z_log_msg2_runtime_vcreate(uint8_t domain_id, const void *source,
|
|||
}
|
||||
|
||||
if (msg && fmt) {
|
||||
plen = cbvprintf_package(msg->data, (size_t)plen, 0, fmt, ap);
|
||||
plen = cbvprintf_package(msg->data, (size_t)plen, package_flags, fmt, ap);
|
||||
__ASSERT_NO_MSG(plen >= 0);
|
||||
}
|
||||
|
||||
|
@ -93,10 +93,10 @@ void z_impl_z_log_msg2_runtime_vcreate(uint8_t domain_id, const void *source,
|
|||
static inline void z_vrfy_z_log_msg2_runtime_vcreate(uint8_t domain_id,
|
||||
const void *source,
|
||||
uint8_t level, const void *data, size_t dlen,
|
||||
const char *fmt, va_list ap)
|
||||
uint32_t package_flags, const char *fmt, va_list ap)
|
||||
{
|
||||
return z_impl_z_log_msg2_runtime_vcreate(domain_id, source, level, data,
|
||||
dlen, fmt, ap);
|
||||
dlen, package_flags, fmt, ap);
|
||||
}
|
||||
#include <syscalls/z_log_msg2_runtime_vcreate_mrsh.c>
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue