Skip to content

Commit 6eb787a

Browse files
authored
Merge pull request #66 from chargebyte/everest/charge_control_y_for_release_2025.8.0
Charge Control Y: factor our EVerest cross-compiling and fix upstream URLs
2 parents f2db3b6 + f60920f commit 6eb787a

File tree

4 files changed

+20
-150
lines changed

4 files changed

+20
-150
lines changed

docs/source/conf.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,28 @@
1313
# -- General configuration ---------------------------------------------------
1414
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
1515

16-
extensions = ['linuxdoc.rstFlatTable', 'sphinx_copybutton']
16+
extensions = ['linuxdoc.rstFlatTable', 'sphinx_copybutton', 'sphinx_jinja2']
1717

18-
templates_path = ['_templates']
18+
templates_path = ['_templates', '../../includes/_templates']
1919
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
2020

2121
numfig = True
2222

23+
jinja2_contexts = {
24+
'target-info': {
25+
'PLATFORM_NAME': 'Charge Control Y',
26+
'MACHINE': 'parsley',
27+
'APT_CROSS_MACHINE_SPECIFIC': 'gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu',
28+
'MACHINE_FILE_SIGNATURE': 'ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=af8cd65df0ac1e3e6f0ed3adafcd5aec60ca8f15, for GNU/Linux 3.7.0, stripped'
29+
},
30+
}
31+
2332
# -- Options for HTML output -------------------------------------------------
2433
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
2534

2635
html_title = project
2736
html_theme = 'classic'
28-
html_static_path = ['_static']
37+
html_static_path = ['_static', '../../includes/_static']
2938
html_logo = '_static/cb_logo.png'
3039
html_css_files = [
3140
'css/cb_theme.css',

docs/source/development.rst

Lines changed: 4 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -1,151 +1,12 @@
11
.. _development.rst:
22

3-
.. include:: ../../includes/development.inc
3+
.. include:: ../../includes/development_intro.inc
44

5-
.. _cross_compiling:
5+
.. _development_cross_compiling_everest_modules:
66

7-
Cross-compiling for Charge SOM
8-
==============================
9-
10-
Cross-compilation is the fastest and most convenient way to test your own modules directly on the target
11-
system during development. The cross-compiled project can then either be transferred directly via SFTP
12-
to the charge controller or integrated into a firmware image and installed on the target using the `rauc` command.
13-
14-
The following steps describe how to cross-compile a module for the Charge SOM platform.
15-
16-
#. On an Ubuntu or Debian-based Linux distribution, install the cross-compilers for Charge SOM:
17-
18-
.. code-block:: console
19-
20-
sudo apt install build-essential libc6-arm64-cross gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-arm-linux-gnueabihf gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
21-
22-
#. Download chargebyte's `digital certificate <https://chargebyte.com/controllers-and-modules/evse-controllers/charge-control-c#downloads>`_
23-
and use it to extract the root filesystem from the firmware image. The digital certificate is the same between Charge SOM and Charge Control C.
24-
25-
.. code-block:: console
26-
27-
rauc extract --keyring=<chargebyte_certificate>.crt <shipped_firmware>.image bundle-staging
28-
29-
.. note::
30-
Alternatively, if the above command does not work, you can use the following command:
31-
32-
.. code-block:: console
33-
34-
unsquashfs -d bundle-staging <shipped_firmware>.image
35-
36-
However, this will not verify the signature of the firmware image.
37-
38-
#. Mount the extracted ext4 root filesystem image as a loop device:
39-
40-
.. code-block:: console
41-
42-
sudo mkdir -p /mnt/rootfs
43-
sudo mount bundle-staging/core-image-minimal-chargesom.ext4 /mnt/rootfs
44-
45-
#. Create a new directory in your `everest-workspace` directory (in parallel to the `everest-core` directory) and
46-
create a new file named :code:`toolchain.cmake`:
47-
48-
.. code-block:: console
49-
50-
cd everest-workspace
51-
mkdir toolchain
52-
cd toolchain
53-
touch toolchain.cmake
54-
55-
#. Save the following content in the :code:`toolchain.cmake` file:
56-
57-
.. literalinclude:: ../../includes/_static/files/toolchain.cmake
58-
59-
#. The resulting directory structure should look like this:
60-
61-
.. code-block:: console
62-
63-
everest-workspace/
64-
|── {MyEVerestModule}
65-
├── everest-core
66-
└── toolchain
67-
└── toolchain.cmake
68-
69-
#. Create a new :code:`build_csom` directory in the EVerest project directory (e.g. within your own EVerest
70-
module project directory or :code:`everest-core` if you want to build the everest-core modules):
71-
72-
.. code-block:: console
73-
74-
cd ../{MyEVerestModule}
75-
mkdir build_csom
76-
cd build_csom
77-
78-
#. Run the following command inside the `build_csom` directory to configure the build:
79-
80-
.. code-block:: console
81-
82-
cmake -DCMAKE_TOOLCHAIN_FILE=../../toolchain/toolchain.cmake -DCMAKE_SYSROOT=/mnt/rootfs ..
83-
84-
#. When this completes successfully, start cross-compiling using :code:`make`:
85-
86-
.. code-block:: console
87-
88-
make install -j$(nproc)
89-
90-
#. If the build was successful, a dist directory will be created with the cross-compiled binaries and
91-
the manifest files of the modules. Please check if the following directory structure was created:
92-
93-
.. code-block:: console
94-
95-
dist/
96-
└── libexec
97-
└── everest
98-
└── modules
99-
└── {MyEVerestModule}
100-
├── {MyEVerestModule} (binary)
101-
└── manifest.yaml (manifest file)
102-
103-
#. Verify that the resulting binaries were compiled for the Charge SOM platform:
104-
105-
.. code-block:: console
106-
107-
file dist/libexec/everest/modules/{MyEVerestModule}/{MyEVerestModule}
108-
109-
The output should be something like:
110-
111-
.. code-block:: console
112-
113-
dist/libexec/everest/modules/{MyEVerestModule}/{MyEVerestModule}: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV),
114-
dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=ad2342fdd3b8fb1949fc3e13b77382d3da72f28a, for GNU/Linux 3.7.0, stripped
115-
116-
#. The resulting binary and manifest can be found in the :code:`dist/libexec/everest/modules/{MyEVerestModule}`
117-
directory. If you want to test the module on the target system, you can copy the module directory using
118-
:code:`scp` or :code:`rsync`:
119-
120-
.. code-block:: console
121-
122-
scp -r dist/libexec/everest/modules/{MyEVerestModule} root@<ip_address>:/usr/libexec/everest/modules/
123-
124-
#. To include the new module in a firmware image, copy the module directory into the mounted root filesystem:
125-
126-
.. code-block:: console
127-
128-
sudo cp -av dist/libexec/everest/modules/{MyEVerestModule} /mnt/rootfs/usr/libexec/everest/modules/
129-
130-
#. Unmount the loop device:
131-
132-
.. code-block:: console
133-
134-
sudo umount /mnt/rootfs
135-
136-
#. Ensure that the modified filesystem is in a clean state:
137-
138-
.. code-block:: console
139-
140-
fsck.ext4 -f bundle-staging/core-image-minimal-chargesom.ext4
141-
142-
#. Follow the steps under the section :ref:`firmware_customization` to install your PKI certificate, repackage
143-
the modified root filesystem into a firmware update image, and test the new firmware.
144-
145-
.. _creating_fw_images:
7+
.. jinja:: target-info
8+
:file: ../../includes/_templates/development_cross_compiling_everest_modules.rst.j2
1469

