Summer Qin | 153f3df | 2022-11-17 15:51:02 +0800 | [diff] [blame] | 1 | ********* |
| 2 | eRPC Host |
| 3 | ********* |
| 4 | |
Xinyu Zhang | cc99dc7 | 2023-05-05 10:35:11 +0800 | [diff] [blame] | 5 | This host example is only tested on Linux machine with Musca-S1 and AN521 FVP. |
Summer Qin | 153f3df | 2022-11-17 15:51:02 +0800 | [diff] [blame] | 6 | |
Xinyu Zhang | cc99dc7 | 2023-05-05 10:35:11 +0800 | [diff] [blame] | 7 | Example: UART Transportation on Musca-S1 |
Summer Qin | 153f3df | 2022-11-17 15:51:02 +0800 | [diff] [blame] | 8 | ======================================== |
| 9 | |
| 10 | Build instructions on the target |
| 11 | -------------------------------- |
| 12 | |
| 13 | .. code-block:: bash |
| 14 | |
Kevin Peng | 9718581 | 2023-11-15 15:34:48 +0800 | [diff] [blame] | 15 | # Build TF-M |
Kevin Peng | 4b9bbec | 2023-07-21 11:32:55 +0800 | [diff] [blame] | 16 | |
Kevin Peng | 9718581 | 2023-11-15 15:34:48 +0800 | [diff] [blame] | 17 | cmake -G"Unix Makefiles" -S <path_to_tf-m> -B build_spe -DTFM_PLATFORM=musca_s1 \ |
Kevin Peng | 4b9bbec | 2023-07-21 11:32:55 +0800 | [diff] [blame] | 18 | -DTFM_PARTITION_CRYPTO=ON -DTFM_PARTITION_INTERNAL_TRUSTED_STORAGE=ON \ |
Xinyu Zhang | cc99dc7 | 2023-05-05 10:35:11 +0800 | [diff] [blame] | 19 | -DTFM_SPM_LOG_LEVEL=TFM_SPM_LOG_LEVEL_SILENCE -DTFM_PARTITION_LOG_LEVEL=TFM_PARTITION_LOG_LEVEL_SILENCE \ |
Kevin Peng | 9718581 | 2023-11-15 15:34:48 +0800 | [diff] [blame] | 20 | -DMCUBOOT_LOG_LEVEL=OFF |
Kevin Peng | 4b9bbec | 2023-07-21 11:32:55 +0800 | [diff] [blame] | 21 | |
Kevin Peng | 9718581 | 2023-11-15 15:34:48 +0800 | [diff] [blame] | 22 | cmake --build build_spe -- install -j |
| 23 | |
| 24 | # Build NS eRPC server |
| 25 | |
| 26 | cmake -G"Unix Makefiles" -S <path_to_tf-m-tests>/erpc/server/app -B build_nspe \ |
| 27 | -DCONFIG_SPE_PATH=<absolute_path_to_build_spe>/api_ns |
| 28 | |
| 29 | cmake --build build_nspe -j |
| 30 | |
| 31 | # Create the final image |
| 32 | |
| 33 | srec_cat build_spe/bin/bl2.bin -Binary -offset 0xA000000 build_nspe/tfm_s_ns_signed.bin \ |
| 34 | -Binary -offset 0xA020000 -o build_nspe/tfm.hex -Intel |
Summer Qin | 153f3df | 2022-11-17 15:51:02 +0800 | [diff] [blame] | 35 | |
Xinyu Zhang | cc99dc7 | 2023-05-05 10:35:11 +0800 | [diff] [blame] | 36 | .. Note:: |
| 37 | All the logs must be disabled to avoid interferences between logs and eRPC transportation as |
| 38 | they share the same UART device. |
| 39 | Otherwise, the RPC test framework may not work. |
| 40 | This might only happen on platforms using the same UART devices. |
| 41 | |
Summer Qin | 153f3df | 2022-11-17 15:51:02 +0800 | [diff] [blame] | 42 | Build instructions on the host |
| 43 | ------------------------------ |
| 44 | |
| 45 | .. code-block:: bash |
| 46 | |
| 47 | cd <TF-M tests base folder>/erpc/host_example |
Kevin Peng | 4b9bbec | 2023-07-21 11:32:55 +0800 | [diff] [blame] | 48 | |
| 49 | cmake -S . -B build -G "Unix Makefiles" \ |
Kevin Peng | 9718581 | 2023-11-15 15:34:48 +0800 | [diff] [blame] | 50 | -DCONFIG_SPE_PATH=<absolute_path_to_build_spe>/api_ns \ |
Kevin Peng | 4b9bbec | 2023-07-21 11:32:55 +0800 | [diff] [blame] | 51 | -DERPC_REPO_PATH=<TFM_build_folder>/lib/ext/erpc-src \ |
Xinyu Zhang | cc99dc7 | 2023-05-05 10:35:11 +0800 | [diff] [blame] | 52 | -DERPC_TRANSPORT=UART -DPORT_NAME="/dev/ttyACM0" |
Kevin Peng | 4b9bbec | 2023-07-21 11:32:55 +0800 | [diff] [blame] | 53 | |
Summer Qin | 153f3df | 2022-11-17 15:51:02 +0800 | [diff] [blame] | 54 | cmake --build build/ |
| 55 | |
Jason Guo | 4625c23 | 2023-07-11 10:21:49 +0800 | [diff] [blame] | 56 | .. Note:: |
| 57 | The ``ERPC_TRANSPORT`` and ``PORT_NAME`` can be omitted and setting the transportation info |
| 58 | in command line is also supported. Follow `Run instructions`_ on how to use the command line. |
| 59 | |
Xinyu Zhang | cc99dc7 | 2023-05-05 10:35:11 +0800 | [diff] [blame] | 60 | Run instructions |
| 61 | ---------------- |
Summer Qin | 153f3df | 2022-11-17 15:51:02 +0800 | [diff] [blame] | 62 | |
Xinyu Zhang | cc99dc7 | 2023-05-05 10:35:11 +0800 | [diff] [blame] | 63 | - Flash the image to the device and boot it up. |
| 64 | - Start the host example |
Summer Qin | 153f3df | 2022-11-17 15:51:02 +0800 | [diff] [blame] | 65 | |
Xinyu Zhang | cc99dc7 | 2023-05-05 10:35:11 +0800 | [diff] [blame] | 66 | .. code-block:: bash |
| 67 | |
| 68 | cd <TF-M tests base folder>/erpc/host_example |
| 69 | ./build/erpc_main |
Summer Qin | 153f3df | 2022-11-17 15:51:02 +0800 | [diff] [blame] | 70 | |
Jason Guo | 4625c23 | 2023-07-11 10:21:49 +0800 | [diff] [blame] | 71 | .. Note:: |
| 72 | If ``ERPC_TRANSPORT`` and ``PORT_NAME`` are not set, then they should be set as arguments of |
| 73 | ``erpc_main``. Execute the following command to run eRPC program: |
| 74 | ./build/erpc_main --UART /dev/ttyACM0 |
| 75 | |
Summer Qin | 153f3df | 2022-11-17 15:51:02 +0800 | [diff] [blame] | 76 | Example: TCP Transportation on AN521 FVP |
| 77 | ======================================== |
| 78 | |
| 79 | Build instructions on the target |
| 80 | -------------------------------- |
| 81 | |
| 82 | .. code-block:: bash |
| 83 | |
Kevin Peng | 9718581 | 2023-11-15 15:34:48 +0800 | [diff] [blame] | 84 | # Build TF-M |
Kevin Peng | 4b9bbec | 2023-07-21 11:32:55 +0800 | [diff] [blame] | 85 | |
Kevin Peng | 9718581 | 2023-11-15 15:34:48 +0800 | [diff] [blame] | 86 | cmake -G"Unix Makefiles" -S <path_to_tf-m> -B build_spe -DTFM_PLATFORM=an521 \ |
| 87 | -DTFM_PARTITION_CRYPTO=ON -DTFM_PARTITION_INTERNAL_TRUSTED_STORAGE=ON |
Kevin Peng | 4b9bbec | 2023-07-21 11:32:55 +0800 | [diff] [blame] | 88 | |
Kevin Peng | 9718581 | 2023-11-15 15:34:48 +0800 | [diff] [blame] | 89 | cmake --build build_spe -- install -j |
| 90 | |
| 91 | # Build NS eRPC server |
| 92 | |
| 93 | cmake -G"Unix Makefiles" -S <path_to_tf-m-tests>/erpc/server/app -B build_nspe \ |
| 94 | -DCONFIG_SPE_PATH=<absolute_path_to_build_spe>/api_ns |
| 95 | |
| 96 | cmake --build build_nspe -j |
Summer Qin | 153f3df | 2022-11-17 15:51:02 +0800 | [diff] [blame] | 97 | |
| 98 | Build instructions on the host |
| 99 | ------------------------------ |
| 100 | |
| 101 | .. code-block:: bash |
| 102 | |
| 103 | cd <TF-M tests base folder>/erpc/host_example |
Kevin Peng | 4b9bbec | 2023-07-21 11:32:55 +0800 | [diff] [blame] | 104 | |
| 105 | cmake -S . -B build -G "Unix Makefiles" \ |
Kevin Peng | 9718581 | 2023-11-15 15:34:48 +0800 | [diff] [blame] | 106 | -DCONFIG_SPE_PATH=<absolute_path_to_build_spe>/api_ns \ |
| 107 | -DERPC_REPO_PATH=<absolute_path_to_build_nspe>/lib/ext/erpc-src \ |
Xinyu Zhang | cc99dc7 | 2023-05-05 10:35:11 +0800 | [diff] [blame] | 108 | -DERPC_TRANSPORT=TCP -DERPC_HOST="0.0.0.0" -DERPC_PORT=5001 |
Kevin Peng | 4b9bbec | 2023-07-21 11:32:55 +0800 | [diff] [blame] | 109 | |
Summer Qin | 153f3df | 2022-11-17 15:51:02 +0800 | [diff] [blame] | 110 | cmake --build build/ |
| 111 | |
Jason Guo | 4625c23 | 2023-07-11 10:21:49 +0800 | [diff] [blame] | 112 | .. Note:: |
| 113 | The ``ERPC_TRANSPORT``, ``ERPC_HOST`` and ``ERPC_PORT`` can be omitted and setting the |
Kevin Peng | 9718581 | 2023-11-15 15:34:48 +0800 | [diff] [blame] | 114 | transportation info in command line when running the app is also supported. |
| 115 | Follow `Run instructions`_ on how to use the command line. |
Jason Guo | 4625c23 | 2023-07-11 10:21:49 +0800 | [diff] [blame] | 116 | |
Xinyu Zhang | cc99dc7 | 2023-05-05 10:35:11 +0800 | [diff] [blame] | 117 | Run instructions |
| 118 | ---------------- |
Summer Qin | 153f3df | 2022-11-17 15:51:02 +0800 | [diff] [blame] | 119 | |
| 120 | Start the AN521 FVP: |
| 121 | |
| 122 | .. code-block:: bash |
| 123 | |
| 124 | <DS_PATH>/sw/models/bin/FVP_MPS2_AEMv8M \ |
| 125 | --parameter fvp_mps2.platform_type=2 \ |
| 126 | --parameter cpu0.baseline=0 \ |
| 127 | --parameter cpu0.INITVTOR_S=0x10000000 \ |
| 128 | --parameter cpu0.semihosting-enable=0 \ |
| 129 | --parameter fvp_mps2.DISABLE_GATING=0 \ |
| 130 | --parameter fvp_mps2.telnetterminal0.start_telnet=1 \ |
| 131 | --parameter fvp_mps2.telnetterminal1.start_telnet=0 \ |
| 132 | --parameter fvp_mps2.telnetterminal2.start_telnet=0 \ |
| 133 | --parameter fvp_mps2.telnetterminal0.quiet=0 \ |
| 134 | --parameter fvp_mps2.telnetterminal1.quiet=1 \ |
| 135 | --parameter fvp_mps2.telnetterminal2.quiet=1 \ |
| 136 | --parameter fvp_mps2.UART0.out_file=/dev/stdout \ |
| 137 | --parameter fvp_mps2.UART0.unbuffered_output=1 \ |
| 138 | --parameter fvp_mps2.telnetterminal1.mode=raw \ |
| 139 | --parameter fvp_mps2.UART1.unbuffered_output=1 \ |
| 140 | --parameter fvp_mps2.mps2_visualisation.disable-visualisation=1 \ |
| 141 | --application cpu0=<APPLICATION> \ |
| 142 | --data cpu0=<DATA>@0x10080000 \ |
| 143 | -M 1 |
| 144 | |
Xinyu Zhang | cc99dc7 | 2023-05-05 10:35:11 +0800 | [diff] [blame] | 145 | Start the host example |
| 146 | |
Summer Qin | 153f3df | 2022-11-17 15:51:02 +0800 | [diff] [blame] | 147 | .. code-block:: bash |
| 148 | |
| 149 | cd <TF-M tests base folder>/erpc/host_example |
| 150 | ./build/erpc_main |
| 151 | |
Jason Guo | 4625c23 | 2023-07-11 10:21:49 +0800 | [diff] [blame] | 152 | .. Note:: |
| 153 | If ``ERPC_TRANSPORT``, ``ERPC_HOST`` and ``ERPC_PORT`` are not set, then they should be set as |
| 154 | arguments of ``erpc_main``. Execute the following command to run eRPC program: |
| 155 | ./build/erpc_main --TCP 0.0.0.0 5001 |
| 156 | |
Summer Qin | 153f3df | 2022-11-17 15:51:02 +0800 | [diff] [blame] | 157 | -------------- |
| 158 | |
| 159 | *Copyright (c) 2023, Arm Limited. All rights reserved.* |