99inline int format_banner(
char* buf,
size_t size,
const char* app_name, uint32_t sample_rate, uint16_t block_size) {
109 if (size == 0 || buf ==
nullptr) {
114 const char* sep =
"======================================\r\n";
116 p = detail::banner_append(buf, size, p, sep);
119 p = detail::banner_append(buf, size, p,
" ");
120 p = detail::banner_append(buf, size, p, app_name);
121#if SBL_BANNER_HAS_VERSION
122 p = detail::banner_append(buf, size, p,
" (sbl ");
123 p = detail::banner_append(buf, size, p, sbl::version::string);
124 p = detail::banner_append(buf, size, p,
")");
126 p = detail::banner_append(buf, size, p,
"\r\n");
129 p = detail::banner_append(buf, size, p,
" Built: ");
130 p = detail::banner_append(buf, size, p, __DATE__);
131 p = detail::banner_append(buf, size, p,
" ");
132 p = detail::banner_append(buf, size, p, __TIME__);
133 p = detail::banner_append(buf, size, p,
"\r\n");
136#if SBL_BANNER_HAS_MCU
137 p = detail::banner_append(buf, size, p,
" MCU: ");
138 p = detail::banner_append(buf, size, p, sbl::hw::mcu::name);
139#if SBL_BANNER_HAS_TARGET
140 p = detail::banner_append(buf, size, p,
" @ ");
141 p = detail::banner_append_uint(buf, size, p, sbl::hw::target::sysclk_mhz);
142 p = detail::banner_append(buf, size, p,
" MHz");
144 p = detail::banner_append(buf, size, p,
"\r\n");
148 p = detail::banner_append(buf, size, p,
" Audio: ");
149 p = detail::banner_append_uint(buf, size, p, sample_rate);
150 p = detail::banner_append(buf, size, p,
" Hz / ");
151 p = detail::banner_append_uint(buf, size, p, block_size);
152 p = detail::banner_append(buf, size, p,
" frames\r\n");
155#ifdef SBL_PROFILING_ENABLED
156 p = detail::banner_append(buf, size, p,
" Profiling: enabled\r\n");
160#if SBL_BANNER_HAS_VERSION
161 p = detail::banner_append(buf, size, p,
" Git: ");
162 p = detail::banner_append(buf, size, p, sbl::version::git_hash);
163 if (sbl::version::git_dirty) {
164 p = detail::banner_append(buf, size, p,
"-dirty");
166 p = detail::banner_append(buf, size, p,
"\r\n");
169 p = detail::banner_append(buf, size, p, sep);
171 buf[
static_cast<size_t>(p) < size ? p : size - 1] =
'\0';