The ADuCM4050 ultra low power microcontroller, supports several debug features including a full flash patch and breakpoint (FPB) unit with up to six hardware breakpoints. It also supports Instruction Trace Module (ITM), with trace supported over a single wire viewer (SWV) port. For more details on trace - refer to the IAR EWARM user guide at this link.
The SWV functionality can be multiplexed on to GPIO P1_09 (in which case, the pin is also referred to as 'SWV' or 'SWO'). This feature is available in both LFCSP and WLCSP packages of ADuCM4050. The following is a short guide for setting up SWV functionality on the EV-COG-AD4050 development board for ADuCM4050.
1. Modify solder jumper JP16 (on the primary side of the board, near the JLINK-9 connector) to positions 2&3. See the snapshot below for reference on the location of JP16.
2. The EV-COG-AD4050 has an on-board CMSIS-DAP interface for debugging, however this interface does not support SWV functionality at the moment. In the future, a firmware upgrade for the CMSIS-DAP controller could enable this functionality, but for now - an external debugger such as a Segger JLink-Lite debugger for Arm, would be required. Power the board using USB, and connect the external debugger using the JLINK-9 connector on the primary side of the board. See the snapshot below for reference.
3. In IAR, select the type of external debugger used in the Debugger settings window, see snapshot below for reference.
4. In IAR, select the 'via SWO' option in the Library Configuration settings window, see snapshot below for reference.
5. Next - setup the SWO configuration options in IAR by clicking on the JLINK/SWO Trace options window - refer the snapshot below, wherein steps (a) to (e) provide guidance on recommended sequence of settings. For more details on the SWO Trace configuration options, refer to the IAR user guide. In step (d) - we force certain information to be transmitted out over the trace, for example the PC (program counter). Note, that the PC could be sampled at a slower rate than the actual core clock frequency at which instructions get executed. The sampled PC information could still be very useful for debug. The key channel 0 selected in step (e) ensures that strings printed using 'printf' statements in the source code, get pushed out over trace (SWO pin) as well.
6. Next, in your main function, ensure that the GPIO P1_09 is configured appropriately to mux out the SWV functionality on the pin. A quick way of achieving this is to add the following line of code in your initialization sequence.
*pREG_GPIO1_CFG |= ((uint32_t) 3<<18);
7. And now - you should be ready to start using Trace! Try adding a printf statement similar to the one below in your source code and you should see the same printed in the IAR TerminalIO windown in debug mode. The SWO Trace window will show more detailed information on every trace packet received, including PC information that was enabled in Step 5(d) above.
printf ("Hello World with SWO \r\n");