Skip to content

Commit 27c955a

Browse files
committed
Merge branch 'pr/735'
2 parents c095aa0 + a8f55d2 commit 27c955a

File tree

2 files changed

+38
-28
lines changed

2 files changed

+38
-28
lines changed

BUILD.md

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ The container will contain all tools needed to build the project but it is still
3535
the J-Link software to flash the bootloader. Run the commands below to build the container and
3636
execute a persistent one.
3737

38-
```
38+
```sh
3939
make dockerinit
4040
make dockerdev
4141
```
@@ -48,7 +48,7 @@ it is necessary to flash the device in a terminal not running in docker.
4848
Make sure you have [Homebrew](https://brew.sh) installed.
4949
Install the dependencies with:
5050

51-
```bash
51+
```sh
5252
brew install hidapi cmake protobuf
5353
brew install automake libtool # for building some code in the external/ folder
5454
brew tap osx-cross/arm
@@ -57,7 +57,7 @@ brew install arm-gcc-bin
5757

5858
Add the following directory in this repository to your `PATH` in `~/.bash_login`:
5959

60-
```bash
60+
```sh
6161
export PATH="$PATH:[…]/bitbox02-firmware/tools/nanopb/generator"
6262
```
6363

@@ -68,52 +68,60 @@ Connect the J-Link to the debug pins on the BitBox02 prototype board.
6868
Plug in both the J-Link hardware and the BitBox02 device into USB ports on your computer or a hub connected to your computer.
6969

7070
Build the firmware:
71-
```
71+
72+
```sh
7273
git clone --recurse-submodules https://github.com/digitalbitbox/bitbox02-firmware && cd bitbox02-firmware
7374
# or via ssh
7475
git clone --recurse-submodules [email protected]:digitalbitbox/bitbox02-firmware.git && cd bitbox02-firmware
7576
make firmware # requires a GNU ARM toolchain for cross-compiling
7677
```
7778

7879
If you have already cloned the repository without the `--recurse-submodules` argument, run:
79-
```
80+
81+
```sh
8082
git submodule update --init --recursive
8183
```
8284

8385
Build the bootloader:
84-
```
86+
87+
```sh
8588
make bootloader
8689
```
8790

8891
(to create a bootloader for a devdevice or a production device, use `make bootloader-devdevice` or
8992
`make bootloader-production` respectively).
9093

9194
Load the bootloader by JLink (requires JLinkExe in PATH).
92-
```
95+
96+
```sh
9397
make jlink-flash-bootloader
9498
```
9599

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.
97101

98102
Load the firmware by the bootloader (requires loading bootloader.bin by JLink, if not already loaded on the device):
99-
```
103+
104+
```sh
100105
make flash-dev-firmware
101106
```
102107

103108
Load the firmware by JLink:
104-
```
109+
110+
```sh
105111
make jlink-flash-firmware
106112
```
107113

108114
### Build reference documentation (Doxygen)
109115

110116
Dependencies:
111-
```
117+
118+
```sh
112119
brew install graphviz doxygen
113120
```
114121

115122
Build:
116-
```
123+
124+
```sh
117125
make docs
118126
```
119127

@@ -123,30 +131,30 @@ To view the results, open `build/docs/html/index.html` in a web browser.
123131

124132
There is a Python api library in `py/bitbox02`.
125133

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).
127135

128136
`make -C py/bitbox02` to generate the protobuf files.
129137

130138
To kick off some api calls:
131139

132-
```
140+
```sh
133141
./py/send_message.py
134142
```
135143

136144
### Unit tests
137145

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
139147
needs to be installed on your system.
140148

141149
If you're on a Mac, you can use the brew command to install it:
142150

143-
```
151+
```sh
144152
brew install cmocka
145153
```
146154

147155
Alternatively, you can get CMocka by cloning the git repository and following these instructions:
148156

149-
```
157+
```sh
150158
git clone git://git.cryptomilk.org/projects/cmocka.git
151159
cd cmocka
152160
mkdir build && cd build
@@ -157,25 +165,25 @@ make && sudo make install
157165
By default, the library will be installed into /usr/local/lib64 directory under Linux x86\_64.
158166
If the library is not on the library path by default, you might need to export the following environment variable:
159167

160-
```
168+
```sh
161169
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib64/
162170
```
163171

164172
Then you can run the tests by executing
165173

166-
```
174+
```sh
167175
make run-unit-tests # or make -C build-build test
168176
```
169177

170178
### Coverage
171179

172180
gcovr or lcov/genhtml can be used to generate HTML coverage reports using the following commands:
173181

174-
```
182+
```sh
175183
make coverage # or make -C build-build coverage
176184
```
177185

178-
```
186+
```sh
179187
make -C build-build coverage-lcovr
180188
```
181189

@@ -200,7 +208,7 @@ with the resulting `device-test.bin` that gets built into `test/device-test/buil
200208

201209
You can run `setup_test.py` as follows:
202210

203-
```
211+
```sh
204212
./test/device-test/setup_test.py -t test/device-test/src/startup_test.c
205213
```
206214

@@ -211,7 +219,7 @@ If you run it successfully, the device should print `Integration test` on the sc
211219
The test becomes more interesting as we add the ability to function in a python script.
212220
Here is an example for a python test:
213221

214-
```
222+
```python
215223
#!/usr/bin/env python
216224

217225
from setup_test import *

releases/README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ A valid signature means that the signer confirms that they could reproduce the b
4242
stated version tag.
4343

4444
You can check that the released signed firmware (usually named `firmware.vX.Y.Z.signed.bin`)
45-
contains the unsigned binary with:
45+
contains the unsigned binary with the following script (please install the [BitBox02 Python Library](../BUILD.md#BitBox02-Python-library) first):
4646

4747
```sh
4848
./describe_signed_firmware.py firmware.vX.Y.Z.signed.bin
@@ -74,7 +74,7 @@ the same result. Please open a PR to add your signed message confirming this. Si
7474
like this *only* confirms that you got the same result. It *does not* endorse the contents or
7575
quality of the binary itself.
7676

77-
### How to reproduce:
77+
### How to reproduce
7878

7979
Run `./build.sh <version tag> <make command>`, e.g.:
8080

@@ -90,12 +90,14 @@ When it successfully finishes, print the sha256 hash of the binary:
9090

9191
```sh
9292
# linux
93-
sha256sum temp/build/bin/firmware.bin
93+
sha256sum temp/build/bin/firmware.bin # multi edition firmware
94+
sha256sum temp/build/bin/firmware-btc.bin # bitcoin-only firmware
9495
# macOS
95-
shasum -a 256 temp/build/bin/firmware.bin
96+
shasum -a 256 temp/build/bin/firmware.bin # multi edition firmware
97+
shasum -a 256 temp/build/bin/firmware-btc.bin # bitcoin-only firmware
9698
```
9799

98-
**Contributing your signature**
100+
### Contributing your signature
99101

100102
Please inspect the `assertion.txt` in the relevant subfolder,
101103
e.g. [firmware-v4.1.0/assertion.txt](firmware-v4.1.0/assertion.txt). If you agree to its contents

0 commit comments

Comments
 (0)