Presentation is loading. Please wait.

Presentation is loading. Please wait.

Embedded Development Tools

Similar presentations


Presentation on theme: "Embedded Development Tools"— Presentation transcript:

1 Embedded Development Tools
Real-time Debug Embedded Development Tools

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 handled Stop Mode can be used as long as system/application does not have real-time constraints, but is very undesirable for real-time applications Real-time Mode Debug enables programmers to: examine and modify contents of memory/register locations while CPU is running and executing code halt/debug application while allowing user specified time critical interrupts to be serviced without interference Real-time debug capabilities vary by device and are supported via different methods 2

3 Real-time Debug capabilities
Access to memory while the processor is running Supported on Tiva, Stellaris, Hercules, C28x, C66x, C64x, C55x On 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 hardware Also 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, C55x Enabled through hardware (ICEMaker) Service interrupts while the processor is halted It’s not tightly integrated for Cortex A devices because it’s a direct access to system memory, and may not be what a traditional memory access would show.  So, if the MMU is on, the DAP access will show physical memory, but a core access while halted will show virtual memory.  The M3 doesn’t have an MMU, so it’s tightly integrated.  (There are plans to have the DAP access tightly integrated, but as a physical memory access). 3

4 Real-time Mode: Polite and Rude
Memory accesses and halts issued from the debugger can be blocked For example, when in a critical section of code setting the DBGM (Debug Mask) bit in status/control register will block accesses Hardware or application can set DBGM bit In some devices hardware sets it automatically when any interrupt is taken In 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 access In Rude real-time mode DBGM settings are ignored by debugger and accesses are made anyway Allows for error recovery if application sets these bits and then hangs 4

5 Real-time Interrupts When halted in Stop mode, all interrupts are blocked When halted in Real-time mode, time critical interrupts can continue to be serviced The Debug Interrupt Enable Register (DBGIER on C28x) is used to designate time-critical interrupts Interrupts 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) 5

6 Viewing Real-time accesses with CCS
To enable/view real-time access to memory and registers, click on Continuous Refresh in Memory Browser and Registers view in CCS Continuous Refresh will periodically refresh the debug views Default refresh interval is 500 ms Default refresh interval is configurable 6

7 Using Real-time mode with CCS
To enable real-time mode, click on Enable Silicon Real-time Mode icon Or from CCS menu Run->Debug Configurations->Target tab When enabled: The debugger will respect the DBGM bit and will not stall the processor to make the memory accesses Time-critical interrupts can continue to be serviced while target is halted If enabled prior to launching the debugger, will allow connecting to running device 7

8 Using Real-time mode with CCS
When real-time mode is enabled, it defaults to Polite real-time mode In Polite mode, debugger will prevent the target from being halted while application is servicing a time-critical interrupt If 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 enabled In Rude mode, halt requests are serviced immediately, regardless of whether the processor is executing a time-critical ISR 8

9 LABS

10 LAB Requirements Software: Hardware
Code Composer Studio v Download from and install to c:\ti controlSUITE Download from and install to c:\ti Hardware F28027 LaunchPad Connected to PC using USB cable Other 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 Conventions Before 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 blue Warnings are shown with Information is marked with Tips and answers are marked with Questions are marked with 11

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

13 LAB 1: Real-time access and real-time mode on F28x
Objectives Demonstrate how to access/modify memory and registers in real time when processor is running Enable real-time mode in Code Composer Studio Set up interrupts in code so they can continue to run when debugger is halted Step through code while time critical interrupts continue to be serviced Tools and Concepts Covered Real-time access to memory and registers Real-time mode and real-time interrupts 13

14 Importing Example Projects
Go to menu Project  Import Existing CCS Eclipse Project Click the Browse button and go to C:\ti\controlSUITE\development_kits\C2000_LaunchPad\f2802x_examples\epwm_real-time_interrupts Select the project “Example_F2802xEPwmRealTimeInt” Ensure the “Copy projects into workspace” is selected Click Finish

15 Reviewing code In 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 taken LED2 is toggled in the main routine and LED3 is toggled in the interrupt service routine epwm1_timer_isr FREE_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 Variables While 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 serviced ePWM1.TBCTR - register containing the counter for PWM1 – observe that it will stop with an emulation halt unless FREE_SOFT bits are set ePWM1.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 received DBGIER.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 Project
Go to the Project Explorer view Right-click on Example_F2802xEPwmRealTimeInt and select “Build Project”

18 Create a Target Configuration File
Right-click on the project and go to File  New  Target Configuration File Specify f28027lp as the name and click Finish In the “Connection” field, select Texas Instruments XDS100v2 USB Debug Probe In the “Board or Device” filter field, type F28027 Select TMS320F28027 Click Save

19 Launch the Debugger Click on the debug button (green bug icon) to debug the project This 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.TBCTL DBGIER.INT3

20 Setup Continuous Refresh
Open 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 once In Registers view, expand the ePWM1 register Enable Continuous Refresh on all three views

21 Run the program Click Resume to run the program
The 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 running Halt the core by clicking the Suspend button The LEDs on the board should stop blinking and the views stop updating

22 Enable Real-time Mode Enable real-time mode in CCS by clicking the button shown here: Click Resume to run the core In the Expressions view, set ePWM1.TBCTL to 0x8090 to set FREE_SOFT bit to 2, which will enable free run mode on the counter Setting this bit allows the timer to continue to increment even when the core is halted Click the Suspend button to halt the core Notice that ePWM1.TBCTR keeps changing in the Expressions view even when the target is halted as it is set to free run However 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 Interrupts In the Expressions view, set DBGIER.INT3 to be 1 to designate PWM1 as a real-time interrupt Notice 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 stopped Click 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 blink These 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 halted Click the Terminate button in the Debug View to close the debug session

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

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

26 Change build configuration of Project
In Project Explorer view, right-click on Example_F2802xEPwmRealTimeInt, go to Build Configurations- >Set Active and select Flash This 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 project This 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 program Verify 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 session Unplug and re-plug the USB cable to power cycle the board so the program starts running from Flash

28 Modify the Debug settings
Go to menu Run->Debug Configurations and select Example_F2802xEPwnRealTimeInt in the left pane Go to Program tab and select Load Symbols Only This will load just the symbols for the program rather than reflashing the whole program every time the debugger is launched Go to Target tab->Auto Run and Launch Options and check the box for Enable realtime mode Click Apply and Close

29 Launch the Debugger Click on the Debug button (green bug icon) to debug the project This 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 execution Click Resume in the Debug view to continue running the program from that point Verify 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 settings
Go to menu Run->Debug Configurations and select Example_F2802xEPwnRealTimeInt in the left pane Go to Target tab->Program/Memory Load Options and uncheck the box for Halt the target on a connect Click Apply and Close

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

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


Download ppt "Embedded Development Tools"

Similar presentations


Ads by Google