COrnell Miniature ATmel Operating System (COMATOS)

Assembly Version UART Facilities

COMATOS includes some debugging features, which can be made available by passing the DEBUG flag to OSInit. Upon being passed this flag, OSInit initializes the UART to 9600bps.

Register Dumping with OSRegDump

It is often useful to view the state of the registers when debugging real-time systems. The OSRegDump call sends all 32 registers to the UART. The output can be read through the DinkyBug utility. Be aware that this is a blocking call. That is, no scheduling or task execution occurs while the registers are being dumped. Since a call to OSRegDump is made inside a task, the time spent dumping the registers counts in the OS timeout limit. If the timeout value is less than 28 ms per call to OSRegDump, the system will halt during the task. Be sure to set the timeout value appropriately when initializing the OS using OSInit.

UART String Output

UART string output can be performed easily using the OSUARTWait call, which transfers a string from the SRAM to the UART. Because this function was designed to send anything from text output to register dumps, it does not use a flag character to denote the end of the string. Instead, the user must place the number characters to be printed is stored in a special memory location, OSUARTCharCnt. The call itself takes as its only argument a register containing the first character to print. The Z pointer must be aimed at the subsequent characters to print. For an example, see the description of OSUARTWait in the API.

Please be aware that this call is blocking. The actual function is a wait loop which continues until the UART transmit empty ISR sets the txdone bit in OSStatus. Because this call is blocking, any time spent sending a string to the UART is timed by the OS timeout timer. If the value of OSMaxTimout, as set by OSInit, is shorter than the time taken to transmit the string, the system will halt.