14710
.. include:: ../../includes/development_creating_fw_images.inc
14811

149-
.. _debugging_and_logging:
150-
15112
.. include:: ../../includes/development_debugging_and_logging.inc

docs/source/troubleshooting.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ How do I set up OCPP 2.0.1 on Charge Control Y with EVerest?
3535
To support OCPP 2.0.1, the EVerest OCPP201 module must be integrated into the EVerest configuration.
3636
This module uses the `libocpp library <https://github.com/EVerest/libocpp>`_ to implement the OCPP 2.0.1
3737
protocol.
38-
The `OCPP201 module documentation <https://github.com/EVerest/everest-core/blob/main/modules/OCPP201/doc.rst>`_
38+
The `OCPP201 module documentation <https://github.com/EVerest/everest-core/blob/main/modules/EVSE/OCPP201/doc.rst>`_
3939
already contains some information about the module parameters, the provided and required interfaces,
4040
and the initial creation of the OCPP 2.0.1 database.
4141

@@ -56,8 +56,8 @@ The most important points are summarised here:
5656
5. The OCPP 2.0.1 device model initialization is done automatically by the OCPP201 module after the
5757
first start of EVerest. The database is stored the `DeviceModelDatabasePath`.
5858
6. The component config files are stored in the `DeviceModelConfigPath`. Component config files are
59-
used to initialize or update the device model database. To update a component config file, just the
60-
place a `component config file <https://github.com/EVerest/libocpp/tree/v0.16.2/config/v201/component_config>`_
59+
used to initialize or update the device model database. To update a component config file, just
60+
place a `component config file <https://github.com/EVerest/libocpp/tree/main/config/v2/component_config>`_
6161
in the same directory structure in the DeviceModelConfigPath and change the values accordingly.
6262
Important keys of the component config files are:
6363

0 commit comments

Comments
 (0)