Project

General

Profile

Flashing » History » Version 7

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

1 2 tsaitgaist
{{>toc}}
2 2 tsaitgaist
3 1 tsaitgaist
h1. Flashing
4 1 tsaitgaist
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 5 tsaitgaist
9 5 tsaitgaist
This section will cover the flashing methods for the [[Wiki#SIMtrace v2|SIMtrace board]].
10 5 tsaitgaist
11 1 tsaitgaist
h2. DFU
12 1 tsaitgaist
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 5 tsaitgaist
17 5 tsaitgaist
To check if you have a functioning application firmware or DFU bootloader, power the board:
18 5 tsaitgaist
* if both green and red LEDs are on, you should have a functioning application firmware
19 5 tsaitgaist
* if only the green LED is on, the application firmware is missing, but the DFU bootloader is present
20 5 tsaitgaist
* 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 5 tsaitgaist
!{width:20%}simtrace-board-buttons.jpg!
22 5 tsaitgaist
* 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 5 tsaitgaist
24 5 tsaitgaist
To update the application firmware over the DFU bootloader, we will use @dfu-util@:
25 5 tsaitgaist
# get @dfu-util@:
26 1 tsaitgaist
<pre>
27 1 tsaitgaist
sudo apt-get install dfu-util
28 1 tsaitgaist
</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 5 tsaitgaist
...
33 5 tsaitgaist
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 5 tsaitgaist
<pre>
41 5 tsaitgaist
dfu-util --device 1d50:60e3 --cfg 1 --alt 1 --reset --download simtrace-trace-dfu-latest.bin
42 5 tsaitgaist
</pre>
43 5 tsaitgaist
# 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 5 tsaitgaist
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 5 tsaitgaist
* no firmware is flashed on the device, or it has been erased (no LED turns on when the board is powered)
52 5 tsaitgaist
* the DFU bootloader is buggy
53 5 tsaitgaist
* 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 5 tsaitgaist
# 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 5 tsaitgaist
# to verify if the SAM-BA bootloader has been started:
62 5 tsaitgaist
** using @lsusb@ you should find the following entry:
63 1 tsaitgaist
<pre>
64 2 tsaitgaist
ID 03eb:6124 Atmel Corp. at91sam SAMBA bootloader
65 2 tsaitgaist
</pre>
66 5 tsaitgaist
** using @journalctl -f@ ensure the board has been recognized as USB ACM device:
67 2 tsaitgaist
<pre>
68 2 tsaitgaist
kernel: usb 2-2: new full-speed USB device number 4 using xhci_hcd
69 2 tsaitgaist
kernel: usb 2-2: New USB device found, idVendor=03eb, idProduct=6124
70 2 tsaitgaist
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 1 tsaitgaist
kernel: usbcore: registered new interface driver cdc_acm
73 1 tsaitgaist
kernel: cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
74 1 tsaitgaist
</pre>
75 1 tsaitgaist
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 5 tsaitgaist
<pre>
84 5 tsaitgaist
sudo bossac --port=/dev/ttyACM0 --usb-port=1 --erase --verify --boot=1 --write simtrace-dfu-flash-latest.bin
85 5 tsaitgaist
</pre>
86 5 tsaitgaist
# re-plug the USB connector (be sure the *ERASE* pin is not shorted). If the DFU bootloader has been flashed correctly:
87 5 tsaitgaist
** only the green LED should be on
88 5 tsaitgaist
** the USB device should be listed as SIMtrace instead od SAMBA
89 5 tsaitgaist
<pre>
90 5 tsaitgaist
lsusb
91 5 tsaitgaist
...
92 5 tsaitgaist
Bus 002 Device 024: ID 1d50:60e3 OpenMoko, Inc. Osmocom SIMtrace 2
93 5 tsaitgaist
</pre>
94 5 tsaitgaist
** the DFU bootloader should be recognized:
95 5 tsaitgaist
<pre>
96 5 tsaitgaist
sudo dfu-util --list
97 5 tsaitgaist
...
98 5 tsaitgaist
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 5 tsaitgaist
Found DFU: [1d50:60e3] ver=0000, devnum=24, cfg=1, intf=0, path="2-3.1", alt=0, name="RAM", serial="UNKNOWN"
100 5 tsaitgaist
</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 5 tsaitgaist
104 5 tsaitgaist
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 1 tsaitgaist
sudo adduser $USERNAME dialout
107 1 tsaitgaist
</pre>
108 1 tsaitgaist
109 1 tsaitgaist
h2. JTAG
110 1 tsaitgaist
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 5 tsaitgaist
115 1 tsaitgaist
To flash the USB DFU firmware using JTAG:
116 1 tsaitgaist
# install the JTAG utility @openOCD@
117 1 tsaitgaist
<pre>
118 1 tsaitgaist
sudo apt install openocd
119 1 tsaitgaist
</pre>
120 5 tsaitgaist
# download the DFU bootloader:
121 5 tsaitgaist
<pre>
122 5 tsaitgaist
wget https://ftp.osmocom.org/binaries/simtrace2/firmware/latest/simtrace-dfu-flash-latest.bin
123 5 tsaitgaist
</pre>
124 1 tsaitgaist
# flash the USB DFU bootloader firmware
125 1 tsaitgaist
<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 1 tsaitgaist
#* 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 1 tsaitgaist
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 1 tsaitgaist
<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 1 tsaitgaist
136 1 tsaitgaist
SWD pinout:
137 1 tsaitgaist
!{width:20%}simtrace_swd.jpg!
138 1 tsaitgaist
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 5 tsaitgaist
141 5 tsaitgaist
h1. sysmoQMOD
142 5 tsaitgaist
143 5 tsaitgaist
This section will cover the flashing methods for the [[Wiki#sysmoQMOD|sysmoQMOD board]].
144 5 tsaitgaist
145 5 tsaitgaist
The sysmoQMOD has two SAM3S micro-controllers, each emulating the card for two modems:
146 5 tsaitgaist
* 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 5 tsaitgaist
* 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 5 tsaitgaist
* each card slot has one red LED nearby (e.g. two per micro-controllers) to show the status of the firmware
149 5 tsaitgaist
150 5 tsaitgaist
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 5 tsaitgaist
152 5 tsaitgaist
h2. DFU
153 5 tsaitgaist
154 5 tsaitgaist
*precondition*: a functioning application firmware or DFU bootloader must already be installed.
155 5 tsaitgaist
156 5 tsaitgaist
sysmoQMOD comes with a USB DFU bootloader pre-installed which allows to flash the application firmware over USB using the @dfu-util@ utility.
157 5 tsaitgaist
158 5 tsaitgaist
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 5 tsaitgaist
* if both red LEDs are on, you should have a functioning application firmware
160 5 tsaitgaist
* if only one red LED is on, the application firmware is missing, but the DFU bootloader is present
161 5 tsaitgaist
* 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 5 tsaitgaist
!{width:20%}sysmoqmod-dfu.jpg!
163 5 tsaitgaist
* if the USB DFU bootloader is missing, use the SAM-BA method to flash the DFU bootloader.
164 5 tsaitgaist
165 5 tsaitgaist
To update the application firmware over the DFU bootloader, we will use @dfu-util@:
166 5 tsaitgaist
# get @dfu-util@:
167 5 tsaitgaist
<pre>
168 5 tsaitgaist
sudo apt-get install dfu-util
169 5 tsaitgaist
</pre>
170 5 tsaitgaist
# check if the board and DFU bootloader are detected (here for both micro-controllers):
171 5 tsaitgaist
<pre>
172 5 tsaitgaist
sudo dfu-util --list
173 5 tsaitgaist
...
174 5 tsaitgaist
Found Runtime: [1d50:4004] ver=0002, devnum=36, cfg=1, intf=2, path="2-2.1", alt=0, name="UNKNOWN", serial="UNKNOWN"
175 5 tsaitgaist
Found Runtime: [1d50:4004] ver=0002, devnum=37, cfg=1, intf=2, path="2-2.4", alt=0, name="UNKNOWN", serial="UNKNOWN"
176 5 tsaitgaist
</pre>
177 5 tsaitgaist
# get the "latest firmware":http://ftp.osmocom.org/binaries/simtrace2/firmware/latest or [[Wiki#Development|build it]].
178 5 tsaitgaist
<pre>
179 5 tsaitgaist
wget https://ftp.osmocom.org/binaries/simtrace2/firmware/latest/qmod-cardem-dfu-latest.bin
180 5 tsaitgaist
</pre>
181 5 tsaitgaist
# flash the firmware using @dfu-util@:
182 5 tsaitgaist
<pre>
183 5 tsaitgaist
dfu-util --device 1d50:4004 --cfg 1 --alt 1 --path "2-2.1" --reset --download qmod-cardem-dfu-latest.bin
184 5 tsaitgaist
</pre>
185 5 tsaitgaist
# both red LEDs should turn on, showing the application firmware is flashed and started
186 5 tsaitgaist
187 5 tsaitgaist
h2. SAM-BA
188 5 tsaitgaist
189 5 tsaitgaist
If none of the LEDs are on, the flash of the micro-controller might have been erased.
190 5 tsaitgaist
In this case, the SAM3S micro-controller should start the embedded bootloader called SAM-BA, allowing to flash firmware over USB.
191 5 tsaitgaist
The SAM-BA bootloader can be used to flash the DFU bootloader.
192 5 tsaitgaist
193 5 tsaitgaist
To verify if the SAM-BA bootloader has been started:
194 5 tsaitgaist
* using @lsusb@ you should find the following entry:
195 5 tsaitgaist
<pre>
196 5 tsaitgaist
ID 03eb:6124 Atmel Corp. at91sam SAMBA bootloader
197 5 tsaitgaist
</pre>
198 5 tsaitgaist
* using @journalctl -f@ ensure the board has been recognized as USB ACM device:
199 5 tsaitgaist
<pre>
200 5 tsaitgaist
kernel: usb 2-2: new full-speed USB device number 4 using xhci_hcd
201 5 tsaitgaist
kernel: usb 2-2: New USB device found, idVendor=03eb, idProduct=6124
202 5 tsaitgaist
kernel: usb 2-2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
203 5 tsaitgaist
kernel: cdc_acm 2-2:1.0: ttyACM0: USB ACM device
204 5 tsaitgaist
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 5 tsaitgaist
208 5 tsaitgaist
To flash using the SAM-BA bootloader:
209 7 tsaitgaist
# [[Flashing#Install-bossa|install bossa]]
210 5 tsaitgaist
# download the DFU bootloader:
211 5 tsaitgaist
<pre>
212 5 tsaitgaist
wget https://ftp.osmocom.org/binaries/simtrace2/firmware/latest/qmod-dfu-flash-latest.bin
213 5 tsaitgaist
</pre>
214 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)
215 5 tsaitgaist
<pre>
216 5 tsaitgaist
sudo bossac --port=/dev/ttyACM0 --usb-port=1 --erase --verify --boot=1 --write qmod-dfu-flash-latest.bin
217 5 tsaitgaist
</pre>
218 5 tsaitgaist
# Re-power the board. If the DFU bootloader has been flashed correctly:
219 5 tsaitgaist
** only one red LED should be on
220 5 tsaitgaist
** the USB device should be listed as OpenMoko/"quad modem" instead of SAMBA
221 5 tsaitgaist
<pre>
222 5 tsaitgaist
lsusb
223 5 tsaitgaist
...
224 5 tsaitgaist
Bus 002 Device 024: ID 1d50:4004 OpenMoko, Inc.
225 5 tsaitgaist
</pre>
226 5 tsaitgaist
** the DFU bootloader should be recognized:
227 5 tsaitgaist
<pre>
228 5 tsaitgaist
sudo dfu-util --list
229 5 tsaitgaist
...
230 5 tsaitgaist
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 5 tsaitgaist
Found DFU: [1d50:4004] ver=0010, devnum=58, cfg=1, intf=0, path="2-2.4", alt=0, name="RAM", serial="UNKNOWN"
232 5 tsaitgaist
</pre>
233 5 tsaitgaist
234 5 tsaitgaist
Once the USB DFU bootloader is flashed, you can flash the application firmware using the [[Flashing#DFU-2|DFU]] method.
235 5 tsaitgaist
236 5 tsaitgaist
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 5 tsaitgaist
<pre>
238 5 tsaitgaist
sudo adduser $USERNAME dialout
239 5 tsaitgaist
</pre>
240 5 tsaitgaist
241 5 tsaitgaist
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 6 tsaitgaist
h1. Install bossa
244 6 tsaitgaist
245 6 tsaitgaist
"BOSSA":https://github.com/shumatech/BOSSA is a flash programming utility for Atmel's SAM family of flash-based ARM microcontrollers.
246 6 tsaitgaist
It allows to flash the DFU bootloader on the SAM3S micro-controller used on the SIMtrace2 boards.
247 6 tsaitgaist
248 6 tsaitgaist
h2. Debian/Ubuntu
249 6 tsaitgaist
250 6 tsaitgaist
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 6 tsaitgaist
This is too old and does not support the SAM3S micro-controller used in SIMtrace2.
252 6 tsaitgaist
253 6 tsaitgaist
Thus you will have to install the current version of bossa (v1.9.1 from 2018-08 as of 2019-09):
254 6 tsaitgaist
# install the required libraries
255 6 tsaitgaist
<pre>
256 6 tsaitgaist
sudo apt install libwxgtk3.0-dev libreadline-dev
257 6 tsaitgaist
</pre>
258 6 tsaitgaist
# install required tools
259 6 tsaitgaist
<pre>
260 6 tsaitgaist
sudo apt install wget
261 6 tsaitgaist
</pre>
262 6 tsaitgaist
# get the current bossa
263 6 tsaitgaist
<pre>
264 6 tsaitgaist
wget https://github.com/shumatech/BOSSA/archive/1.9.1.tar.gz
265 6 tsaitgaist
</pre>
266 6 tsaitgaist
# decompress archive
267 6 tsaitgaist
<pre>
268 6 tsaitgaist
tar xf 1.9.1.tar.gz
269 6 tsaitgaist
</pre>
270 6 tsaitgaist
# compile bossa
271 6 tsaitgaist
<pre>
272 6 tsaitgaist
cd BOSSA-1.9.1/
273 6 tsaitgaist
make
274 6 tsaitgaist
</pre>
275 6 tsaitgaist
# install the bossa command line tool to your system (bossa does not provide install scripts)
276 6 tsaitgaist
<pre>
277 6 tsaitgaist
sudo cp bin/bossa* /usr/local/bin/
278 6 tsaitgaist
</pre>
279 6 tsaitgaist
# clean up
280 6 tsaitgaist
<pre>
281 6 tsaitgaist
cd ..
282 6 tsaitgaist
rm -r BOSSA-1.9.1/
283 6 tsaitgaist
rm 1.9.1.tar.gz
284 6 tsaitgaist
</pre>
285 6 tsaitgaist
286 6 tsaitgaist
h2. Arch
287 6 tsaitgaist
288 6 tsaitgaist
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 6 tsaitgaist
<pre>
290 6 tsaitgaist
pacaur -S bossa
291 6 tsaitgaist
</pre>
Add picture from clipboard (Maximum size: 48.8 MB)