IMX6Q's UART work on trustzone(Trust and N-Trust)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

IMX6Q's UART work on trustzone(Trust and N-Trust)

1,011 Views
jiongzhongliu
Contributor III

I use IMX6Q's trustzone function. I want to ust UART4 to print my debug information in bothe Trust and N-Trust world.How do I do to  configure the UART4,so that UART4 can be used in both T and NT world.The Following is my code to config the CSU and AIPS. but UART4 can only print information form Trust world. Is it other regisgers I shoud configuration?

#define REG(x) (*((volatile unsigned int *)(x)))

#define CSU_BASE             0x021c0000   /*csu base address*/

#define CSU_CSL35           0x8c

#define AIPSIZ2_MPR         0x0217c000

#define AIPSIZ2_OPACR3  0x0217C04C

void csu_init()

{

    uint32_t val;

    REG(AIPSIZ2_MPR) = 0xF7000000;

    val = REG(AIPSIZ2_OPACR3);

    val &= 0xffff0fff;

    REG(AIPSIZ2_OPACR3) = val;

    REG(CSU_BASE + CSU_CSL35) = 0x00ff00fff;

}

Labels (1)
0 Kudos
4 Replies

606 Views
igorpadykov
NXP Employee
NXP Employee

Hi  jiongzhong

seems OPACR trust and n-trust accesses are mutially exclusive:

xxx0 TP — Accesses from an untrusted master are allowed.

xxx1 TP — Accesses from an untrusted master are not allowed.

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 Kudos

606 Views
jiongzhongliu
Contributor III

    hi igorpadykov,I have solve the problem that the UART4 can work in N-trust world. Following is my code to config the CSU registers.To my surprist, it need to be configured so many registers!

    If one of the register no configuration,UART4 may not print imformaiton,or may lose data. Is there any documentation that explain what CSU register I shall config? The security datasheet for IMX6 is unclear

REG(CSU_BASE + CSU_CSL35) = 0x00ff00ff;  //shall set

REG(CSU_BASE + CSU_CSL6) = 0x00ff00ff;   //shall set

REG(CSU_BASE + CSU_CSL2) = 0x00ff00ff;  //shall set

REG(CSU_BASE + CSU_CSL5) = 0x00ff00ff;  //shall set

REG(CSU_BASE + CSU_CSL7) = 0x00ff00ff; //shall set

REG(CSU_BASE + CSU_CSL8) = 0x00ff00ff; //shall set

REG(CSU_BASE + CSU_CSL10) = 0x00ff00ff; //shall set

REG(CSU_BASE + CSU_CSL11) = 0x00ff00ff; //shall set

REG(CSU_BASE + CSU_CSL16) = 0x00ff00ff;    //shall set

REG(CSU_BASE + CSU_CSL17) = 0x00ff00ff;    //shall set

REG(CSU_BASE + CSU_CSL28) = 0x00ff00ff;   //shall set

REG(CSU_BASE + CSU_CSL29) = 0x00ff00ff;   //shall set

0 Kudos

606 Views
jiongzhongliu
Contributor III

The code first time I paste there has  a error,sorry, I paste it again.

#define REG(x) (*((volatile unsigned int *)(x)))

#define CSU_BASE             0x021c0000   /*csu base address*/

#define CSU_CSL35           0x8c

#define AIPSIZ2_MPR         0x0217c000

#define AIPSIZ2_OPACR3  0x0217C04C

void csu_init()

{

    uint32_t val;

    REG(AIPSIZ2_MPR) = 0xF7000000;

    val = REG(AIPSIZ2_OPACR3);

    val &= 0xffff0fff;

    REG(AIPSIZ2_OPACR3) = val;

    REG(CSU_BASE + CSU_CSL35) = 0x00ff00ff;  //(change 0x00ff00fff)

}

0 Kudos

606 Views
jiongzhongliu
Contributor III

I have set the slave can access from an untrust master. when the CPU work on Trust statu ,the UART4 can printf debug information,when I put CPU work in N-trust statu,there is nothing come from UART4. I initiall the CSU and AIPS when CPU is in Montior mode.

0 Kudos