Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# babblesim PoC
## Dependencies
1. Gcc for arm
[developer.arm.com](https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads)<br>
Download, install and add the binary directory to your path
2. FVP
Download and install the FVP at /opt/arm/VHT_Corstone_SSE-300_Ethos-U55.<br>
Alternatively, if you have the FVP already installed at another path, make sure it's added to your `$PATH`. If it is installed in `/opt/arm/` for instance:
```sh
command -v VHT_Corstone_SSE-300_Ethos-U55 >/dev/null 2>&1 || export PATH=$PATH:/opt/arm/
```
3. Python 3.8+ and tools
It'll be needed for the Zephyr bluetooth controler build tool:
```sh
sudo apt-get install python3 python3-venv python3-pip
```
## Build
There are 4 components to build:
1. Babblesim (the phy simulation)
2. Zephyr bluetooth controller (running on the Linux host and connected to babblesim)
3. NimBLE bluetooth host stack (built with Open IoT SDK running in the FVP)
4. HCI bridge (Linux application that connects the NimBLE Bluetooth Stack in the FVP to Linux's BlueZ)
The Zephyr controller requires babblesim to be built first.
### Using the top level build script
If your git environement is setup with a global name and address, you may use the top level build script directly:
```sh
. build.sh
```
If it isn't, you may set your git name and email globally with:
```sh
git config --global user.name "first_name last_name"
git config --global user.email "someone@something.com"
```
If you prefer not to set it, you'll need to run the config script in `babblesim/` manually first and then run the build script
```sh
cd babblesim
. config.sh
cd ..
. build.sh
```
### Manual build
If the build script fails, you'll need to clean then build each component individually to figure out the issue:
#### Install west
[zephyrproject.org](https://docs.zephyrproject.org/latest/develop/west/install.html)
```sh
python3 -m venv venv
source ./venv/bin/activate
pip3 install west pyelftools
```
#### Babblesim
The config script needs to be run as source because it sets a pair of environment variables that will be needed both to build zephyr and at runtime.<br>
You will have a missing include `fftw3.h` for one of the babblesim component. You may ignore it, we don't use that component and the build will skip it and build the others.
```sh
cd babblesim
. clean.sh
. config.sh
. build.sh
cd ..
```
#### Zephyr
```sh
cd zephyr_controller
. clean.sh
. build.sh
cd ..
```
#### NimBLE/IOT SDK
You need to be connected to the VPN to pull and build the IOT SDK
```sh
cd iot_sdk
. clean.sh
. config.sh
. build.sh
cd ..
```
#### HCI bridge
```sh
cd linux-side_bridge
. clean.sh
. build.sh
cd ..
```
## Run
You'll need 4 consoles:
1. Babblesim
The console running babblesim needs environment variables to be setup. If this is a new console, rerun the config script before running the simulation.
```sh
cd babblesim
. config.sh
. run.sh
```
This will run the Zephyr bluetooth controller alongside the babblesim simulation.<br>
Take note of the pseudotty used:
eg: `UART_0 connected to pseudotty: /dev/pts/5`
Please ignore the missing files during the initial cleanup
2. btattach
Use the pseudotty you got from babblesim
```sh
sudo btattach -P h4 -B /dev/pts/5 -S 1000000
```
Take note of the device ID:
eg: `Device index 1 attached`
Wait a few seconds before continuing until it attaches to the zephyr bluetooth controller application.<br>
If you want to be sure the `btattach` is complete you may monitor the traffic in another terminal with:
```sh
sudo btmon
```
3. HCI bridge
After waiting for btattach to finish, use as parameter the device ID you previously obtained
```sh
cd linux-side_bridge
sudo __build/bridge 1
```
4. NimBLE/IOT SDK
```sh
cd iot_sdk
. run.sh
```
You should first see some traffic in the terminal with the HCI bridge.
Eventually the terminal with babblesim should show a message (device address will vary):
`Device found: 2D:71:8F:C2:E4:6E (random) (RSSI -35)`
This is the Nimble device running in the FVP being detected by the observer device running in babblesim.
Terminate the programs in the reverse order they were started:
- NimBLE Host stack
- HCI bridge
- btattach
- Babblesim
Failure to do so may create zombie interfaces that will only be cleaned after a reboot.
This means in particular that your pts and device number may be different for each run.
# License and contributions
The software is provided under the Apache-2.0 license. All contributions to software and documents are licensed by contributors under the same license model as the software/document itself (ie. inbound == outbound licensing). Open IoT SDK may reuse software already licensed under another license, provided the license is permissive in nature and compatible with Apache v2.0.
Folders containing files under different permissive license than Apache 2.0 are listed in the LICENSE file.
Please see [CONTRIBUTING.md](CONTRIBUTING.md) for more information.
## Security issues reporting
If you find any security vulnerabilities, please do not report it in the GitLab issue tracker. Instead, send an email to the security team at arm-security@arm.com stating that you may have found a security vulnerability in the Open IoT SDK.
More details can be found at [Arm Developer website](https://developer.arm.com/support/arm-security-updates/report-security-vulnerabilities).