/
Embedded Development Tools Embedded Development Tools

Embedded Development Tools - PowerPoint Presentation

priscilla
priscilla . @priscilla
Follow
66 views
Uploaded On 2023-11-09

Embedded Development Tools - PPT Presentation

Realtime Debug What is Realtime Debug Stop Mode Debug traditional debugging require the processor to be completely halted to access memory and registers stops all threads and prevents interrupts from being handled ID: 1030803

real time mode debug time real debug mode view debugger memory critical target run interrupt processor button program project

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Embedded Development Tools" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

1. Embedded Development ToolsReal-time Debug

2. What is Real-time Debug?Stop Mode Debug (traditional debugging)require the processor to be completely halted to access memory and registers stops all threads and prevents interrupts from being handledStop Mode can be used as long as system/application does not have real-time constraints, but is very undesirable for real-time applicationsReal-time Mode Debug enables programmers to:examine and modify contents of memory/register locations while CPU is running and executing codehalt/debug application while allowing user specified time critical interrupts to be serviced without interferenceReal-time debug capabilities vary by device and are supported via different methods

3. Real-time Debug capabilitiesAccess to memory while the processor is running Supported on Tiva, Stellaris, Hercules, C28x, C66x, C64x, C55xOn ARM it is enabled through the DAP (Debug Access Port) DAP is part of the ARM emulation logic and enables the debugger to access memory of the device without requiring the processor to enter the debug state On DSP/28x it is enabled via ICEMaker hardwareAlso possible on Cortex A devices but is not recommended when the MMU is in use (will always show physical memory and not virtual)Access to registers while the processor is running Supported on C28x, C66x, C64x, C55xEnabled through hardware (ICEMaker)Service interrupts while the processor is halted Supported on C28x, C66x, C64x, C55xEnabled through hardware (ICEMaker)

4. Real-time Mode: Polite and RudeMemory accesses and halts issued from the debugger can be blockedFor example, when in a critical section of code setting the DBGM (Debug Mask) bit in status/control register will block accessesHardware or application can set DBGM bitIn some devices hardware sets it automatically when any interrupt is takenIn Polite real-time mode (default when real-time mode is enabled)DBGM settings are respected by debugger Debugger will not stall the processor to make memory accesses, but rather will wait for processor to get into non-critical section of code before making the accessIn Rude real-time modeDBGM settings are ignored by debugger and accesses are made anywayAllows for error recovery if application sets these bits and then hangs

5. Real-time InterruptsWhen halted in Stop mode, all interrupts are blockedWhen halted in Real-time mode, time critical interrupts can continue to be servicedThe Debug Interrupt Enable Register (DBGIER on C28x) is used to designate time-critical interruptsInterrupts which are enabled by both IER and DBGIER will be serviced when halted in real-time mode, regardless of global interrupt mask bit (INTM on C28x)

6. Viewing Real-time accesses with CCSTo enable/view real-time access to memory and registers, click on Continuous Refresh in Memory Browser and Registers view in CCSContinuous Refresh will periodically refresh the debug viewsDefault refresh interval is 500 msDefault refresh interval is configurable

7. Using Real-time mode with CCSTo enable real-time mode, click on Enable Silicon Real-time Mode iconOr from CCS menu Run->Debug Configurations->Target tabWhen enabled:The debugger will respect the DBGM bit and will not stall the processor to make the memory accessesTime-critical interrupts can continue to be serviced while target is haltedIf enabled prior to launching the debugger, will allow connecting to running device

8. Using Real-time mode with CCSWhen real-time mode is enabled, it defaults to Polite real-time modeIn Polite mode, debugger will prevent the target from being halted while application is servicing a time-critical interruptIf a debugger access requires target to be halted when servicing a time-critical interrupt, user will be asked whether Rude real-time mode should be enabledIn Rude mode, halt requests are serviced immediately, regardless of whether the processor is executing a time-critical ISR

9. LABS

