Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Logging with char array

Environment details:

  • Board: Custom
  • Chip: nRF52840
  • PCA Number: PCA10056
  • SoftDevice: S140, v7.0.1
  • nRF5 SDK: Version 16.0.0
  • mdk version: 8.46.0
  • nrfjprog version: 10.15.4 external
  • JLinkARM.dll version: 7.64d

Issue:

I'd expect the following log lines to all result in the same thing, but only the first one works as expected, the others result in either no output or mangled output.

Do you have any suggestions? I'd like to be able to log dynamically created character arrays.

// works as expected
NRF_LOG_INFO("some string");

// viewable in debugger, doesn't print (or prints empty string)
static char s[] = "some string";
NRF_LOG_INFO(s);

// debugger displays 'Memory read failure', mangled string printed,
// switch debugger to display array and we see the correct value.
char s[] = "some string";
NRF_LOG_INFO(s);

For the 3rd case, This is what it looks like in the debugger initially:

And if I change it to be of type `array`:

Parents Reply Children
Related