1 |
ffcfa587
|
Harald Welte
|
This builds a USB DFU compatible boot loader for sam3u based boards.
|
2 |
|
|
|
3 |
|
|
try
|
4 |
|
|
make BOARD=at91sam3u-ek
|
5 |
|
|
or
|
6 |
|
|
make BOARD=osmo-sdr
|
7 |
|
|
depending on your board type.
|
8 |
|
|
|
9 |
|
|
The result is a < 16kBytes file in the ./bin/ subdirectory, which you can
|
10 |
|
|
flash using JTAG, SAM-BA or rum-ba to the beginning of FLASH0.
|
11 |
|
|
|
12 |
|
|
The DFU loader will check in early boot if the "DFU button" is set. If yes,
|
13 |
|
|
it will enter the DFU mode, if not it continuest to boot directly the
|
14 |
|
|
application.
|
15 |
|
|
|
16 |
|
|
DFU button mappings:
|
17 |
|
|
at91sam3u-ek: Button marked PB-LEFT on the board
|
18 |
|
|
osmo-sdr: PA12 (can be closed with a jumper on the header)
|
19 |
|
|
|
20 |
|
|
The regular application program can change from run-time to DFU mode quite
|
21 |
|
|
easily. In fact, this happens using a standardized USB control request and is
|
22 |
|
|
thus already implemented in the at91lib.git on git.gnumonks.org.
|
23 |
|
|
|
24 |
|
|
You can switch the device from runtime into DFU mode using
|
25 |
|
|
dfu-util -e -d 0x16c0:0x0763
|
26 |
|
|
|
27 |
|
|
After that, you can flash a new application image into the respective partition using
|
28 |
|
|
dfu-util -d 0x16c0:0x0763 -a0 -D ./bin/my-foobar-project-dfu.bin
|
29 |
|
|
|
30 |
|
|
which should show something like:
|
31 |
|
|
|
32 |
|
|
Opening DFU capable USB device... ID 16c0:0763
|
33 |
|
|
Run-time device DFU version 0100
|
34 |
|
|
Found DFU: [16c0:0763] devnum=0, cfg=1, intf=0, alt=0, name="OsmoSDR DFU Interface - Application Partition"
|
35 |
|
|
[...]
|
36 |
|
|
Starting download: [##################################################] finished!
|
37 |
|
|
state(7) = dfuMANIFEST, status(0) = No error condition is present
|
38 |
|
|
state(2) = dfuIDLE, status(0) = No error condition is present
|
39 |
|
|
|
40 |
|
|
|
41 |
|
|
However, that application has to be built using a compatible linker script.
|
42 |
|
|
|
43 |
|
|
building application firmware for DFU
|
44 |
|
|
=====================================
|
45 |
|
|
|
46 |
|
|
This needs a special linker script which is implemented as dfu.lds in the
|
47 |
|
|
at91lib repository on git.gnumonks.org. You can then build your project to
|
48 |
|
|
get linked to the "application partition" using
|
49 |
|
|
make dfu
|
50 |
|
|
in the respective project directory
|
51 |
|
|
|
52 |
|
|
There is a 'usb-fast-audi-source' project that can be used for demonstration
|
53 |
|
|
purpose, it has 'make BOARD=osmo-sdr dfu' support
|