1.12.1. Setting Breakpoints in the my_uart_driver Device Driver
This section demonstrates the use of breakpoints to examine HAL device driver activity. Perform the following steps:
- After importing the hello_world_my_uart project, open the my_uart_init.c device driver source file, located in the hal_my_uart project, at the following directory:
- Place a breakpoint at the top of the function named my_uart_irq(), as shown in the figure below.
- Restart Tera Term if it is not already running.
- Create a debug configuration for hello_world_my_uart by following the steps 3 through 8 in Debugging the bit_bang_uart Project and substituting the hello_world_my_uart application for the bit_bang_uart application.
- Start debugging the hello_world_my_uart application. The processor pauses at the top of function main().
- Click the Resume button. The Nios II processor pauses at the my_uart_irq() invocation.
Figure 20. Setting a Breakpoint on my_uart_irq()
- Step up to and over the following assignment of the status register:
status = IORD_MY_UART_STATUS(base);
- In the Variables view, set the format of the status variable to hex. The status register now holds the value 0x60. This value indicates bits 5 and 6 are set. According to the my_uart_driver register description in drivers/inc/my_uart_regs.h, these two bits indicate transmit ready and transmit. The UART driver is in an interrupt context, ready to transmit the first character of the string "Hello from Nios II!".
- Continue stepping through the procedure. The my_uart_irq() function invokes my_uart_txirq() in response to a transmit interrupt.
Press Resume after each character is transmitted. Stop after the entire string “Hello from Nios II!” is transmitted.
- Remove the breakpoint.
After you pause the debugger in an ISR, the rest of the system is in an unknown state, because it could not respond to other interrupt requests while paused in the driver. Therefore, you need to start a new debugging session to perform further debugging.
Did you find the information on this page useful?