How do I disable printf() and LOGs when I am not running a TWI UART but am using a BLE nus emulated UART

I get these error when I disable the UART entries in sdk_config and comment out the uart_initialization in my code ...

.\_build\nRF52805_DevkitTimer_SenseV160.axf: Error: L6218E: Undefined symbol app_uart_get (referred from retarget.o).

.\_build\nRF52805_DevkitTimer_SenseV160.axf: Error: L6218E: Undefined symbol app_uart_put (referred from retarget.o).

I really just want the compiler to ignore all printf's and log entries but leave the USB-NUS-UART calls intact for a project that has no UART pins, only the Radio UART.

I got a clean compile by removing retarget.c from the library of files to compile...

But, now the code stops or  loops just after entering main. Screen shot of the debug traceback:

Eventually, several resets later it ends up in a HardFault_Handler loop.

After getting a clean compile... I was a getting high current wait state (infinite short loop) and saw gibberish in my putty terminal during debug (cannot paste the picture here) – it looks like a lot of foreign non-ascii (debug binary?) mixed in with text from my print statements. At least I can SingleStep thru the code, but I’m still nearly blind to what’s going on. Plus my device is never getting to sleep at in debug (as expected).

 The debugger ended up hung on this print statement down in nrf_log_frontend.c … 

printf("mainL: cmR %d cmE %d daR %d\n", cmd_req, cmd_end, data_ready);

The call stack repeats these two lines forever:

Nrf_lot_frontend_dequeue  0x001C8B4

Std_n

With an initial call to

app_error_fault_handler

at the bottom.

After a RST, it jumps to fputc on the stack again. I think it must be executing data or something else rather bad.

Related