Presentation is loading. Please wait.

Presentation is loading. Please wait.

PRU-ICSS Programming with CCS

Similar presentations


Presentation on theme: "PRU-ICSS Programming with CCS"— Presentation transcript:

1 PRU-ICSS Programming with CCS
CCS PRU Compiler Tools introduction

2 PRU-ICSS Compiler History
Development cycle before PRU Compiler support for CCS v6.x Notepad++ to edit PRU source code (with keyword highlight extension) PASM.exe to translate the source code to PRU binary (.h, .bin) CCS was used to download binary into PRU cores no source code view debugging, only “raw” assembler Breakpoint and single step debugging is possible Note that few PRU examples are based on PASM

3 PRU Compiler support with CCS
CCSv6.0 (and newer) adds PRU compiler support write code, assemble program and download firmware to PRU directly with CCS source code view debug, single step, break point, register view, memory view, ... New PRU code development examples and TI designs are based on CCS PRU compiler For new project, use CCS PRU compiler Install PRU Compiler during CCS installation via checkbox or install later on via the CCS App Center Note PRU compiler supports C programming, but it is not used for real-time application programming Use assembler language for MII_RT programming

4 Instruction mnemonics: PASM to CCS PRU compiler
The syntax for instruction mnemonics is very similar to the existing PASM assembler. Exceptions are listed here: MOV instruction MOV is only supported for register to register moves. The LDI instruction must be used to load a literal into a register. LDI instruction LDI can only be used to load a 16-bit constant into a register. To load a 32-bit constant, you must use the LDI32 instruction. Operands with a '&' prefix The existing PASM assembler accepts operands with or without the & symbol: LBBO &r0 or LBBO r0. The assembler in this release requires the & for these operands. Comments PRU Compiler uses ‘;’ PARM uses ‘//’ #define  .set struct

5 How to create new PRU project with CCSv6
Select: File->New->CCS Project Select Target: ICE_AM3359 Select PRU tab Fill in Project Name Project template and examples: choose Empty Assembly-only Project Press Finish

6 How to create a target configuration
You must choose the correct configuration for CCS to include the PRU debug capabilities The target configuration depends on: Target, Board and JTAG emulator Example shows config for: - AM3359 ICE board - on-board USB XDS100v2 JTAG emulator To create a new target configuration: Open CCS Click on File > New > Target Configuration File CCS will open a New Target Configuration window, in this window: Type the desired filename for the target configuration (like NewTargetConfiguration.ccxml)

7 How to create a target configuration
In the main screen, CCS will open a “New Target Configuration” tab In the Connection menu, choose the correct emulator you plan to use. The debug tools do not apply to the simulator. In the Device box, choose AM3359 from the options. Click on the Advanced tab (1) Select the emulator (2) Select AM3359 as the device (3) Click Advanced tab

8 How to create a target configuration
In the Advanced tab, select the M3_wakeupSS_0 Click Bypass – this will clean up the view later on in the Debug View Select CortexA8 (4) Select M3_wakeupSS_0 (5) Select Bypass (6) Select CortexA8

9 How to create a target configuration
Select the board specific GEL initialization script; eg. for ICE Browse to <IA_SDK_HOME>sdk\tools\gel\ICE\TMDXICE3359.gel Select Texas Instruments XDS100v2 USB Emulator_0 (8) Select Texas Instruments XDS100v2 (7) Select GEL script

10 How to create a target configuration
In The JTAG TCLK Frequency (MHz), select Fixed with user specified faster value Enter 15.0MHz Click on the Save button (9) Select Fixed with user specified faster value (10) Enter 15.0MHz (11) Save the configuration

11 Add PRU-enable support to GEL script
PRU-ICSS subsystem is in power down state after board power-up ARM program or GEL script can power-up PRU-ICSS Example to use GEL script to power-up PRU-ICSS Download AM335x_PRU_ICSS.gel from Copy AM335x_PRU_ICSS.gel to sdk\tools\gel\AM335x Open file TMDXICE3359_v2_1A.gel Add the following lines at the end of the file StartUp() { GEL_LoadGel("$(GEL_file_dir)/AM335x_PRU_ICSS.gel"); }

