logging: Reduce code size for frontend only case
Add early returns from functions which are not used when there is only one frontend in the system (no backends). This allows to significantly reduce logging code size in that configuration. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
parent
48a9334826
commit
3bcd14f420
2 changed files with 19 additions and 4 deletions
|
@ -197,6 +197,13 @@ void log_core_init(void)
|
|||
panic_mode = false;
|
||||
dropped_cnt = 0;
|
||||
|
||||
if (IS_ENABLED(CONFIG_LOG_FRONTEND)) {
|
||||
log_frontend_init();
|
||||
if (IS_ENABLED(CONFIG_LOG_FRONTEND_ONLY)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Set default timestamp. */
|
||||
if (sys_clock_hw_cycles_per_sec() > 1000000) {
|
||||
_timestamp_func = default_lf_get_timestamp;
|
||||
|
@ -215,10 +222,6 @@ void log_core_init(void)
|
|||
if (IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING)) {
|
||||
z_log_runtime_filters_init();
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_LOG_FRONTEND)) {
|
||||
log_frontend_init();
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t activate_foreach_backend(uint32_t mask)
|
||||
|
@ -245,6 +248,10 @@ static uint32_t z_log_init(bool blocking, bool can_sleep)
|
|||
{
|
||||
uint32_t mask = 0;
|
||||
|
||||
if (IS_ENABLED(CONFIG_LOG_FRONTEND_ONLY)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
__ASSERT_NO_MSG(log_backend_count_get() < LOG_FILTERS_NUM_OF_SLOTS);
|
||||
int i;
|
||||
|
||||
|
@ -341,6 +348,9 @@ void z_impl_log_panic(void)
|
|||
|
||||
if (IS_ENABLED(CONFIG_LOG_FRONTEND)) {
|
||||
log_frontend_panic();
|
||||
if (IS_ENABLED(CONFIG_LOG_FRONTEND_ONLY)) {
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < log_backend_count_get(); i++) {
|
||||
|
@ -357,6 +367,7 @@ void z_impl_log_panic(void)
|
|||
}
|
||||
}
|
||||
|
||||
out:
|
||||
panic_mode = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue