Trustzone with WiFi

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Trustzone with WiFi

3,362 次查看
beze
Contributor II

Hello,

I have the LPC55s69 in combination with wifi10click board. I want to develop an  secure application that does some calculation and then sends the result over wifi. The secure application is already working but i am struggling quite a bit with the wifi and maybe someone can give me some advice so i can finish this. The wifi should be running as an unsecure application so I have the calculation totally seperated. But when I want to setup the wifi as an unsecure application (setting up the pins and all that) I keep getting hardfaults. What do I have to change so i can setup the wifi board form unsecure world or is this just not possible and must be placed in secure world ? So if anyone does have some experience with Wifi in combination with trustzone i am glad for every advice.

Thanks in advance and best regards,
Lukas

 

标签 (3)
标记 (2)
0 项奖励
回复
10 回复数

2,535 次查看
rtrimana
Contributor II

Hi @beze and @xiangjun_rong , did the qca_demo you were trying to port into TrustZone ever work? I have been trying to do the exact same thing. I managed to compile the code but somehow the scheduling of tasks wasn't working well. I am guessing that this could be due to the FreeRTOS config that involves TZ, MPU, and FPU settings. Any insights (or even the working source code) would be much appreciated.

Regards,

Rahmadi

0 项奖励
回复

2,524 次查看
rtrimana
Contributor II

Actually, I managed to solve the issue and now the WiFi driver is working in TZ. If anyone ever tries to do the same thing and needs the solution, here is the thread: https://community.nxp.com/t5/MCUXpresso-IDE/Porting-the-qca-demo-into-TrustZone-for-board-lpcxpresso....

Hope this helps someone someday.

0 项奖励
回复

3,327 次查看
beze
Contributor II

Hi,
sorry that i need to ask again but it is still not working. Keep getting

source/hello_world_ns.c:35:2: error: 'SYSCON_NS' undeclared (first use in this function); did you mean 'SYSCON'?
35 | SYSCON_NS->AHBCLKCTRL.AHBCLKCTRL1|=1<<0;

even when copy pasting your header and when i manually search for syscon_ns in lpc55s69_cm33_core0.h i find it but the project does not recognize it (checked includes so that not the problem). Do i need to think of anything else ? Could you maybe just share the project with me so i can take a look ?

Best regards,
Lukas

0 项奖励
回复

3,340 次查看
beze
Contributor II

Hello XiangJun,

thanks for you quick response. I usually get the hardfault when i try to init the wifiboard (hardfault fsl_clock.c). I tried to follow the guidance you attached but I keep getting the error in hello_world_ns that gpio_ns and syscon_ns are undefined. Where do I have to define this values ?

Thanks and best regards,
Lukas

0 项奖励
回复

3,344 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Lukas

Regarding your question, can you track the line which leads to the hard-fault event in your code?

Anyway, if you want to configure the pin, you have to enable the IOCON bit in AHBCLKCTRL0 register. You can use the line:

SYSCON_NS->AHBCLKCTRL.AHBCLKCTRL0|=1<<13;

If you use the FlexCOMMx module, you have to enable the gated clock as above in the AHBCLKCTRL1 reg.

If you use interrupt mechanism in non-security world, you have to write the NVIC-ITNSx register in ONLY security world.

I attach a doc, hope it can help you

BR

XiangJun Rong

0 项奖励
回复

3,332 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

This is the header file.

#include "LPC55S69_cm33_core0.h"
#include "fsl_device_registers.h"
#include "fsl_debug_console.h"
#include "veneer_table.h"
#include "pin_mux.h"
#include "board.h"
#include "clock_config.h"
//#include "core_armv8mbl.h"

BR

XiangJun Rong

0 项奖励
回复

3,289 次查看
beze
Contributor II

Hello,

the SYSCON_NS and GPIO_NS are defined in LPC55S69_cm33_core0.h. The problem why all the _NS is not defined is because of the file itself i guess.

/* SYSCON - Peripheral instance base addresses */
#if (__ARM_FEATURE_CMSE & 0x2)
/** Peripheral SYSCON base address */
#define SYSCON_BASE (0x50000000u)
/** Peripheral SYSCON base address */
#define SYSCON_BASE_NS (0x40000000u)
/** Peripheral SYSCON base pointer */
#define SYSCON ((SYSCON_Type *)SYSCON_BASE)
/** Peripheral SYSCON base pointer */
#define SYSCON_NS ((SYSCON_Type *)SYSCON_BASE_NS)
/** Array initializer of SYSCON peripheral base addresses */
#define SYSCON_BASE_ADDRS { SYSCON_BASE }
/** Array initializer of SYSCON peripheral base pointers */
#define SYSCON_BASE_PTRS { SYSCON }
/** Array initializer of SYSCON peripheral base addresses */
#define SYSCON_BASE_ADDRS_NS { SYSCON_BASE_NS }
/** Array initializer of SYSCON peripheral base pointers */
#define SYSCON_BASE_PTRS_NS { SYSCON_NS }
#else
/** Peripheral SYSCON base address */
#define SYSCON_BASE (0x40000000u)
/** Peripheral SYSCON base pointer */
#define SYSCON ((SYSCON_Type *)SYSCON_BASE)
/** Array initializer of SYSCON peripheral base addresses */
#define SYSCON_BASE_ADDRS { SYSCON_BASE }
/** Array initializer of SYSCON peripheral base pointers */
#define SYSCON_BASE_PTRS { SYSCON }
#endif

 

The IF decides wether SYSCON_NS is defined or not but __ARM_FEATURE_CMSE is ether 0 or 1 as far as i know so is it possible that __ARM_FEATURE_CMSE & 0x2 is true ? Am I right on this one ? That if the if statement would be true i could follow the guidance you attached in the first place ?

Best regards,
Lukas

0 项奖励
回复

3,243 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Lukas,

I am sorry, you have to set the _ARM_FEATURE_CMSE=3 in the compiler option for the non-security world project.

Hope it can help you

BR

XiangJun Rong

 

xiangjun_rong_0-1607319931675.png

 

 

0 项奖励
回复

3,237 次查看
beze
Contributor II

Hi,

thanks for the tipp know all the values are defined and i can compile the project. But once entering the ns project and trying to execute first line of Init_MRT0_NS() i get a Bus Fault (BFSR). Any ideas on how to solve this ?

Best regards,
Lukas

0 项奖励
回复

3,232 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Lukas,

I found out the code, I attach it, pls refer to it. It is based on MCUXpresso tools and SDK package.

Hope it can help you

BR

XiangJun Rong

0 项奖励
回复