Skip to content

Commit 546a263

Browse files
authored
Merge pull request #39 from chargebyte/everest/csom_generic_firmware
Charge SOM: Add firmware chapter
2 parents c845ebc + 4837bb0 commit 546a263

9 files changed

+490
-0
lines changed
-40.2 KB
Binary file not shown.
19.3 KB
Loading
Binary file not shown.
Loading

docs/source/firmware.rst

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
.. _firmware.rst:
2+
3+
.. include:: ../../includes/firmware_upgrade.inc
4+
5+
6+
Partitioning
7+
-------------
8+
9+
The internal eMMC storage of a chargebyte device is divided into several partitions to support two independent systems: system A and system B. This setup enables firmware updates to run in the background while the device continues normal charging operations. Once the update is complete, the system can switch to the updated version with a reboot of the device. Additionally, this approach supports a rollback mechanism in case of update failures. In other words, during a firmware update, the active root file system switches from A to B (or vice versa), leaving the other partition available for rollback if needed.
10+
11+
.. list-table:: eMMC Partitioning
12+
:header-rows: 1
13+
:widths: 20 10 50
14+
15+
* - Partition
16+
- Size
17+
- Description
18+
* - /dev/mmcblk0p1
19+
- 2 GB
20+
- Root file system A
21+
* - /dev/mmcblk0p2
22+
- 2 GB
23+
- Root file system B
24+
* - /dev/mmcblk0p3
25+
- 3.3 GB
26+
- Extended Partition Container
27+
* - /dev/mmcblk0p5
28+
- 2.8 GB
29+
- Data Partition (/srv). This partition can be accessed by both root file systems and will be not changed during update process.
30+
* - /dev/mmcblk0p6
31+
- 256 MB
32+
- Logging file system A (/var/log)
33+
* - /dev/mmcblk0p7
34+
- 256 MB
35+
- Logging file system B (/var/log)
36+
37+
.. image:: ../../includes/_static/images/mountpoints.svg
38+
:alt: Filesystem-Mountpoints
39+
:align: center
40+
41+
.. adding a center-aligned caption for the image
42+
.. raw:: html
43+
44+
<div style="text-align: center;">
45+
Filesystem Mountpoints
46+
</div>
47+
48+
.. include:: ../../includes/firmware_programming.inc

docs/source/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Charge SOM Evaluation Kit.
2020
:caption: Contents:
2121

2222
getting_started
23+
firmware
2324
everest_charging_stack
2425
cb_energy
2526
development

includes/firmware_programming.inc

+342
Large diffs are not rendered by default.

