This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Problem with nrf_log max argument(CLI + LOG with uart)

Hi there~

I'm working on nRF52840 DK board.

I want to change nrf_log max number of arguments.

After I finished the modification, and print log with more than 8 arguments(7 arguments is ok), a hardfault was occurred.

Here are the background infomations:

board: nRF52840 DK

SDK: 15.3.0

example code:

 - CLI example(SDK/examples/peripheral/cli)

code change:

 - add macro(LOG_INTERNAL_# in nrf_log_internal.h)

 - changed NRF_LOG_MAX_NUM_OF_ARGS from 6 to 10

 - add functions (nrf_log_frontend_std_# in nrf_log_frontend.c)

 - modified nrf_log_std_entry_process function(add case code when the arguments number is from 7 to 10)

Here is the debugging capture with SES

This is the code for printing log.

NRF_LOG_INFO("%d %d %d %d %d %d %d %d %d %d", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);

With the debug capture I found that the hardfault caused by the bad address of argument that passed by nrf_cli_process function.

And the address value is the 8th parameter value that used by NRF_LOG_INFO.

I tried to change the value of 8th parameter of NRF_LOG_INFO to other values(ex: 9), and the address of argument that passed by nrf_cli_process also changed(0x00000009).

Any advice will be nice~

Thanks~~!!

Related