how-to-flash.rst 2.48 KB
Newer Older
Rahix's avatar
Rahix committed
1
2
3
4
5
6
7
8
9
10
11
12
13
How To Flash
============
Depending on whether you have a debugger or not, you have to use a different
method of flashing:

Flash Without Debugger
----------------------
If you do not have a debugger, you have to update the firmware using our
bootloader.  To do so, you need to reboot card10 while keeping the buttom on
the bottom right pressed.  Rebooting is done by either short pressing the power
button (top left) while you have a working firmware, or turning the card10 off
completely (by pressing the power button for 8 seconds) and then starting it again.

Rahix's avatar
Rahix committed
14
.. image:: static/bootloader-buttons.png
Rahix's avatar
Rahix committed
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

If you did everything correctly, the bootloader will display:

.. code-block:: text

   Bootloader
   Jul 12 2019
   USB activated.
    Waiting.

On your host, you should now see an 8MB flash-device appear.  You can now drop
the firmware's ``.bin`` (from ``build/pycardium/pycardium_epicardium.bin`` in
most cases) into this flash-storage.  You **must** call the file ``card10.bin``
for the bootloader to use it.

Afterwards **eject** the flash device and reboot card10.  You should now see
your new firmware boot up!

.. warning::

   **You must EJECT the flash device!**  ``umount`` & ``sync`` is **not**
   enough and will result in the bootloader not loading the new binary.

Flash Using Debugger
--------------------

.. warning::

   With the current version of the bootloader, before attempting to flash using
schneider's avatar
schneider committed
44
   the debugger, make sure there is no ``card10.bin`` stored on the device.
Rahix's avatar
Rahix committed
45
46
47
48
49
50
51
52
   If there is, the bootloader will overwrite whatever you just flashed after
   reboot every time.

First, setup everything as explained on the :ref:`debugger` page.  Following
that and after connecting to card10, you can flash your binary using the
``load`` command.  After loading, you need to use ``reset`` to reboot card10
using your new firmware.

schneider's avatar
schneider committed
53
54
55
56
57
58
59
60
61
62

.. info::
   If OpenOCD was able to connect, but GDB gives you an
   ``Error erasing flash with vFlashErase packet`` error, issue a ``reset``
   command, quickly followed by a ``load`` command.

   Reason: The Epicardium puts parts of the CPU to sleep and the debugging
   interface is part of that. After a reset the bootloader starts up
   and lets OpenOCD/GDB take control again.

Rahix's avatar
Rahix committed
63
64
65
66
67
68
69
70
71
.. code-block:: text

   (gdb) load
   Loading section .text, size 0x12514 lma 0x10010000
   Loading section .ARM.exidx, size 0x8 lma 0x10022514
   Loading section .data, size 0x8d8 lma 0x1002251c
   Start address 0x10012160, load size 77300
   Transfer rate: 19 KB/sec, 11042 bytes/write.
   (gdb)