萬事開頭難,本以爲所有的HelloWorld都是很簡單的。下載了TZ的HelloWorld才知道。比想象的要困難很多。
DS-5的下載地址,需要註冊ARM官網。註冊個ARM賬號,沒有XX版本。
TrustZone的HelloWorld的下載地址
需要背景知識:
1.arm彙編(中級)
2.瞭解如何製作linux的boot,kernel
3.瞭解文件在flash佈局與開發
4.瞭解TrustZone相關硬件設置方法
5.軟件開發以及混合編程(中級)
6.Makefile使用方法
7.基於eclipse的DS-5的使用
假定你擁有了上面的知識,瞭解這個程序應該簡單一些。不過ARM官方的東西,註釋還是比較多的。如果你只是想編譯通過,瞭解其中幾項也是沒問題的。
這個程序告訴我們什麼?或者說通過這個程序我們學到了什麼?
1.安全區先啓動
2.Monitor必須在安全區啓動
3.如何實現SMC(TZ的切換)跳轉
4.需要硬件TZPC支持
這是個基礎,稍後我們會慢慢研究這個東西的。
Program execution flow
secureStart startup_secure.s: Initialization of Secure world | __main ARM library initialization | main main_secure.c: Enable caches and configure TZPC | monitorInit monitor.s: initialize Monitor | main main_secure.c: Print message and execute SMC | S -> NS | normalStart startup_normal.s: Initialization of Normal world | __main ARM library initialization | main main_normal.c: Enable caches, print message and execute SMC | NS -> S | SMC_Handler monitor.s: Perform context switch from NS to S | main main_secure.c: Print message and execute SMC | SMC_Handler monitor.s: Perform context switch from S to NS | S -> NS | main main_normal.c: Print message and execute SMC | NS -> S | SMC_Handler monitor.s: Perform context switch from NS to S | main main_secure.c: Print message and execute SMC