includes/firmware_upgrade.inc

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
********
2+
Firmware
3+
********
4+
5+
Introduction to Yocto
6+
=====================
7+
8+
chargebyte hardware platforms are shipped with pre-flashed firmware including one of the following charging stacks:
9+
10+
* EVerest charging stack along with platform specific EVerest modules e.g. CbSystem.
11+
* chargebyte's proprietary charging stack (only available for Charge Control C)
12+
13+
The shipped firmware was created using the Yocto project; an open-source collaboration initiative that provides templates, tools, and methods to help developers create custom Linux-based systems for embedded devices. It supports a wide range of hardware architectures and provides a consistent, reproducible environment for developing, building, and maintaining embedded systems. To get familiar with the Yocto project, you can find all the required information on the project's `website <https://www.yoctoproject.org/>`_.
14+
15+
.. _firmware_update:
16+
17+
Firmware Upgrade
18+
================
19+
20+
The following sections describe different ways to install a firmware upgrade on your chargebyte product. Please ensure that the power supply is stable during a firmware upgrade. In case of an unsuccessful update or of power loss during the installation of the update, the chargebyte device performs a rollback to the previous stable version of the charging firmware. For more information about the rollback mechanism, see the section :ref:`rollback_mechanism`. The update is finished when the board is rebooted.
21+
22+
The currently installed firmware version can be checked by reading the content of the file :code:`VERSION` found under :code:`/usr/share/secc`.
23+
24+
.. _download_firmware_images:
25+
26+
Download EVerest Firmware Images
27+
--------------------------------
28+
29+
EVerest firmware images are released by chargebyte on our meta-chargebyte-everest repository, which is the Yocto layer to build the firmware images.
30+
The image files can be found in the `"Release" section <https://github.com/chargebyte/meta-chargebyte-everest/releases>`_ of the
31+
repository. Here you can find the latest firmware images and also older released versions.
32+
33+
.. note::
34+
35+
Please read the release notes of the firmware image before downloading and installing it. In the
36+
release notes you can find information about the changes and new features of the firmware image and
37+
also the version information which "everest-core" tag the firmware image is based on. This information
38+
is especially important if you build up your cross-compile environment in section :ref:`cross_compiling`.
39+
Please check that your cross-compile environment is using the same "everest-core" tag as the firmware
40+
image you want to install.
41+
42+
Device Access
43+
-------------
44+
45+
There are different possibilities to access the device for configuration or update purposes. Please look at section :ref:`connecting-via-ssh-or-serial-interface` for further details.
46+
47+
Update via USB
48+
--------------
49+
50+
**Preparation of the USB update**
51+
52+
#. Download the firmware update image file onto your workstation.
53+
#. Plug a USB flash drive into your workstation.
54+
#. Format the USB flash drive as EXT2/3/4, FAT16/32, exFAT or NTFS.
55+
#. Copy the firmware update image file (:code:`*.image`) onto the USB flash drive's root directory.
56+
57+
Please note that you should not place multiple :code:`*.image` files onto the root folder of the USB flash drive, since it is not guaranteed in which order the files are tried and applied.
58+
59+
**Updating the Firmware**
60+
61+
#. Connect the board to the power supply.
62+
#. Wait until the board is booted.
63+
#. Connect to the board via SSH or Debug UART to backup all your own implementation, configuration and databases files.
64+
#. Plug in the USB flash drive with the Firmware Update Image file in the USB port of the board.
65+
#. Observe the LED update indications and wait until the whole firmware update and reboot process is finished - it takes up to 5 minutes.
66+
#. When the firmware update process is finished and the USB flash drive can be unplugged.
67+
68+
Update via SSH and SFTP
69+
-----------------------
70+
71+
#. Connect to the board via SSH (e.g. PuTTY).
72+
#. Backup all your own implementation, configuration and databases files if necessary.
73+
#. Transfer the update image file via SFTP to the board and store it in the directory :code:`/srv` with e.g. filename my-update.image. On Windows systems you can use e.g. WinSCP or Filezilla.
74+
#. Run the following command via SSH console: :code:`rauc install /srv/my-update.image`.
75+
#. The update process should start and report progress and success via console messages.
76+
#. Reboot into the new system by running the following command via SSH console: :code:`reboot`.
77+
#. Re-login into the new system and delete the file :code:`/srv/my-update.image`.
78+
79+
Update via SSH or Serial Console and HTTP or FTP
80+
------------------------------------------------
81+
82+
#. Connect to the board via SSH (e.g. PuTTY) or serial terminal.
83+
#. Backup all your own implementation, configuration and databases files if necessary.
84+
#. Place the update image file on a HTTP or FTP server which is reachable via network by your chargebyte device.
85+
#. Note the URL of the download. In case authentication is required, you must provide the credentials in the URL, e.g. :code:`http://username:[email protected]/update.image`.
86+
#. Run the following command via SSH console: :code:`rauc install <url>`, where you replace the URL with your actual URL.
87+
#. The update process should start and report progress and success via console messages.
88+
#. After success, reboot into the new system by running the following command via SSH console: :code:`reboot`.
89+
90+
Update via OCPP
91+
---------------
92+
93+
The firmware update via OCPP commands :code:`UpdateFirmware` and :code:`FirmwareStatusNotification` is implemented. Such an update via OCPP automatically triggers a reboot of the charge point after successfully installing the new firmware. The central system is notified about the successful installation before the reboot of the charge point.
94+
95+
Support for casync based Firmware Updates
96+
-----------------------------------------
97+
As mentioned in the previous sections, the firmware update mechanism uses `RAUC <https://rauc.io>`_ as update framework. The traditional method of updating a device is that a big firmware update image file is transferred to the device and then installed. However, this approach is sometimes not ideal, for example when during different firmware releases only few parts changed. To address such scenarios, RAUC itself supports casync based bundles. For more details, please refer to RAUC's own documentation: https://rauc.readthedocs.io/en/latest/advanced.html#rauc-casync-support. It is obvious that such kind of firmware updates require an established Internet connection (or a locally available HTTP/FTP server which can be reached by the charging station) - but the concept does not work for USB pen drive firmware updates.
98+
99+
On casync-enabled chargebyte firmware versions, it is possible to pass a URL referring to a casync firmware update image directly to the RAUC framework via :code:`rauc install <URL>`. Please remember that RAUC will use the passed URL to construct a base URL for accessing the smaller chunks. For example the URL :code:`http://example.com/update.raucb` would lead to the assumption that all chunks can be accessed via the base URL :code:`http://example.com/update.castr/`. Note, that the chunk store is a whole directory with many small files inside, not a simple file - the file extension like directory naming might suggest this.

0 commit comments

Comments
 (0)