10. LAB RequirementsSoftware:Code Composer Studio v6.1.0.00104Download from http://processors.wiki.ti.com/index.php/Download_CCS and install to c:\ticontrolSUITEDownload from http://www.ti.com/tool/controlsuite and install to c:\tiHardwareF28027 LaunchPad Connected to PC using USB cableOther F28x hardware such as experimenter kits or Launchpads could also be used as long as the appropriate example project for that device exists in controlSUITE

11. LAB ConventionsBefore starting, it is important to review some lab conventions that will ease your work…Lab steps are in black and numbered for easier reference……Explanations, notes, warnings are written in blueWarnings are shown with Information is marked with Tips and answers are marked with Questions are marked with

12. LAB 1: Real-time access and real-time mode30 MINUTESOpen CCS and select a workspace (the default is fine)You can close the TI Resource Explorer View (it will not be used)

13. LAB 1: Real-time access and real-time mode on F28xObjectivesDemonstrate how to access/modify memory and registers in real time when processor is runningEnable real-time mode in Code Composer Studio Set up interrupts in code so they can continue to run when debugger is haltedStep through code while time critical interrupts continue to be servicedTools and Concepts CoveredReal-time access to memory and registersReal-time mode and real-time interrupts

14. Importing Example ProjectsGo to menu Project  Import Existing CCS Eclipse ProjectClick the Browse button and go toC:\ti\controlSUITE\development_kits\C2000_LaunchPad\f2802x_examples\epwm_real-time_interruptsSelect the project “Example_F2802xEPwmRealTimeInt”Ensure the “Copy projects into workspace” is selectedClick Finish

15. Reviewing codeIn Project Explorer view, expand the project Example_F2802xEPwmRealTimeInt Open the source file Example_2802xEPwmRealTimeInt.c Observe the following:The program configures ePWM1 timer and increments a counter each time interrupt is takenLED2 is toggled in the main routine and LED3 is toggled in the interrupt service routine epwm1_timer_isrFREE_SOFT bits in EPwm1Regs and DBGIER.INT3 bit are initially cleared. These bits must be set to designate ePWM1 interrupt as time critical and operational in real time mode after halt command. During the lab, these bits will be set through the Expressions view in CCS when processor is halted to see how real-time interrupts work

16. Important VariablesWhile running the labs, the following variables are of interest. Observe how they change while the program is running and halted:EPwm1TimerIntCount - counts the number of times the ISR for PWM1 is servicedePWM1.TBCTR - register containing the counter for PWM1 – observe that it will stop with an emulation halt unless FREE_SOFT bits are setePWM1.TBCTL – Bits 14 and 15 (FREE_SOFT bits) establish how the counter for the PWM reacts to an emulation halt command. The default 00 in these bits will stop the counter when a halt command is received. A 10 or 11 will allow the counter to run freely after the halt command is receivedDBGIER.INT3 - Debug Interrupt Enable Register bit that is used to designate whether the corresponding interrupt is time critical. Setting this bit will designate the PWM interrupt to be time critical and operate as real-time interrupt

17. Build the Example ProjectGo to the Project Explorer viewRight-click on Example_F2802xEPwmRealTimeInt and select “Build Project”

18. Create a Target Configuration FileRight-click on the project and go to File  New  Target Configuration FileSpecify f28027lp as the name and click Finish In the “Connection” field, select Texas Instruments XDS100v2 USB Debug ProbeIn the “Board or Device” filter field, type F28027Select TMS320F28027Click Save

19. Launch the DebuggerClick on the debug button (green bug icon) to debug the projectThis will build the project (if required), launch the debugger, flash the program onto the device and run to main()Add these variables to the Expressions view:EPwm1TimerIntCount ePWM1.TBCTR ePWM1.TBCTLDBGIER.INT3

20. Setup Continuous RefreshOpen the Memory Browser and enter &EPwm1TimerIntCount in the address field to view the address of that variable Arrange the views such that the Expressions, Memory Browser and Registers views are all visible at onceIn Registers view, expand the ePWM1 registerEnable Continuous Refreshon all three views

21. Run the programClick Resume to run the programThe LEDs on the board should be blinking, LED2 (toggled in main routine) and LED3 (toggled in ISR routine). LED2 appears to stay on continuously but is actually just blinking at a very high speed. The Expressions, Memory Browser and Registers view update in real-time while the processor is runningHalt the core by clicking the Suspend buttonThe LEDs on the board should stop blinking and the views stop updating

