UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

AR# 65956

Zynq - How to make modifications to the ps7_init.tcl, and ps7_init.c files

Description

How can I make modifications to the ps7_init.tcl, and ps7_init.c files?

Solution

What are the ps7_init files?

  • The ps7_init.tcl, and ps7_init.c/.h files are used to configure the Processing Sub-System

 

Where are they used?

  • The ps7_init.tcl is used in the Debug/Run As configurations in the SDK tool, or from Tcl command line when sourced
  • The ps7_init.c/.h files are used in the FSBL

 

In the Tcl and C files, various silicon versions are referenced. How can I determine my Silicon revision?

You can easily obtain this by reading the register below using the XSDB tool:

Bits 31:28 represent the Silicon revision. 

For example, the above is revision 3.0.

 

How do I change a value in the ps7_init.c?

 

As an example, say you want to disable the GEM 0 clock.

According to the Zynq TRM this is register 0XF800012C. 

Below is this register in the ps7_init.c file with the GEM 0 clock highlighted:

    // .. .. DMA_CPU_2XCLKACT = 0x1
    // .. .. ==> 0XF800012C[0:0] = 0x00000001U
    // .. ..     ==> MASK : 0x00000001U    VAL : 0x00000001U
    // .. .. USB0_CPU_1XCLKACT = 0x1
    // .. .. ==> 0XF800012C[2:2] = 0x00000001U
    // .. ..     ==> MASK : 0x00000004U    VAL : 0x00000004U
    // .. .. USB1_CPU_1XCLKACT = 0x1
    // .. .. ==> 0XF800012C[3:3] = 0x00000001U
    // .. ..     ==> MASK : 0x00000008U    VAL : 0x00000008U
    // .. .. GEM0_CPU_1XCLKACT = 0x1
    // .. .. ==> 0XF800012C[6:6] = 0x00000001U
    // .. ..     ==> MASK : 0x00000040U    VAL : 0x00000040U
    // .. .. GEM1_CPU_1XCLKACT = 0x0
    // .. .. ==> 0XF800012C[7:7] = 0x00000000U
    // .. ..     ==> MASK : 0x00000080U    VAL : 0x00000000U
    // .. .. SDI0_CPU_1XCLKACT = 0x1
    // .. .. ==> 0XF800012C[10:10] = 0x00000001U
    // .. ..     ==> MASK : 0x00000400U    VAL : 0x00000400U
    // .. .. SDI1_CPU_1XCLKACT = 0x0
    // .. .. ==> 0XF800012C[11:11] = 0x00000000U
    // .. ..     ==> MASK : 0x00000800U    VAL : 0x00000000U
    // .. .. SPI0_CPU_1XCLKACT = 0x0
    // .. .. ==> 0XF800012C[14:14] = 0x00000000U
    // .. ..     ==> MASK : 0x00004000U    VAL : 0x00000000U
    // .. .. SPI1_CPU_1XCLKACT = 0x0
    // .. .. ==> 0XF800012C[15:15] = 0x00000000U
    // .. ..     ==> MASK : 0x00008000U    VAL : 0x00000000U
    // .. .. CAN0_CPU_1XCLKACT = 0x1
    // .. .. ==> 0XF800012C[16:16] = 0x00000001U
    // .. ..     ==> MASK : 0x00010000U    VAL : 0x00010000U
    // .. .. CAN1_CPU_1XCLKACT = 0x0
    // .. .. ==> 0XF800012C[17:17] = 0x00000000U
    // .. ..     ==> MASK : 0x00020000U    VAL : 0x00000000U
    // .. .. I2C0_CPU_1XCLKACT = 0x1
    // .. .. ==> 0XF800012C[18:18] = 0x00000001U
    // .. ..     ==> MASK : 0x00040000U    VAL : 0x00040000U
    // .. .. I2C1_CPU_1XCLKACT = 0x1
    // .. .. ==> 0XF800012C[19:19] = 0x00000001U
    // .. ..     ==> MASK : 0x00080000U    VAL : 0x00080000U
    // .. .. UART0_CPU_1XCLKACT = 0x0
    // .. .. ==> 0XF800012C[20:20] = 0x00000000U
    // .. ..     ==> MASK : 0x00100000U    VAL : 0x00000000U
    // .. .. UART1_CPU_1XCLKACT = 0x1
    // .. .. ==> 0XF800012C[21:21] = 0x00000001U
    // .. ..     ==> MASK : 0x00200000U    VAL : 0x00200000U
    // .. .. GPIO_CPU_1XCLKACT = 0x1
    // .. .. ==> 0XF800012C[22:22] = 0x00000001U
    // .. ..     ==> MASK : 0x00400000U    VAL : 0x00400000U
    // .. .. LQSPI_CPU_1XCLKACT = 0x1
    // .. .. ==> 0XF800012C[23:23] = 0x00000001U
    // .. ..     ==> MASK : 0x00800000U    VAL : 0x00800000U
    // .. .. SMC_CPU_1XCLKACT = 0x1
    // .. .. ==> 0XF800012C[24:24] = 0x00000001U
    // .. ..     ==> MASK : 0x01000000U    VAL : 0x01000000U
    // .. ..
    EMIT_MASKWRITE(0XF800012C, 0x01FFCCCDU ,0x01ED044DU),
 

So, this is as follows (with bit 6 highlighted):

0000 0001 1110 1101 0000 0100 0100 1101

Now Let us disable this clock:

0000 0001 1110 1101 0000 0100 0000 1101

To do this we would change the following line:

EMIT_MASKWRITE(0XF800012C, 0x01FFCCCDU ,0x01ED040DU),

Once the changes are made, save the ps7_init.c, and select project -> Clean, and Build.

How to change a value in the ps7_init.tcl?

Open the ps7_init.tcl file in the hw_platform in the SDK Project Explorer.

Change the line below:

mask_write 0XF800012C 0x01FFCCCD 0x01ED040D

 

How can I verify that the Register has been changed?

To confirm the change, you can use the XSDB to read the register value, either after the FSBL (if the ps7_init.c is changed), or after the Debug/Run As (if the ps7_init.tcl is changed):

AR# 65956
Date Created 11/12/2015
Last Updated 11/17/2015
Status Active
Type General Article
Tools
  • Vivado Design Suite - 2015.3
  • Vivado Design Suite - 2015.2
  • Vivado Design Suite - 2015.1