@@ -35,7 +35,7 @@ The container will contain all tools needed to build the project but it is still
35
35
the J-Link software to flash the bootloader. Run the commands below to build the container and
36
36
execute a persistent one.
37
37
38
- ```
38
+ ``` sh
39
39
make dockerinit
40
40
make dockerdev
41
41
```
@@ -48,7 +48,7 @@ it is necessary to flash the device in a terminal not running in docker.
48
48
Make sure you have [ Homebrew] ( https://brew.sh ) installed.
49
49
Install the dependencies with:
50
50
51
- ``` bash
51
+ ``` sh
52
52
brew install hidapi cmake protobuf
53
53
brew install automake libtool # for building some code in the external/ folder
54
54
brew tap osx-cross/arm
@@ -57,7 +57,7 @@ brew install arm-gcc-bin
57
57
58
58
Add the following directory in this repository to your ` PATH ` in ` ~/.bash_login ` :
59
59
60
- ``` bash
60
+ ``` sh
61
61
export PATH=" $PATH :[…]/bitbox02-firmware/tools/nanopb/generator"
62
62
```
63
63
@@ -68,52 +68,60 @@ Connect the J-Link to the debug pins on the BitBox02 prototype board.
68
68
Plug in both the J-Link hardware and the BitBox02 device into USB ports on your computer or a hub connected to your computer.
69
69
70
70
Build the firmware:
71
- ```
71
+
72
+ ``` sh
72
73
git clone --recurse-submodules https://github.com/digitalbitbox/bitbox02-firmware && cd bitbox02-firmware
73
74
# or via ssh
74
75
git clone --recurse-submodules
[email protected] :digitalbitbox/bitbox02-firmware.git
&& cd bitbox02-firmware
75
76
make firmware # requires a GNU ARM toolchain for cross-compiling
76
77
```
77
78
78
79
If you have already cloned the repository without the ` --recurse-submodules ` argument, run:
79
- ```
80
+
81
+ ``` sh
80
82
git submodule update --init --recursive
81
83
```
82
84
83
85
Build the bootloader:
84
- ```
86
+
87
+ ``` sh
85
88
make bootloader
86
89
```
87
90
88
91
(to create a bootloader for a devdevice or a production device, use ` make bootloader-devdevice ` or
89
92
` make bootloader-production ` respectively).
90
93
91
94
Load the bootloader by JLink (requires JLinkExe in PATH).
92
- ```
95
+
96
+ ``` sh
93
97
make jlink-flash-bootloader
94
98
```
95
99
96
- You need to install the [ BitBox02 Python Library] ( py/README.md ) before you can flash the built firmware.
100
+ You need to install the [ BitBox02 Python Library] ( #BitBox02-Python-library ) before you can flash the built firmware.
97
101
98
102
Load the firmware by the bootloader (requires loading bootloader.bin by JLink, if not already loaded on the device):
99
- ```
103
+
104
+ ``` sh
100
105
make flash-dev-firmware
101
106
```
102
107
103
108
Load the firmware by JLink:
104
- ```
109
+
110
+ ``` sh
105
111
make jlink-flash-firmware
106
112
```
107
113
108
114
### Build reference documentation (Doxygen)
109
115
110
116
Dependencies:
111
- ```
117
+
118
+ ``` sh
112
119
brew install graphviz doxygen
113
120
```
114
121
115
122
Build:
116
- ```
123
+
124
+ ``` sh
117
125
make docs
118
126
```
119
127
@@ -123,30 +131,30 @@ To view the results, open `build/docs/html/index.html` in a web browser.
123
131
124
132
There is a Python api library in ` py/bitbox02 ` .
125
133
126
- Run ` pip install -r py/requirements.txt -r py/bitbox02/requirements.txt ` to install the deps (virtualenv recommended).
134
+ Run ` pip install -r py/requirements.txt ` to install the deps (virtualenv recommended).
127
135
128
136
` make -C py/bitbox02 ` to generate the protobuf files.
129
137
130
138
To kick off some api calls:
131
139
132
- ```
140
+ ``` sh
133
141
./py/send_message.py
134
142
```
135
143
136
144
### Unit tests
137
145
138
- We are using CMocka (https://cmocka.org/ ) for unit tests. To run the tests, the CMocka library
146
+ We are using CMocka [ https://cmocka.org/ ] ( https://cmocka.org/ ) for unit tests. To run the tests, the CMocka library
139
147
needs to be installed on your system.
140
148
141
149
If you're on a Mac, you can use the brew command to install it:
142
150
143
- ```
151
+ ``` sh
144
152
brew install cmocka
145
153
```
146
154
147
155
Alternatively, you can get CMocka by cloning the git repository and following these instructions:
148
156
149
- ```
157
+ ``` sh
150
158
git clone git://git.cryptomilk.org/projects/cmocka.git
151
159
cd cmocka
152
160
mkdir build && cd build
@@ -157,25 +165,25 @@ make && sudo make install
157
165
By default, the library will be installed into /usr/local/lib64 directory under Linux x86\_ 64.
158
166
If the library is not on the library path by default, you might need to export the following environment variable:
159
167
160
- ```
168
+ ``` sh
161
169
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH} :/usr/local/lib64/
162
170
```
163
171
164
172
Then you can run the tests by executing
165
173
166
- ```
174
+ ``` sh
167
175
make run-unit-tests # or make -C build-build test
168
176
```
169
177
170
178
### Coverage
171
179
172
180
gcovr or lcov/genhtml can be used to generate HTML coverage reports using the following commands:
173
181
174
- ```
182
+ ``` sh
175
183
make coverage # or make -C build-build coverage
176
184
```
177
185
178
- ```
186
+ ``` sh
179
187
make -C build-build coverage-lcovr
180
188
```
181
189
@@ -200,7 +208,7 @@ with the resulting `device-test.bin` that gets built into `test/device-test/buil
200
208
201
209
You can run ` setup_test.py ` as follows:
202
210
203
- ```
211
+ ``` sh
204
212
./test/device-test/setup_test.py -t test/device-test/src/startup_test.c
205
213
```
206
214
@@ -211,7 +219,7 @@ If you run it successfully, the device should print `Integration test` on the sc
211
219
The test becomes more interesting as we add the ability to function in a python script.
212
220
Here is an example for a python test:
213
221
214
- ```
222
+ ``` python
215
223
# !/usr/bin/env python
216
224
217
225
from setup_test import *
0 commit comments