| How to write a Trusted/Host Application? | |
| 1. Please refer to | |
| https://optee.readthedocs.io/en/latest/building/trusted_applications.html#build-trusted-applications | |
| https://optee.readthedocs.io/en/latest/building/gits/optee_examples/optee_examples.html#optee-examples | |
| 2. We perpare a minimal set of optee_examples which only contains hello world for your reference. | |
| Unzip optee_appref and there is a hello_world example with below layout: | |
| hello_world/ | |
| ├── host | |
| │ ├── Makefile BINARY=optee_example_hello_world | |
| │ └── main.c Implementation of host application of hello world | |
| └── ta | |
| ├── Makefile BINARY=<uuid> | |
| ├── sub.mk srcs-y += hello_world_ta.c | |
| ├── include | |
| │ └── hello_world_ta.h Header exported to non-secure: TA commands API | |
| ├── hello_world_ta.c Implementation of TA entry points | |
| └── user_ta_header_defines.h TA_UUID, TA_FLAGS, TA_DATA/STACK_SIZE, ... | |
| 3. Please update conf.mk according to your environment | |
| ASR_OWRT_DIR should be the top directory of ASR1803 openwrt release. | |
| HOST_CROSS_COMPILE should be tool-chain used by ASR openwrt release. | |
| please run below command first with ASR_OWRT_DIR replaced with the openwrt path or | |
| add it to ~/.bashrc and source ~/.bashrc: | |
| export PATH=$ASR_OWRT_DIR/owtoolchain/linux64/bin:$PATH | |
| TA_CROSS_COMPILE should be the tool-chain that ASR uses to compile optee_os. | |
| 4. Please add your own TAs and Host application like the hello_world example and make under the top directory. | |
| Then the built TA is under out/ta and host application is under out/ca | |
| How to install tool-chain of optee_os, please refer to | |
| https://optee.readthedocs.io/en/latest/building/toolchains.html | |
| and confirm the tool-chain version with ASR. | |
| e.g.: | |
| 1. Download gcc-arm-10.3-2021.07-x86_64-arm-none-linux-gnueabihf.tar.xz from: | |
| https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads | |
| 2. tar xf gcc-arm-10.3-2021.07-x86_64-arm-none-linux-gnueabihf.tar.xz -C aarch32 --strip-components=1 | |
| 3. export PATH=$PATH:$TOOLCHAIN/aarch32/bin |