Lab 5: System Initialization
C2000 Microcontroller Workshop - System Initialization 5 - 23
9. Click the “Debug” button (green bug). The “CCS Debug Perspective” view should
open, the program will load automatically, and you should now be at the start of
main().
10. After CCS loaded the program in the previous step, it set the program counter (PC) to
point to _c_int00. It then ran through the C-environment initialization routine in the
rts2800_fpu32.lib and stopped at the start of main(). CCS did not do a device
reset, and as a result the bootloader was bypassed.
In the remaining parts of this lab exercise, the device will be undergoing a reset due to the
watchdog timer. Therefore, we must configure the device by loading values into
EMU_KEY and EMU BMODE so the bootloader will jump to “M0 SARAM” at address
0x000000. Set the bootloader mode using the menu bar by clicking:
Scripts EMU Boot Mode Select EMU_BOOT_SARAM
If the device is power cycled between lab exercises, or within a lab exercise, be sure to
re-configure the boot mode to EMU_BOOT_SARAM.
Run the Code – Watchdog Reset
11. Place the cursor in the “main loop” section (on the asm(“ NOP”); instruction line)
and right click the mouse key and select Run To Line. This is the same as setting a
breakpoint on the selected line, running to that breakpoint, and then removing the
breakpoint.
12. Place the cursor on the first line of code in main() and set a breakpoint by double
clicking in the line number field to the left of the code line. Notice that line is
highlighted with a blue dot indicating that the breakpoint has been set. (Alternately, you
can set a breakpoint on the line by right-clicking the mouse and selecting Breakpoint
(Code Composer Studio) Breakpoint). The breakpoint is set to prove
that the watchdog is disabled. If the watchdog causes a reset, code execution will stop at
this breakpoint.
13. Run your code for a few seconds by using the “Resume” button on the toolbar, or by
using Run Resume on the menu bar (or F8 key). After a few seconds halt your
code by using the “Suspend” button on the toolbar, or by using Run Suspend on
the menu bar (or Alt-F8 key). Where did your code stop? Are the results as expected? If
things went as expected, your code should be in the “main loop”.
14. Switch to the “CCS Edit Perspective” view by clicking the CCS Edit icon in the upper
right-hand corner. Modify the InitWatchdog() function to enable the watchdog
(WDCR). This will enable the watchdog to function and cause a reset. Save the file.
15. Click the “Build” button. Select Yes to “Reload the program automatically”. Switch
back to the “CCS Debug Perspective” view by clicking the CCS Debug icon in the
upper right-hand corner.
16. Like before, place the cursor in the “main loop” section (on the asm(“ NOP”);
instruction line) and right click the mouse key and select Run To Line.
17. Run your code. Where did your code stop? Are the results as expected? If things went
as expected, your code should have stopped at the breakpoint. What happened is as