Project

General

Profile

Flashing » History » Version 7

tsaitgaist, 09/04/2019 02:30 PM
update bossa installation reference

1 2 tsaitgaist
{{>toc}}
2
3 1 tsaitgaist
h1. Flashing
4
5 5 tsaitgaist
There are several ways to flash [[Wiki#Firmware|firmware images]], depending on your board, the image you want to flash, and the state of your device.
6 1 tsaitgaist
7 5 tsaitgaist
h1. SIMtrace2 board
8
9
This section will cover the flashing methods for the [[Wiki#SIMtrace v2|SIMtrace board]].
10
11 1 tsaitgaist
h2. DFU
12
13 5 tsaitgaist
*precondition*: a functioning application firmware or DFU bootloader must already be installed.
14 1 tsaitgaist
15 5 tsaitgaist
SIMtrace2 comes with a USB DFU bootloader pre-installed which allows to flash the application firmware over USB using the @dfu-util@ utility.
16
17
To check if you have a functioning application firmware or DFU bootloader, power the board:
18
* if both green and red LEDs are on, you should have a functioning application firmware
19
* if only the green LED is on, the application firmware is missing, but the DFU bootloader is present
20
* in case the application firmware is buggy, you can force the board to boot the DFU bootloader: on the board keep the *BOOTLOADER* button pressed while re-plugging the USB connector (pressing the *RESET* might not be sufficient)
21
!{width:20%}simtrace-board-buttons.jpg!
22
* if the USB DFU bootloader is missing, defective, or needs to be updated, use the JTAG or SAM-BA methods to flash the DFU bootloader.
23
24
To update the application firmware over the DFU bootloader, we will use @dfu-util@:
25
# get @dfu-util@:
26 1 tsaitgaist
<pre>
27
sudo apt-get install dfu-util
28
</pre>
29 5 tsaitgaist
# check if the board and DFU bootloader are detected:
30 1 tsaitgaist
<pre>
31 5 tsaitgaist
sudo dfu-util --list
32
...
33
Found Runtime: [1d50:60e3] ver=0002, devnum=20, cfg=1, intf=1, path="2-3.1", alt=0, name="UNKNOWN", serial="..."
34 1 tsaitgaist
</pre>
35 5 tsaitgaist
# get the "latest firmware":http://ftp.osmocom.org/binaries/simtrace2/firmware/latest or [[Wiki#Development|build it]]. Here we will use the _trace_ application firmware as example:
36 1 tsaitgaist
<pre>
37 5 tsaitgaist
wget https://ftp.osmocom.org/binaries/simtrace2/firmware/latest/simtrace-trace-dfu-latest.bin
38 1 tsaitgaist
</pre>
39 5 tsaitgaist
# flash the firmware using @dfu-util@:
40
<pre>
41
dfu-util --device 1d50:60e3 --cfg 1 --alt 1 --reset --download simtrace-trace-dfu-latest.bin
42
</pre>
43
# the green and red LED should turn on, showing the application firmware is flashed and started
44 3 tsaitgaist
45 5 tsaitgaist
h2. SAM-BA
46 1 tsaitgaist
47 5 tsaitgaist
The SAM3S micro-controller comes with an embedded bootloader called SAM-BA, allowing to flash firmware over USB.
48
The SAM-BA bootloader can be used to flash the DFU bootloader.
49 1 tsaitgaist
50 5 tsaitgaist
This method should be used if:
51
* no firmware is flashed on the device, or it has been erased (no LED turns on when the board is powered)
52
* the DFU bootloader is buggy
53
* you want to update the DFU bootloader
54 1 tsaitgaist
55 5 tsaitgaist
You can also activate the SAM-BA bootloader by erasing the flash content (this is not reversible):
56
# short the *ERASE* pin on the top of the board with the nearby 3V3 pin using a jumper or tweezers
57 1 tsaitgaist
!{width:20%}simtrace-jumper-mini.jpg!
58 5 tsaitgaist
# re-plug the USB connector and wait 1 second (pressing the *RESET* button is not sufficient)
59 1 tsaitgaist
# remove the jumper shorting *ERASE* to 3V3
60 5 tsaitgaist
# no LED should turn on
61
# to verify if the SAM-BA bootloader has been started:
62
** using @lsusb@ you should find the following entry:
63 1 tsaitgaist
<pre>
64 2 tsaitgaist
ID 03eb:6124 Atmel Corp. at91sam SAMBA bootloader
65
</pre>
66 5 tsaitgaist
** using @journalctl -f@ ensure the board has been recognized as USB ACM device:
67 2 tsaitgaist
<pre>
68
kernel: usb 2-2: new full-speed USB device number 4 using xhci_hcd
69
kernel: usb 2-2: New USB device found, idVendor=03eb, idProduct=6124
70
kernel: usb 2-2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
71 1 tsaitgaist
kernel: cdc_acm 2-2:1.0: ttyACM0: USB ACM device
72
kernel: usbcore: registered new interface driver cdc_acm
73
kernel: cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
74
</pre>
75
76 5 tsaitgaist
To flash using the SAM-BA bootloader:
77 7 tsaitgaist
# [[Flashing#Install-bossa|install bossa]]
78 5 tsaitgaist
# download the DFU bootloader:
79 1 tsaitgaist
<pre>
80 5 tsaitgaist
wget https://ftp.osmocom.org/binaries/simtrace2/firmware/latest/simtrace-dfu-flash-latest.bin
81 1 tsaitgaist
</pre>
82 5 tsaitgaist
# flash the USB DFU bootloader using @bossac@ (note: @erase@ ensures no main application remains so to force booting the USB DFU bootloader; @boot=1@ ensures the micro-controller will boot from the internal flash instead of the embedded bootloader next time it is powered up)
83
<pre>
84
sudo bossac --port=/dev/ttyACM0 --usb-port=1 --erase --verify --boot=1 --write simtrace-dfu-flash-latest.bin
85
</pre>
86
# re-plug the USB connector (be sure the *ERASE* pin is not shorted). If the DFU bootloader has been flashed correctly:
87
** only the green LED should be on
88
** the USB device should be listed as SIMtrace instead od SAMBA
89
<pre>
90
lsusb
91
...
92
Bus 002 Device 024: ID 1d50:60e3 OpenMoko, Inc. Osmocom SIMtrace 2
93
</pre>
94
** the DFU bootloader should be recognized:
95
<pre>
96
sudo dfu-util --list
97
...
98
Found DFU: [1d50:60e3] ver=0000, devnum=24, cfg=1, intf=0, path="2-3.1", alt=1, name="Flash (Application Partition)", serial="UNKNOWN"
99
Found DFU: [1d50:60e3] ver=0000, devnum=24, cfg=1, intf=0, path="2-3.1", alt=0, name="RAM", serial="UNKNOWN"
100
</pre>
101 1 tsaitgaist
102 5 tsaitgaist
Once the USB DFU bootloader is flashed, you can flash the application firmware using the [[Flashing#DFU|DFU]] method.
103
104
To prevent using @sudo@, grant to current user the permission to access USB serial devices (e.g. @/dev/ttyACM0@). Note: this change only takes effect after re-logging-in
105 1 tsaitgaist
<pre>
106
sudo adduser $USERNAME dialout
107
</pre>
108
109
h2. JTAG
110
111 5 tsaitgaist
It is also possible to flash he firmware over JTAG/SWD using the ARM 20-pin JTAG header on the top of the board.
112 1 tsaitgaist
113 5 tsaitgaist
This is mainly meant for [[Wiki#Development|development]] since it also allows to debug the firmware.
114
115 1 tsaitgaist
To flash the USB DFU firmware using JTAG:
116
# install the JTAG utility @openOCD@
117
<pre>
118
sudo apt install openocd
119
</pre>
120 5 tsaitgaist
# download the DFU bootloader:
121
<pre>
122
wget https://ftp.osmocom.org/binaries/simtrace2/firmware/latest/simtrace-dfu-flash-latest.bin
123
</pre>
124 1 tsaitgaist
# flash the USB DFU bootloader firmware
125
<pre>
126 5 tsaitgaist
openocd --file interface/jlink.cfg --file target/at91sam3sXX.cfg --command "init" --command "halt" --command "flash write_bank 0 simtrace-dfu-flash-latest.bin 0" --command "at91sam3 gpnvm set 1" --command "reset" --command "shutdown"
127 1 tsaitgaist
</pre>
128
#* replace @interface/jlink.cfg@ with the configuration file for your JTAG debugging adapter
129 5 tsaitgaist
#* @at91sam3 gpnvm set 1@ ensures the micro-controller will boot from the internal flash (i.e. not from the embedded SAM-BA bootloader)
130 1 tsaitgaist
131
The SAM3S also offers the low pin-count SWD alternative to JTAG, allowing to use an inexpensive ST-Link V2 (clone) to flash (and debug):
132
<pre>
133 5 tsaitgaist
openocd --file interface/stlink-v2.cfg --command "set CPUTAPID 0x2ba01477" --file target/at91sam3sXX.cfg --command "init" --command "halt" --command "flash write_bank 0 simtrace-dfu-flash-latest.bin 0" --command "at91sam3 gpnvm set 1" --command "reset" --command "shutdown"
134 1 tsaitgaist
</pre>
135
136
SWD pinout:
137
!{width:20%}simtrace_swd.jpg!
138
139 5 tsaitgaist
Once the USB DFU bootloader is flashed, after re-plugging the USB connector, you can flash the main application firmware using the DFU method.
140
141
h1. sysmoQMOD
142
143
This section will cover the flashing methods for the [[Wiki#sysmoQMOD|sysmoQMOD board]].
144
145
The sysmoQMOD has two SAM3S micro-controllers, each emulating the card for two modems:
146
* ST12 is the micro-controller on the right (when the power jack is on top), and emulates cards for the two right-most modems
147
* ST34 is the micro-controller on the left (when the power jack is on top), and emulates cards for the two left-most modems
148
* each card slot has one red LED nearby (e.g. two per micro-controllers) to show the status of the firmware
149
150
All the following procedures can be independently performed on each of the SAM3S micro-controllers, providing you use the corresponding USB path/device names.
151
152
h2. DFU
153
154
*precondition*: a functioning application firmware or DFU bootloader must already be installed.
155
156
sysmoQMOD comes with a USB DFU bootloader pre-installed which allows to flash the application firmware over USB using the @dfu-util@ utility.
157
158
To check if you have a functioning application firmware or DFU bootloader (per micro-controller and set of two modems/card slot), power the board:
159
* if both red LEDs are on, you should have a functioning application firmware
160
* if only one red LED is on, the application firmware is missing, but the DFU bootloader is present
161
* in case the application firmware is buggy, you can force the board to boot the DFU bootloader: short the TX and RX pins next to the micro-controller while powering the board.
162
!{width:20%}sysmoqmod-dfu.jpg!
163
* if the USB DFU bootloader is missing, use the SAM-BA method to flash the DFU bootloader.
164
165
To update the application firmware over the DFU bootloader, we will use @dfu-util@:
166
# get @dfu-util@:
167
<pre>
168
sudo apt-get install dfu-util
169
</pre>
170
# check if the board and DFU bootloader are detected (here for both micro-controllers):
171
<pre>
172
sudo dfu-util --list
173
...
174
Found Runtime: [1d50:4004] ver=0002, devnum=36, cfg=1, intf=2, path="2-2.1", alt=0, name="UNKNOWN", serial="UNKNOWN"
175
Found Runtime: [1d50:4004] ver=0002, devnum=37, cfg=1, intf=2, path="2-2.4", alt=0, name="UNKNOWN", serial="UNKNOWN"
176
</pre>
177
# get the "latest firmware":http://ftp.osmocom.org/binaries/simtrace2/firmware/latest or [[Wiki#Development|build it]].
178
<pre>
179
wget https://ftp.osmocom.org/binaries/simtrace2/firmware/latest/qmod-cardem-dfu-latest.bin
180
</pre>
181
# flash the firmware using @dfu-util@:
182
<pre>
183
dfu-util --device 1d50:4004 --cfg 1 --alt 1 --path "2-2.1" --reset --download qmod-cardem-dfu-latest.bin
184
</pre>
185
# both red LEDs should turn on, showing the application firmware is flashed and started
186
187
h2. SAM-BA
188
189
If none of the LEDs are on, the flash of the micro-controller might have been erased.
190
In this case, the SAM3S micro-controller should start the embedded bootloader called SAM-BA, allowing to flash firmware over USB.
191
The SAM-BA bootloader can be used to flash the DFU bootloader.
192
193
To verify if the SAM-BA bootloader has been started:
194
* using @lsusb@ you should find the following entry:
195
<pre>
196
ID 03eb:6124 Atmel Corp. at91sam SAMBA bootloader
197
</pre>
198
* using @journalctl -f@ ensure the board has been recognized as USB ACM device:
199
<pre>
200
kernel: usb 2-2: new full-speed USB device number 4 using xhci_hcd
201
kernel: usb 2-2: New USB device found, idVendor=03eb, idProduct=6124
202
kernel: usb 2-2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
203
kernel: cdc_acm 2-2:1.0: ttyACM0: USB ACM device
204
kernel: usbcore: registered new interface driver cdc_acm
205 1 tsaitgaist
kernel: cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
206 5 tsaitgaist
</pre>
207
208
To flash using the SAM-BA bootloader:
209 7 tsaitgaist
# [[Flashing#Install-bossa|install bossa]]
210 5 tsaitgaist
# download the DFU bootloader:
211
<pre>
212
wget https://ftp.osmocom.org/binaries/simtrace2/firmware/latest/qmod-dfu-flash-latest.bin
213
</pre>
214
# flash the USB DFU bootloader using @bossac@ (note: @erase@ ensures no main application remains so to force booting the USB DFU bootloader; @boot=1@ ensures the micro-controller will boot from the internal flash instead of the embedded bootloader next time it is powered up)
215
<pre>
216
sudo bossac --port=/dev/ttyACM0 --usb-port=1 --erase --verify --boot=1 --write qmod-dfu-flash-latest.bin
217
</pre>
218
# Re-power the board. If the DFU bootloader has been flashed correctly:
219
** only one red LED should be on
220
** the USB device should be listed as OpenMoko/"quad modem" instead of SAMBA
221
<pre>
222
lsusb
223
...
224
Bus 002 Device 024: ID 1d50:4004 OpenMoko, Inc.
225
</pre>
226
** the DFU bootloader should be recognized:
227
<pre>
228
sudo dfu-util --list
229
...
230
Found DFU: [1d50:4004] ver=0010, devnum=58, cfg=1, intf=0, path="2-2.4", alt=1, name="Flash (Application Partition)", serial="UNKNOWN"
231
Found DFU: [1d50:4004] ver=0010, devnum=58, cfg=1, intf=0, path="2-2.4", alt=0, name="RAM", serial="UNKNOWN"
232
</pre>
233
234
Once the USB DFU bootloader is flashed, you can flash the application firmware using the [[Flashing#DFU-2|DFU]] method.
235
236
To prevent using @sudo@, grant to current user the permission to access USB serial devices (e.g. @/dev/ttyACM0@). Note: this change only takes effect after re-logging-in
237
<pre>
238
sudo adduser $USERNAME dialout
239
</pre>
240
241
If no LED is on and the SAM-BA bootloader is not present, or you require to update the DFU bootloader, please contact the customer support of sysmocom.
242 6 tsaitgaist
243
h1. Install bossa
244
245
"BOSSA":https://github.com/shumatech/BOSSA is a flash programming utility for Atmel's SAM family of flash-based ARM microcontrollers.
246
It allows to flash the DFU bootloader on the SAM3S micro-controller used on the SIMtrace2 boards.
247
248
h2. Debian/Ubuntu
249
250
Debian (10, buster) and Ubuntu (19.04, disco) only provide pacjages for bossa-cli v1.3 from 2012 ("debian":https://packages.debian.org/buster/bossa-cli, "ubuntu":https://packages.ubuntu.com/disco/bossa-cli).
251
This is too old and does not support the SAM3S micro-controller used in SIMtrace2.
252
253
Thus you will have to install the current version of bossa (v1.9.1 from 2018-08 as of 2019-09):
254
# install the required libraries
255
<pre>
256
sudo apt install libwxgtk3.0-dev libreadline-dev
257
</pre>
258
# install required tools
259
<pre>
260
sudo apt install wget
261
</pre>
262
# get the current bossa
263
<pre>
264
wget https://github.com/shumatech/BOSSA/archive/1.9.1.tar.gz
265
</pre>
266
# decompress archive
267
<pre>
268
tar xf 1.9.1.tar.gz
269
</pre>
270
# compile bossa
271
<pre>
272
cd BOSSA-1.9.1/
273
make
274
</pre>
275
# install the bossa command line tool to your system (bossa does not provide install scripts)
276
<pre>
277
sudo cp bin/bossa* /usr/local/bin/
278
</pre>
279
# clean up
280
<pre>
281
cd ..
282
rm -r BOSSA-1.9.1/
283
rm 1.9.1.tar.gz
284
</pre>
285
286
h2. Arch
287
288
Install the "AUR":https://wiki.archlinux.org/index.php/AUR package "bossa":https://aur.archlinux.org/packages/bossa/ (v1.9.1 from 2018-08 as of 2019-09).
289
<pre>
290
pacaur -S bossa
291
</pre>
Add picture from clipboard (Maximum size: 48.8 MB)