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