logging: log_output: Fix immediate output for big endian

Pointer to int was passed to a function which expected pointer to
uint8_t. There was an unexpected content for big endian as the
highest byte was read instead of the lowest which contained valid char.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2022-01-20 09:53:21 +01:00 committed by Carles Cufí
commit 157c48e4eb

View file

@ -105,7 +105,10 @@ static int out_func(int c, void *ctx)
if (IS_ENABLED(CONFIG_LOG_MODE_IMMEDIATE)) {
/* Backend must be thread safe in synchronous operation. */
out_ctx->func((uint8_t *)&c, 1, out_ctx->control_block->ctx);
/* Need that step for big endian */
char x = (char)c;
out_ctx->func((uint8_t *)&x, 1, out_ctx->control_block->ctx);
return 0;
}