22. Enable Real-time ModeEnable real-time mode in CCS by clicking the button shown here:Click Resume to run the coreIn the Expressions view, set ePWM1.TBCTL to 0x8090 to set FREE_SOFT bit to 2, which will enable free run mode on the counterSetting this bit allows the timer to continue to increment even when the core is haltedClick the Suspend button to halt the coreNotice that ePWM1.TBCTR keeps changing in the Expressions view even when the target is halted as it is set to free runHowever note that the interrupt is not being serviced (EPwm1TimerIntCount is not incrementing and LED3 has stopped blinking) as it has not been designated as a real-time interrupt

23. Real-time InterruptsIn the Expressions view, set DBGIER.INT3 to be 1 to designate PWM1 as a real-time interruptNotice that EPwm1TimerIntCount now continues to increment even though target is halted. Similarly notice that LED3 which is toggled within ISR has resumed toggling while LED2 which is toggled within main routine remains stoppedClick the Step Into button several times to single-step through the code Notice that LED2 toggles on and off as you step through the main routine while LED3 continues to blinkThese steps demonstrate that, in real-time mode, the PWM1 interrupt that we designated as time critical is continuing to be serviced even when the core is haltedClick the Terminate button in the Debug View to close the debug session

24. LAB 2: CONNECT to running program15 MINUTESOpen CCS and select a workspace (the default is fine)You can close the TI Resource Explorer View (it will not be used)

25. LAB 2: Connect to running programObjectivesConnect to a program already flashed and running on target without resetting the device Tools and Concepts CoveredDebug properties and Real-time mode

26. Change build configuration of ProjectIn Project Explorer view, right-click on Example_F2802xEPwmRealTimeInt, go to Build Configurations->Set Active and select FlashThis will change the build configuration to the Flash version

27. Launch the Debugger (default settings)Click on the Debug button (green bug icon) to debug the projectThis will build the project (if required), launch the debugger, flash the program onto the device and run to main()Click Resume in the Debug view to run the programVerify that LED2 and LED3 are blinking as expected. Note that LED2 may look like it is continuously on but is actually just blinking at a very high speed. Click the Terminate button in the Debug View to close the debug sessionUnplug and re-plug the USB cable to power cycle the board so the program starts running from Flash

28. Modify the Debug settingsGo to menu Run->Debug Configurations and select Example_F2802xEPwnRealTimeInt in the left paneGo to Program tab and select Load Symbols OnlyThis will load just the symbols for the program rather than reflashing the whole program every time the debugger is launchedGo to Target tab->Auto Run and Launch Options and check the box for Enable realtime modeClick Apply and Close

29. Launch the DebuggerClick on the Debug button (green bug icon) to debug the projectThis will build the project (if required), launch the debugger, connect to the device, load symbols in this case, and halt the target at the current point of executionClick Resume in the Debug view to continue running the program from that pointVerify that LED2 and LED3 are blinking as expected Click the Terminate button in the Debug View to close the debug session

30. Modify the Debug settingsGo to menu Run->Debug Configurations and select Example_F2802xEPwnRealTimeInt in the left paneGo to Target tab->Program/Memory Load Options and uncheck the box for Halt the target on a connectClick Apply and Close

31. Launch the DebuggerClick on the Debug button (green bug icon) to debug the projectThis will build the project (if required), launch the debugger, connect to the device, load symbols in this case, and leave the target runningObserve the LEDs blinking and variables changing in the Expressions view (if Continuous Refresh icon is enabled) to confirm program is runningClick the Suspend button in the Debug view to halt the core and perform other debugging actions, as requiredClick the Terminate button in the Debug view to close the debug session

32. SummaryAfter completing these labs you should now be familiar with:Accessing memory and registers in real time while the processor is runningEnabling real-time mode in Code Composer Studio Setting up interrupts so they can continue to run when the debugger has halted the processorStepping through code while time critical interrupts continue to be servicedUsing real-time mode to connect to a program already flashed and running on target