12 Creating an new Assembler program
Right-click MyPruProject select New->File write to File name field: pru_example.asm press Finish Copy&paste the following code ;lab01.asm ;Arithmetics .retain ; Required for building .out with assembly file .retainrefs ; Required for building .out with assembly file .global main .sect ".text" main: ZERO &R0, 4 ; Set R0 and R1 to zero LDI R0, 0x ; Initialization LDI R1, 0x ; Initialization ADD R0, R0, 10 ; Add 10 to R0, result in R0 RSB R0, R0, R1 ; R0 = R1 - R0 ADD R2, R0.b1, R1.w1 HALT Save file

13 Preparing Linker Command file
Copy the linker command file pru.cmd file into the MyPruProject folder Right-click the project properties Select CCS Build -> PRU Linker -> Advanced Options -> Symbol management Add ‘main’ to Specify program entry point for the output module Build the project

14 How to connect to a target PRU
Start a debug session View > Target Configuration Right click the target configuration file, select Launch Selected Configuration CCS will connect to the target The Debug window will now show 3 disconnected targets The CortexA8 core The PRU0 core The PRU1 core PRU0 core PRU1 core

15 How to connect to a target PRU
Connect to CortexA8: Select the Disconnected CortexA8 Device and either Right-click and the select Connect Target, or Use Run > Connect Target CCS will connect to the CortexA8 and the Register, Disassembly and Memory windows will populate. GEL script: The OnTargetConnect() portion will run while CCS connects

16 How to connect to a target PRU
Reset the CortexA8 by performing a CPU Reset (HW) Run the AM335x System Initialization script

17 How to connect to a target PRU
Run the PRU_ICSS _Init script Select the disconnected PRU core and either Right-click and then select Connect Target or use Run > Connect Target CCS will connect to the PRU core and the Register, Disassembly and Memory window will populate

18 The Register Window When one of the connected PRUs is selected in the Debug Window, the Registers Window will show the Core Registers and Debug Registers for that PRU. You can expand and hide the Core and Debug registers in groups. You can modify values directly in the register window by double-clicking on the value and entering the new value

19 The Memory Window Memory Selection: Program Data PRU Device Memory
Address Selection: Enter text or use menu for recently used values Save, Load or Fill Memory Data Display Style Double-click on a memory location to modify it directly

20 Loading a PRU Binary (executable file)
To load a PRU binary (.out) is the same as loading a ARM binary (.out) Go to the Run -> Load -> Load Program Select Browse Project button Select MyPruProject -> Debug -> MyPruProject.out Press OK (2x) The binary is now loaded. The program counter (PC) has stopped at HALT You can set a breakpoint at send command and restart the program to force breakpoint at start of program)

21 Execution Control – Run, Halt, Single-Step
To Run/Halt, with the PRU selected Click the RUN button in the Debug window, or Click Target > Run The PRU code will run until it is halted or executes a HALT instruction To single-step through code, use any of the single step controls. Step-Into, Step-Over, Assembly Step-Into, Assembly Step-Over all have identical functions on the PRU

22 Execution Control – Breakpoint Control
You can set/clear breakpoints by double-clicking in the bar to the left of the address in the disassembly window. You can also view/control PRU breakpoints by using View > Breakpoints

23 Execution Control Screenshot

24 Example: Enable PRU cycle counter
In Register view, select the PRU0_CTRL->CTRL register Expand the CRTL register Set CTR_EN to 1

25 Example: PRU cycle counter
Example 1: Execute Single-Step and observe CYCLECNT register CYCLECNT show the amount of cycles required to execute one assembler instruction Example 2: Execute Run > Resume, if there is no breakpoint or HALT command press Suspend and observe CYCLECNT and STALLCNT registers STALLCNT shows the amount of cycles the PRU had waited; this results from memory access

26 Labs Import the CCS_Labs via Import dialog
Follow the Word file instructions


Download ppt "PRU-ICSS Programming with CCS"

Similar presentations


Ads by Google