.. _gateway-m-flashing-debian:
Flashing Debian
=====================================
**For assistance:** contact **CTHINGS.CO Support** at `support.cthings.co `_.
Goals
-----
This guide explains how to flash (to eMMC) an **Edge IoT Gateway M** using the **NXP UUU utility**.
Prerequisites
--------------
You will need:
* A valid Debian OS image containing:
* Bootloader (``*.bin``)
* Root filesystem (``*.img``)
* (Optional) Integrity checksum (``*.sha256``)
* Flashing tool: **NXP UUU**
Steps
-----
Installing NXP UUU
^^^^^^^^^^^^^^^^^^^^^^^^^^
Follow the instructions here (it is recommended to use a Linux-based host computer):
`https://github.com/nxp-imx/mfgtools `_
If you’d like you install the ``uuu`` utility to your computer, optionally run ``sudo make install`` after compiling.
Flashing the Bootloader
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Acquire the bootloader
""""""""""""""""""""""""""""""
Obtain the correct ``.bin`` bootloader file for your **Edge IoT Gateway M** hardware revision.
.. list-table::
:header-rows: 1
:widths: 20 20 20
* - RAM size
- Product Code
- DRAM_CONF
* - 1 GB
- R1
- d1d8
* - 2 GB
- R2
- d2d4
* - 4 GB
- R4
- d2d4
* - 8 GB
- R8
- d1d8
Accessing the UUU port
""""""""""""""""""""""""""""""
1. Remove the SIM card cover using a pin tool.
2. Connect the micro-USB interface under the cover to your host computer (this is the NXP UUU interface); you may also optionally connect the serial interface and open an emulator, but this is not strictly necessary for the flash itself.
Entering flashing mode
""""""""""""""""""""""""""""""
1. Power on the device by long-pressing (1-2 seconds) the power button.
2. Identify the correct bootloader based on the RAM configuration of your device from the table above.
Flashing the bootloader
"""""""""""""""""""""""""
Run one of the following commands, depending on your host OS:
.. tab-set::
.. tab-item:: Windows
.. code:: powershell
.\uuu.exe -b emmc flash.bin
.. tab-item:: Linux
.. code:: console
$ sudo uuu -b emmc flash.bin
Replace ``flash.bin`` with the correct bootloader filename for your model.
Resetting after bootloader flashing
""""""""""""""""""""""""""""""""""""""""
1. Power off the device (either by pressing and holding the power button or unplugging the device).
2. Disconnect the micro-USB cable from the NXP UUU interface port. Connect a cable between the console port and your computer and establish a serial connection.
3. Power on the device. Interrupt the boot in order to enter the U-Boot shell.
Resetting and saving U-Boot environment
""""""""""""""""""""""""""""""""""""""""
Reset the U-Boot environment, save the environment, and reset the device:
.. code:: bash
env default -a
saveenv
reset
Flashing a Complete OS Image
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Prepare
""""""""""
1. Power down the gateway (simple shutdown will suffice; no need to unplug power).
2. Remove the SIM card cover using a pin tool.
3. Connect the micro-USB interface under the cover to your host computer (this is the NXP UUU interface); you may also optionally connect the serial interface and open an emulator, but this is not strictly necessary for the flash itself.
4. Power on the device by long-pressing (1-2 seconds) the power button.
Acquire and verify the image
""""""""""""""""""""""""""""""
Acquire the image and verify checksums (if available).
.. code:: console
$ sha256sum cthingsco-xs-debian-xxxxxxxx.img
d41fbc4d2a5e7d8c... cthingsco-xs-debian-xxxxxxxx.img
Flashing the full eMMC image
""""""""""""""""""""""""""""""
Use the ``emmc_all`` target to flash the complete image:
.. code:: console
$ sudo uuu -b emmc_all cthingsco-xs-debian-xxxxxxxx.img
Replace the filename with your actual ``.img`` provided by CTHINGS.CO.
First reboot
""""""""""""""""""""
After the flashing process completes:
1. Disconnect power.
2. Wait 1–2 seconds.
3. Power on the gateway.
The Debian system will boot automatically and expand the filesystem if supported by the image.
.. note::
To obtain the correct image and firmware for your hardware revision, please contact
**CTHINGS.CO Support** at `support@cthings.co `_.