I have made a bare metal app using gcc on Linux for the nRF5340 Audio DK. I'm able to start the segger gdb server, load the code, set a breakpoint, run and watch the LED's flash as expected.
However, I don't observe any printf/stdout output from the app. The problem is I don't know where to expect the output using the default configuration?
This is the code:
#include "nrfx.h"
#include <stdio.h>
int main()
{
printf("Hello devkit\n");
// then the NRF_P1->DIRSET etc which seem to be working
...
The compiler/linker does not complain so there is some printf support even though I don't know if any uart initialization or other code is required to support it?
When I plug in the board four /dev/tty devices are being created. I don't observe the printf output on any of these or in gdb.
nrfutil device list --traits seggerUsb returns:
ports /dev/ttyACM0, vcom: 0
/dev/ttyACM1, vcom: 1
/dev/ttyUSB5, vcom: 1
/dev/ttyUSB4, vcom: 2
traits jlink, seggerUsb, serialPorts, usb
Using these parameters:
set line /dev/ttyXXXX
set speed 115200
set carrier-watch off
set flow-control none
Where XXXX is one of the four ports given by nrfutil device list above.
There are two UART ports on the board itself. I have not checked these. Can I expect to observe the printf/stdout if I connect any of these?
I don't get any output in gdb, nor at the tcp/ip port given by the gdb server
SEGGER J-Link GDB Server V7.92e Command Line Version
JLinkARM.dll V7.92e (DLL compiled Sep 13 2023 15:44:25)
Command line: -nogui -nosilent -port 2131 -if swd -device NRF5340_XXAA_APP
-----GDB Server start settings-----
GDBInit file: none
GDB Server Listening port: 2131
SWO raw output listening port: 2332
Terminal I/O port: 2333
Accept remote connection: yes
Generate logfile: off
Verify download: off
Init regs on start: off
Silent mode: off
Single run mode: off
Target connection timeout: 0 ms
------J-Link related settings------
J-Link Host interface: USB
J-Link script: none
J-Link settings file: none
------Target related settings------
Target device: NRF5340_XXAA_APP
Target device parameters: none
Target interface: SWD
Target interface speed: 4000kHz
Target endian: little
Connecting to J-Link...
J-Link is connected.
Firmware: J-Link OB-nRF5340-NordicSemi compiled Aug 8 2023 16:16:56
Hardware: V1.00
S/N: 1050169338
Feature(s): RDI, FlashBP, FlashDL, JFlash, GDB
Checking target voltage...
Target voltage: 3.30 V
Listening on TCP/IP port 2131
Connecting to target...
Halting core...
Core security extensions: Implemented
Connected to target
Waiting for GDB connection...
$ nc localhost 2333
SEGGER J-Link GDB Server V7.92e - Terminal output channel
Then nothing here either. Where would I expect to observe the printf/stdout?
Will JLinkRTTLogger be able to capture the stdout, if yes how can this be done for the nRF5340 Audio DK?