rumboot-tools


Namerumboot-tools JSON
Version 0.9.32 PyPI version JSON
download
home_pagehttp://github.com/RC-MODULE/rumboot-tools
SummaryRumBoot ROM Loader Tools
upload_time2023-09-07 11:32:59
maintainer
docs_urlNone
authorAndrew Andrianov
requires_python
licenseGPL
keywords rumboot image
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # RumBoot Loader Tools

## Summary
This repository is home to a set of tools to create, update and run rumboot v1, v2 and other images
This repository contains several tools


* _rumboot-packimage_ - Adds/prints/updates checksums in image files
* _rumboot-xrun_ - Directly executes images via serial line or network
* _rumboot-xflash_ - Write on-board memories via serial line or network
* _rumboot-flashrom_ - Wrapper around flashrom tool for advanced SPI flash programming
* _rumboot-daemon_ - Provides network shared access to different boards



Sounds like too much? How you are you expected to use them in your app? 

* Use _rumboot-packimage_ to add valid checksums to your binaries, so that bootrom would accept them

* Run them via UART using _rumboot-xrun_ (or your favourite jtag tool), flash them via _rumboot-xflash_

* If rumboot-xflash doesn't work with your SPI Flash chip, check out _rumboot-flashrom_ instead

* Have only one board for a few developers? Want easy remote access during COVID-19 or some other epidemic? Check out _rumboot-daemon_. 

* Want to combine a set of tests into one image? Check out the _rumboot-combine_ tool.

## Chip IDs 

rumboot-tools use IDs to identify chips. Every supported chip has it's own id. 


Platform Name | Part Number              | EDCL | Endianess | #Cores | ChipID | ChipRev | Image Format
--------------|--------------------------|------|-----------|--------|--------|---------|------------------
mm7705        | 1888ТХ018                | Yes  | big       | 2      | 1      | 1       | RumBoot V1
mb7707        | К1879ХБ1YA               | Yes  | little    | -      | 2      | 1       | Legacy K1879XB1YA
basis         | 1888ВС048                | No   | little    | 1      | 3      | 1       | RumBoot V2
oi10          | 1888ВМ018(A)/1888ВМ01H4 | Yes  | big       | 1      | 4      | 1       | RumBoot V2
bbp3          | 1888ВС058                | Yes  | little    | 1      | 5      | 1       | RumBoot V2
nm6408        | 1888ВС058                | Yes  | little    | 1      | 6      | 1       | Legacy NM6408
              |                          |      |           |        |        |         |
zed           | Zed Board / Tang Hex     | No   | little    | 2      | 255    | 1       | Other
rpi4          | BCM2711 (Raspberry Pi 4) | No   | little    | 4      | 255    | 2       | Other

Since different chips have different ROM loaders, default baudrates, flash memories and etc., some tools require you either set ChipId explicitly (via -c option) or try their best to guess it from image file header. Only newer (rumboot V2 and later) image formats have a dedicated field called chip_id. 

You can either specify chip id via it's number or via platform name, whichever suits you. (`-c 2` and `-c mb7707` do the same).

For rumboot v2 and later, if the chip id doesn't match the one in silicon, the image is considered invalid

Thirdparty chips that are used for testing and prototyping always have chip id set as 255. 

The chip revision may be used to distinguish different versions of the same chip, if any. It is only
supported by Rumboot V2 headers and later. If Chip revision of the file you are uploading and the one stored 
in silicon don't match - you'll get a warning.

## EDCL Notes

### Basic stuff
Uart is the simplest possible interface for all debugging stuff, but it's also quite slow if you are going
to send huge files (e.g. linux kernel, initrd, etc.) Starting with version 0.9.4 rumboot-tools support a side-channel to do data transfers. Right now the only possible sidechannel is EDCL.

EDCL stands for 'Ethernet communications debug link'. It provides a way to access physical memory via a special protocol over UDP. It exists in all RC Module's chips (except 'basis' platform). The protocol has *NO* security at all, so please disable edcl in a production enviroment. If you didn't get it, I'll write it in *bold*:

*NEVER EVER ENABLE EDCL IN A PRODUCTION ENVIRONMENT OR YOU'LL MAKE EASY PREY FOR HAX0RS!!! *

### Setting up network for EDCL

EDCL IP and MAC adresses are hardcoded in silicon. Therefore putting several same chips in one LAN is not likely to work. The recommended setup is a dedicated network interface directly connected to the target board.

IP: _192.168.0.1_ 
NetMask _255.255.0.0_

After the interface setup is done, just add _-e_ option for xrun/xflash and enjoy the speedup

### ARP Bugs and workarounds

Some old chips have an invalid IP set as 192.168.0.0. The OS will discard ARP replies as invalid. However since EDCL only checks mac, we can set a static ARP record. The xrun does that automatically when needed using sudo/runas on linux/windows respectively. If a static record exists, no static record is added. When this hack is needed - you'll see UAC request in windows. In linux sudo will ask you for a password.

### IP clash bug and workarounds 

Okay, so despite the warning above, you want to use several different chips in the same LAN and noticed that different chips (e.g. mm7705 and oi10) have the same IP, though MACs are unique. There's a special flag called 
--force-static-arp that make xrun/xflash always drop existing arp records (if any) and add proper ones.
Just note that this usage case is not 'officially' supported and can cause confusion of you don't fully understand what's happening. 

## Installation
### From pypi (Recommended for Linux)

This is the simplest way. Just type:

```
    pip3 install rumboot-tools
```

or 

```
    pip3 install rumboot-tools
```

And you're all set. 

_WARNING_: Windows installations need Visual Studio Build Tools installed. It’s a huge download, but it’s
needed. Grab it at [Microsoft download
site](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017). 

_HINT_: We provide binary offline windows installers for some released versions. The don't need those and are easier to install.

### From a binary release zip (Recommended for Windows)

Grab a zip download from [Github Releases Page](https://github.com/RC-MODULE/rumboot-tools/releases) or directly from the artifacts tab of [Appveyor CI Page](https://ci.appveyor.com/project/nekromant/rumboot-tools)

The zip must match the python version currently installed. Unzip the archive and run either install_system.cmd or install_venv.cmd

- install_system.cmd installs rumboot-tools and all dependencies into system directories and they are accessible immediately after installation.

- install_venv.cmd installs rumboot-tools and all dependencies into 'venv' directory (will be created). Add venv\Scripts to your %PATH% to run tools from the command line.
### From source (Linux, Windows)

This is pretty much as simple as it is. Just run the following:

```
    pip3 install .
```

or 

```
    pip3 install .
```

P.S. Make sure you have a proper internet connection, or pip will fail to fetch dependencies.

_WARNING_: Windows installations need Visual Studio Build Tools installed. It’s a huge download, but it’s
needed. Grab it at [Microsoft download
site](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017). 

_HINT_: We provide binary offline installers for some released versions. The don't need those and are easier to install.

## Tool descriptions

### rumboot-packimage
#### Description

This tool adds/checks/updates checksums in existing images. The image must already have a proper header placed by the linker. 

#### Options 

```
~# rumboot-packimage --help
usage: rumboot-packimage [-h] -f FILE [-i] [-c] [-C] [-r] [-R relocation] [-Z]
                         [-U] [-z value] [-a value] [-F value value]
                         [--set-data offset value] [-g key] [-s key value]
                         [-e] [-E] [-w WRAP]

rumboot-packimage 0.9.31 - Universal RumBoot Image Manipulation Tool

(C) 2018-2021 Andrew Andrianov <andrew@ncrmnt.org>, STC "Module"
https://module.ru / https://github.com/RC-MODULE

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

options:
  -h, --help            show this help message and exit
  -f FILE, --file FILE  image file
  -i, --info            Show information about the image
  -c, --checksum        This option will modify the file! Calculates valid
                        checksums to the header. The length is set to cover
                        the full length of file ONLY if it's zero.
  -C, --checksum_fix_length
                        This option will modify the file! The same as
                        --checksum/-c, but always overrides length to covert
                        the full length of file
  -r, --raw             Display raw header field names
  -R relocation, --relocate relocation
                        Tell bootrom to relocate the image at the specified
                        address before executing it. Only RumBootV3 and above
  -Z, --compress        Compress image data with heatshrink algorithm (V3 or
                        above only)
  -U, --decompress      Decompress image data with heatshrink algorithm (V3 or
                        above only)
  -z value, --add_zeroes value
                        This option will add N bytes of zeroes to the end of
                        the file (after checksummed area). This is required to
                        avoid propagating 'X' during the next image check
                        during simulation. Normally, you do not need this
                        option
  -a value, --align value
                        Pad resulting image size to specified alignment.
                        Remember to add -C to have correct checksums!
  -F value value, --flag value value
                        Set image flag to a desired value. Only RumBootV3 or
                        above
  --set-data offset value
                        Sets data at byte 'offset' to value 'offset'
  -g key, --get key     Get a single field from header. Nothing else will be
                        printed. NOTE: The value will be formatted as hex
  -s key value, --set key value
                        This option will modify the file! Set a header key to
                        specified value. Use -r flag on an existing image to
                        find out what keys exist. Use -c to update the
                        checksums
  -e, --reverse-endianness
                        Use this option to reverse endianness of all headers.
                        This will not touch data. For testing only
  -E, --reverse-data-endianness
                        Use this option to reverse endianness of data section.
                        This will not touch header. This might be required for
                        booting some nmc chips.
  -w WRAP, --wrap WRAP  Use this option to wrap arbitrary data to V1/V2/V3
                        images.

```

#### Typical uses

##### Check if an image file is valid

```
~# rumboot-packimage -f myimage.bin
```

This command will silently validate an image and exit code 0 if everything's okay. 1 if something isn't right. Useful for scripts.

##### Dump header information

```
~# rumboot-packimage -f image.bin -i

Detected RumBootV1 image, endian: big
=== RumBootV1 Header Information ===
Endianess:              big
Magic:                  0xbeefc0de
Data Length:            69108
Header CRC32:           0x1e955d90 [Valid]
Data CRC32:             0x1929eb8e [Valid]

```

This command will dump all header contents of a file

##### Write correct data length and checksums to the image

```
~# rumboot-packimage -f image.bin -с

Detected RumBootV1 image, endian: big
Wrote valid checksums to image header
=== RumBootV1 Header Information ===
Endianess:              big
Magic:                  0xbeefc0de
Data Length:            69108
Header CRC32:           0x1e955d90 [Valid]
Data CRC32:             0x1929eb8e [Valid]
```


### rumboot-xrun
#### Description

This tool directly uploads a binary to the target board, executes it and provides you with human-readable output. It also resets the board if necessary.

#### Options 

```
~# rumboot-xrun --help
usage: rumboot-xrun [-h] [-f FILE] [-c chip_id] [-l LOG] [-p port] [-b speed]
                    [-e] [--force-static-arp] [--edcl-ip EDCL_IP]
                    [--edcl-mac EDCL_MAC] [--edcl-timeout EDCL_TIMEOUT]
                    [-r method] [--apc-host APC_HOST] [--apc-user APC_USER]
                    [--apc-pass APC_PASS] [--apc-outlet APC_OUTLET]
                    [--hass-power-switch]
                    [--hass-reset-switch HASS_RESET_SWITCH]
                    [--hass-host-switch HASS_HOST_SWITCH]
                    [--hass-token HASS_TOKEN] [--hass-server HASS_SERVER]
                    [--mdb-ctl-port MDB_CTL_PORT]
                    [--mt12505-serial MT12505_SERIAL] [--pl2303-invert-reset]
                    [--pl2303-invert-power] [--pl2303-swap]
                    [--powerhub-usb-port POWERHUB_USB_PORT]
                    [-A [PLUSARGS ...]] [-R] [-I] [--replay-no-exit]

rumboot-xrun 0.9.31 - RumBoot X-Modem execution tool

(C) 2018-2021 Andrew Andrianov <andrew@ncrmnt.org>, STC "Module"
https://module.ru / https://github.com/RC-MODULE

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

options:
  -h, --help            show this help message and exit
  -f FILE, --file FILE  Image file (may be specified multiple times)
  -R, --rebuild         Attempt to rebuild/update target before uploading
  -I, --stdin           Use stdin redirection to tty
  --replay-no-exit      Do not exit on panics/rom returns when replaying logs
                        (for batch analysis)

File Handling:
  -c chip_id, --chip_id chip_id
                        Override chip id (by name or chip_id)

Connection Settings:
  -l LOG, --log LOG     Log terminal output to file
  -p port, --port port  Serial port to use
  -b speed, --baud speed
                        Serial line speed
  -e, --edcl            Use edcl for data uploads (when possible)
  --force-static-arp    Always add static ARP entries
  --edcl-ip EDCL_IP     Use specific EDCL IP address (default - from chip id)
  --edcl-mac EDCL_MAC   Use specific EDCL MAC address (default - from chip id)
  --edcl-timeout EDCL_TIMEOUT
                        Use specific EDCL MAC address (default - from chip id)

Reset Sequence options:
  These options control how the target board will be reset

  -r method, --reset method
                        Reset sequence to use (apc base hass Serial mdb
                        mt12505 pl2303 powerhub)

apc reset sequence options:
  --apc-host APC_HOST   APC IP Address/hostname
  --apc-user APC_USER   APC Username
  --apc-pass APC_PASS   APC Password
  --apc-outlet APC_OUTLET
                        APC Outlet Number

hass reset sequence options:
  --hass-power-switch   Home Assistant power switch
  --hass-reset-switch HASS_RESET_SWITCH
                        Home Assistant reset switch
  --hass-host-switch HASS_HOST_SWITCH
                        Home Assistant host switch
  --hass-token HASS_TOKEN
                        Secret token
  --hass-server HASS_SERVER
                        Hass server URL

mdb reset sequence options:
  --mdb-ctl-port MDB_CTL_PORT
                        Malina Debug Bridge control port

mt12505 reset sequence options:
  --mt12505-serial MT12505_SERIAL
                        FT232RL serial number to use

pl2303 reset sequence options:
  --pl2303-invert-reset
                        Invert pl2303 reset signal
  --pl2303-invert-power
                        Invert pl2303 power signal
  --pl2303-swap         Swap pl2303 reset and power mapping

powerhub reset sequence options:
  --powerhub-usb-port POWERHUB_USB_PORT
                        powerhub port number

Plusargs parser options:
  
          rumboot-xrun can parse plusargs (similar to verilog simulator)
          and use them for runtime file uploads. This option is intended
          to be used for
          

  -A [PLUSARGS ...], --plusargs [PLUSARGS ...]

```

#### Configuration file

The rumboot-xrun tries to find a configuration file on your system in the following locations:

* ~/.rumboot.yaml

* /etc/rumboot.yaml

Example configuration file is provided below:

```yaml
xrun:
    defaults:
        port: /dev/ttyUSB0
    chips:
        oi10:   
            port: /dev/ttyUSB1
            baudrate: 19200
        basis:  
            port: /dev/ttyUSB2
        mm7705: 
            port: socket://10.7.11.59:10002
```

The configuration file contains default ports and speeds for all known chip ids. If you supply a file to rumboot-xrun without any other options, rumboot-xrun will find out the chip id from the header file and set default port and baudrate accordingly. 

If no configuration file can be found in any location, the default serial port will be /dev/ttyUSB0. Default baudrate will be taken from the internal chip database and should match most typical settings


#### Typical usage
##### Execute a file on bare metal enviroment

```
~# rumboot-xrun -f myimage.bin -p /dev/ttyUSB0
Detected chip:    oi10 (1888ВМ018(A)/1888ВМ01H4)
Reset method:     None
Baudrate:         115200 bps
Port:             /dev/ttyUSB0
Please, power-cycle board






    RC Module's          __                __
   _______  ______ ___  / /_  ____  ____  / /_
  / ___/ / / / __ `__ \/ __ \/ __ \/ __ \/ __/
 / /  / /_/ / / / / / / /_/ / /_/ / /_/ / /_
/_/   \__,_/_/ /_/ /_/_.___/\____/\____/\__/
oi10 | Production | HEAD-0a2dc3a8
--- RumBoot Configuration ---
Force Host Mode: enabled
Selftest:        disabled
EDCL/RMAP:       enabled
UART speed:      115200 bps
Max SPL size:    131072 bytes
SD Card:         Not inserted
CPU ECC:         disabled
NOR/SRAM ECC:    disabled
Direct NOR boot: disabled
Reset cause:     SCTL: 0x800 SPR_DBCR0: 0x0
---          ---          ---
boot: host: Entering Host Mode
boot: host: GRETH0 EDCL MAC: ec:17:66:e:10:0 IP: 192.168.1.48
boot: host: GRETH1 EDCL MAC: ec:17:66:e:10:1 IP: 192.168.1.49
boot: host: Hit 'X' for X-Modem upload



boot: host: Received 40960 bytes, executing in 100ms
boot: host: --- Boot Image Header ---
boot: host: Magic:            0xb01dface
boot: host: Header version:   2
boot: host: Chip Id:          4
boot: host: Chip Revision:    1
boot: host: Data length:      40800
boot: host: Header CRC32:     0xb47a8252
boot: host: Data CRC32:       0x87065aa6
boot: host: ---        ---        ---
Hello, World!
boot: host: Back in rom, code 0

```

This command waits for bootrom prompt, uploads a file via xmodem and prints everything received to stdout acting pretty much the same, as your favorite terminal program. The exit code from the program will be the exit code of rumboot-run (0 in the example above), therefore you can rumboot-xrun in your scripts during unit-testing.

NOTE: Make sure the jumpers on the board are set to 'host mode'. After running the command press the reset button or supply power to the board.

##### Start u-boot and enter interactive prompt

```
~# rumboot-xrun -f spl/u-boot-spl-dtb.rbi -f u-boot-dtb.img -e -I -r pl2303

Detected chip:    oi10 (1888ВМ018(A)/1888ВМ01H4)
pl2303: /dev/ttyUSB8 detected at USB path 2-1.2
Reset method:               pl2303
Baudrate:                   115200 bps
Port:                       /dev/ttyUSB8
Preferred data transport:   xmodem



    RC Module's                           
   _______  ______ ___  / /_  ____  ____  / /_
  / ___/ / / /  ` \/  \/  \/  \/ /
 / /  / /_/ / / / / / / /_/ / /_/ / /_/ / /_  
/_/   \__,_/_/ /_/ /_/_.___/\____/\____/\__/  
oi10 | Production | HEAD-0a2dc3a8
--- RumBoot Configuration ---
Force Host Mode: enabled
Selftest:        disabled
EDCL/RMAP:       enabled
UART speed:      115200 bps
Max SPL size:    131072 bytes
SD Card:         Inserted
CPU ECC:         enabled
NOR/SRAM ECC:    disabled
Direct NOR boot: disabled
Reset cause:     SCTL: 0x800 SPR_DBCR0: 0x0
---          ---          ---
boot: host: Entering Host Mode
boot: host: GRETH0 EDCL MAC: ec:17:66:e:10:0 IP: 192.168.1.48
boot: host: GRETH1 EDCL MAC: ec:17:66:e:10:1 IP: 192.168.1.49
boot: host: Hit 'X' for X-Modem upload
Sending binary: 43.0kB [00:06, 6.73kB/s]                                        



boot: host: Received 44032 bytes, executing in 100ms
boot: host: --- Boot Image Header ---
boot: host: Magic:            0xb01dface
boot: host: Header version:   2
boot: host: Chip Id:          4
boot: host: Chip Revision:    1
boot: host: Data length:      43907
boot: host: Header CRC32:     0xb6bc96ec
boot: host: Data CRC32:       0x6fd63f77
boot: host: ---        ---        ---

U-Boot SPL 2020.04-rc1-g67f6b3d9a6-dirty (Jul 21 2020 - 11:50:55 +0300)
Testing SDRAM...
Trying to boot from RUMBOOT
Skip rumboot chain - host mode
Trying to boot from X-MODEM/EDCL
UPLOAD to 0x21e00000. 'X' for X-modem, 'E' for EDCL
Sending binary: 296kB [00:29, 10.4kB/s]                                         
 xyzModem - CRC mode, 0(SOH)/296(STX)/0(CAN) packets, 0 retries
Loaded 302430 bytes
The image has been loaded


U-Boot 2020.04-rc1-g67f6b3d9a6-dirty (Jul 21 2020 - 11:50:55 +0300)

CPU:   RC Module PowerPC 476FP core
Model: RCM MB150-02
DRAM:  32 MiB
MMC:   mmc0@D002C000: 0
Loading Environment from MMC... OK
In:    uart0@D0029000
Out:   uart0@D0029000
Err:   uart0@D0029000
Net:   eth0: greth0@D002A000
Hit any key to stop autoboot:  0 
=>

```

This command resets the board, uploads u-boot spl, u-boot and enters interactive mode for you to play with.
The uploads are performed using xmodem.

##### Start u-boot and enter interactive prompt, prefer edcl for uploads

```
~# rumboot-xrun -f spl/u-boot-spl-dtb.rbi -f u-boot-dtb.img -e -I -r pl2303

Detected chip:    oi10 (1888ВМ018(A)/1888ВМ01H4)
pl2303: /dev/ttyUSB8 detected at USB path 2-1.2
Reset method:               pl2303
Baudrate:                   115200 bps
Port:                       /dev/ttyUSB8
Preferred data transport:   edcl



    RC Module's                           
   _______  ______ ___  / /_  ____  ____  / /_
  / ___/ / / /  ` \/  \/  \/  \/ /
 / /  / /_/ / / / / / / /_/ / /_/ / /_/ / /_  
/_/   \__,_/_/ /_/ /_/_.___/\____/\____/\__/  
oi10 | Production | HEAD-0a2dc3a8
--- RumBoot Configuration ---
Force Host Mode: enabled
Selftest:        disabled
EDCL/RMAP:       enabled
UART speed:      115200 bps
Max SPL size:    131072 bytes
SD Card:         Inserted
CPU ECC:         enabled
NOR/SRAM ECC:    disabled
Direct NOR boot: disabled
Reset cause:     SCTL: 0x800 SPR_DBCR0: 0x0
---          ---          ---
boot: host: Entering Host Mode
boot: host: GRETH0 EDCL MAC: ec:17:66:e:10:0 IP: 192.168.1.48
boot: host: GRETH1 EDCL MAC: ec:17:66:e:10:1 IP: 192.168.1.49
boot: host: Hit 'X' for X-Modem upload
Connected: oi10 (Greth #1)
Sending binary: 100%|█████████████████████▉| 42.9k/42.9k [00:00<00:00, 1.15MB/s]
boot: host: --- Boot Image Header ---
boot: host: Magic:            0xb01dface
boot: host: Header version:   2
boot: host: Chip Id:          4
boot: host: Chip Revision:    1
boot: host: Data length:      43907
boot: host: Header CRC32:     0xb6bc96ec
boot: host: Data CRC32:       0x6fd63f77
boot: host: ---        ---        ---

U-Boot SPL 2020.04-rc1-g67f6b3d9a6-dirty (Jul 21 2020 - 11:50:55 +0300)
Testing SDRAM...
Trying to boot from RUMBOOT
Skip rumboot chain - host mode
Trying to boot from X-MODEM/EDCL
UPLOAD to 0x21e00000. 'X' for X-modem, 'E' for EDCL
Sending binary: 100%|███████████████████████▉| 295k/295k [00:00<00:00, 1.18MB/s]
The image has been loaded


U-Boot 2020.04-rc1-g67f6b3d9a6-dirty (Jul 21 2020 - 11:50:55 +0300)

CPU:   RC Module PowerPC 476FP core
Model: RCM MB150-02
DRAM:  32 MiB
MMC:   mmc0@D002C000: 0
Loading Environment from MMC... OK
In:    uart0@D0029000
Out:   uart0@D0029000
Err:   uart0@D0029000
Net:   eth0: greth0@D002A000
Hit any key to stop autoboot:  0 
=>
```

This command resets the board, uploads u-boot spl, u-boot and enters interactive mode for you to play with.
The uploads are performed using edcl side-channel.

##### Execute a file, custom port/speed, automatically reset board via pl2303

```
~# rumboot-xrun -f myimage.bin -p /dev/ttyUSB0 -b 19200 -r pl2303
```
The -r option specifies one of the ways to reset board. For more info on
board reset mechanism, please see Appendix A

##### Execute a chain of files without reset

```
~# rumboot-xrun -f init_ddr.bin -f test_ddr.bin -r pl2303
```

The -f option can be specified multiple times. Every image should exit with code 0 for the chain to move on. (See rumboot docs for more about this logic)

##### Log serial output to a file

```
~# rumboot-xrun -f init_ddr.bin -f test_ddr.bin -l uart.log
```

The -l option can be used to log output to a file

##### Using stdin

```
~# rumboot-xrun -f init_ddr.bin -I 
```

The -I options makes the terminal _bi-directional_. E.g. You can not only see what the board sends you, but you can also type in some commands. 

##### Auto-rebuilding project

```
~# rumboot-xrun -R -f example.bin 
```

The -R options convenience option invokes automatically _cmake --build example.all_ in the directory with the binary file. The target name is calculating by changing .bin to .all. This is hardcoded for 'rumboot' SDK for now.

##### Automatic stack trace decoding

rumboot-xrun provides a mechanism to decode runtime stack traces. To use this functionality, you have to place a .dmp file with disassembly in the same directory and with the same name as the .bin file

### rumboot-xflash
#### Description

This tool allows you to quickly program different flashes attached to the target chip. It is done by uploading a precompiled stub that implements the programming protocol of the target flash media and accepts an xmodem payload. Pre-compiled stubs are shipped with rumboot-tools.
For most chips these are heavily hacked u-boot spls. They run fully in internal on-chip SRAM, therefore don't care what DDR/SDRAM memories you have attached.

The tool provides users currently with two transports for programming: EDCL and SERIAL (XMODEM). 

*EDCL* is generally faster, but requires a direct connection between you PC and the target board via ethernet. Some legacy bootroms only support EDCL for initial upload. 

*Serial* (xmodem) is always present on newer chips. Some newer chips lack the edcl ip core (basis)

The transport for actual programming is serial by default, edcl can be selected by adding _-e_ switch. 

Writing will always be about twice slower than reading, since readback is usually integrated in the SPL doing all the work. 

*PRO TIP:* You can just write the image to SD Card by popping it into your PC. That would usually be waaay faster. 
#### Options 

```
~# rumboot-xflash --help
usage: rumboot-xflash [-h] [-f FILE] [-c chip_id] [-l LOG] [-p port]
                      [-b speed] [-e] [--force-static-arp] [--edcl-ip EDCL_IP]
                      [--edcl-mac EDCL_MAC] [--edcl-timeout EDCL_TIMEOUT] [-v]
                      [-m memory] [-z SPL_PATH] [--no-spl] [-o OFFSET]
                      [-L LENGTH] [-R] [-W] [-E] [-F FIRMWARE_FILE]
                      [-U UPLOAD_BAUDRATE] [-r method] [--apc-host APC_HOST]
                      [--apc-user APC_USER] [--apc-pass APC_PASS]
                      [--apc-outlet APC_OUTLET] [--hass-power-switch]
                      [--hass-reset-switch HASS_RESET_SWITCH]
                      [--hass-host-switch HASS_HOST_SWITCH]
                      [--hass-token HASS_TOKEN] [--hass-server HASS_SERVER]
                      [--mdb-ctl-port MDB_CTL_PORT]
                      [--mt12505-serial MT12505_SERIAL]
                      [--pl2303-invert-reset] [--pl2303-invert-power]
                      [--pl2303-swap] [--powerhub-usb-port POWERHUB_USB_PORT]

rumboot-xflash 0.9.31 - RumBoot firmware updater tool

(C) 2018-2021 Andrew Andrianov <andrew@ncrmnt.org>, STC "Module"
https://module.ru / https://github.com/RC-MODULE

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

options:
  -h, --help            show this help message and exit
  -f FILE, --file FILE  Image file (may be specified multiple times)
  -v, --verbose         Print serial debug messages during update
  -m memory, --memory memory
                        Memory program. Help for a list of memories
  -z SPL_PATH, --spl-path SPL_PATH
                        Path for SPL writers (Debug only)
  --no-spl              Do not upload spl, assume it boots on it's own (Debug
                        only)
  -o OFFSET, --offset OFFSET
                        Memory offset for read/write operations
  -L LENGTH, --length LENGTH
                        How many bytes to read/write (defaults to whole
                        file/flash)
  -R, --read            Read flash to file
  -W, --write           Write flash from file
  -E, --erase           Erase flash
  -F FIRMWARE_FILE, --firmware-file FIRMWARE_FILE
                        Write firmware from configuration file
  -U UPLOAD_BAUDRATE, --upload-baudrate UPLOAD_BAUDRATE
                        Change baudrate for uploads

File Handling:
  -c chip_id, --chip_id chip_id
                        Override chip id (by name or chip_id)

Connection Settings:
  -l LOG, --log LOG     Log terminal output to file
  -p port, --port port  Serial port to use
  -b speed, --baud speed
                        Serial line speed
  -e, --edcl            Use edcl for data uploads (when possible)
  --force-static-arp    Always add static ARP entries
  --edcl-ip EDCL_IP     Use specific EDCL IP address (default - from chip id)
  --edcl-mac EDCL_MAC   Use specific EDCL MAC address (default - from chip id)
  --edcl-timeout EDCL_TIMEOUT
                        Use specific EDCL MAC address (default - from chip id)

Reset Sequence options:
  These options control how the target board will be reset

  -r method, --reset method
                        Reset sequence to use (apc base hass Serial mdb
                        mt12505 pl2303 powerhub)

apc reset sequence options:
  --apc-host APC_HOST   APC IP Address/hostname
  --apc-user APC_USER   APC Username
  --apc-pass APC_PASS   APC Password
  --apc-outlet APC_OUTLET
                        APC Outlet Number

hass reset sequence options:
  --hass-power-switch   Home Assistant power switch
  --hass-reset-switch HASS_RESET_SWITCH
                        Home Assistant reset switch
  --hass-host-switch HASS_HOST_SWITCH
                        Home Assistant host switch
  --hass-token HASS_TOKEN
                        Secret token
  --hass-server HASS_SERVER
                        Hass server URL

mdb reset sequence options:
  --mdb-ctl-port MDB_CTL_PORT
                        Malina Debug Bridge control port

mt12505 reset sequence options:
  --mt12505-serial MT12505_SERIAL
                        FT232RL serial number to use

pl2303 reset sequence options:
  --pl2303-invert-reset
                        Invert pl2303 reset signal
  --pl2303-invert-power
                        Invert pl2303 power signal
  --pl2303-swap         Swap pl2303 reset and power mapping

powerhub reset sequence options:
  --powerhub-usb-port POWERHUB_USB_PORT
                        powerhub port number

```
```
~# rumboot-xflash -m help -c mm7705
[!] Using configuration file: /home/necromant/.rumboot.yaml
Available memories for chip 'mm7705'
    mmc0: SD/MMC Card
    sf00: SPI Flash
     nor: NOR memory
    nand: NAND memory

```

Or you can just specify the file you are going to flash instead, the tool will find out chip id from it. 
The file must have the relevant header (See rumboot-packimage for header manipulation)

```
~# rumboot-xflash -m help -f rumboot-mm7705-Production-irq-irq-atomics.bin 
[!] Using configuration file: /home/necromant/.rumboot.yaml
Available memories for chip 'mm7705'
    mmc0: SD/MMC Card
    sf00: SPI Flash
     nor: NOR memory
    nand: NAND memory
```

##### Print information about attached flash device

```
~# rumboot-xflash -c mm7705 -m nand
[!] Using configuration file: /home/necromant/.rumboot.yaml
Detected chip:    mm7705 (1888TX018)
Reset method:               None
Baudrate:                   1000000 bps
Port:                       /dev/ttyUSB0
Preferred data transport:   xmodem
WARN: Reset method doesn't support HOST mode switching
WARN: If things don't work - check jumpers!
Please, power-cycle board
WARNING: Bootloader doesn't support xmodem, forcing edcl upload
Static ARP record already exists, good
Connected: mm7705 (Greth 1Gbit #1)
Sending stream: 100%|████████████████████████████████████████████████████████████████████████████████████████▉| 183k/183k [00:00<00:00, 1.17MB/s]
Device: nand0 part: NAND 128MiB 3,3V 8-bit size: 256.0MiB erase_size: 128.0KiB write_size: 128.0KiB
```

##### Write image to flash via serial

```
~# rumboot-xflash -c mm7705 -m sf00 -f pattern.bin --write
[!] Using configuration file: /home/necromant/.rumboot.yaml
Detected chip:    mm7705 (1888TX018)
pl2303 /dev/ttyUSB0
Reset method:               PL2303HX
Baudrate:                   1000000 bps
Port:                       /dev/ttyUSB0
Preferred data transport:   edcl
WARN: Reset method doesn't support HOST mode switching
WARN: If things don't work - check jumpers!
WARNING: Bootloader doesn't support xmodem, forcing edcl upload
Static ARP record already exists, good
Connected: mm7705 (Greth 1Gbit #1)
Sending stream: 100%|████████████████████████████████████████████████████████████████████████████████████████▉| 174k/174k [00:00<00:00, 1.22MB/s]
Device: sf00 part: m25p32 size: 4.0MiB erase_size: 64.0KiB write_size: 64.0KiB
Writing sf00: 100%|█████████████████████████████████████████████████████████████████████████████████████████| 1.00M/1.00M [00:23<00:00, 44.6kB/s]

```

##### Write image to flash via edcl, reset automatically via pl2303

```
~# rumboot-xflash -c mm7705 -m sf00 -r pl2303 -f pattern.bin --write -e
[!] Using configuration file: /home/necromant/.rumboot.yaml
Detected chip:    mm7705 (1888TX018)
pl2303 /dev/ttyUSB0
Reset method:               PL2303HX
Baudrate:                   1000000 bps
Port:                       /dev/ttyUSB0
Preferred data transport:   edcl
WARN: Reset method doesn't support HOST mode switching
WARN: If things don't work - check jumpers!
WARNING: Bootloader doesn't support xmodem, forcing edcl upload
Static ARP record already exists, good
Connected: mm7705 (Greth 1Gbit #1)
Sending stream: 100%|████████████████████████████████████████████████████████████████████████████████████████▉| 174k/174k [00:00<00:00, 1.22MB/s]
Device: sf00 part: m25p32 size: 4.0MiB erase_size: 64.0KiB write_size: 64.0KiB
Writing sf00: 100%|█████████████████████████████████████████████████████████████████████████████████████████| 1.00M/1.00M [00:23<00:00, 44.6kB/s]

```
### rumboot-flashrom
#### Description

This tool works as a flashrom (http://flashrom.org) frontend/wrapper and allows you to read/write SPI flash chips that are (for some reasons) unsupported by rumboot-xflash. It works by uploading a stub that implements serprog protocol and attaching the flashrom to it. This tool can be used along with boards accesible via _rumboot-daemon_ over the network.


#### Options 

This tool works differently, compared to other tools. It accepts two sets of arguments:
* rumboot-flashrom arguments. They are needed to configure port, reset, find & upload stub etc.
* flashrom options. These are passed directly to flashrom utility. They do all the work.

In the example below

```
rumboot-flashrom -p /dev/ttyUSB1 -c basis -- --read img.bin
```

* _-p /dev/ttyUSB1 -c basis_ are rumboot-flashrom's options. 
* -- is the separator
* _--read img.bin_ are the flashrom options

```
~# rumboot-flashrom --help

```
```
~# rumboot-flashrom -c basis -m spi0-gpio0_5-cs 
Detected chip:    basis (1888ВС048)
SPL               rumboot-basis-PostProduction-serprog-spi0-gpio0_5-cs.bin
Reset method:     None
Baudrate:         115200 bps
Port:             socket://10.7.11.59:10001
FlashRom:         /usr/sbin/flashrom
FlashRom args:    
Sending stream: 100%|████████████████████████| 10.6k/10.6k [00:16<00:00, 659B/s]
Serprog stub ready!
Trying port 20000
Invoking flashrom: /usr/sbin/flashrom -p serprog:ip=127.0.0.1:20000 
flashrom  on Linux 4.19.0-5-amd64 (x86_64)
flashrom is free software, get the source code at https://flashrom.org

Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
serprog: Programmer name is "rumboot:basis"
serprog: requested mapping AT45CS1282 is incompatible: 0x1080000 bytes at 0x00000000fef80000.
Found Winbond flash chip "W25Q32.V" (4096 kB, SPI) on serprog.
No operations were specified.
```

##### Write data to SPI flash
WARNING: The size of the image file must always match the size of SPI flash. This a flashrom limitation.

```
~# rumboot-flashrom -m spi0-gpio0_5-cs  -c basis -- --write img.bin
```

##### Read data from SPI flash

```
~# rumboot-flashrom -m spi0-gpio0_5-cs  -c basis -- --read img.bin
```

##### For more advanced usage please refer to flashrom docs

https://flashrom.org/Flashrom


### rumboot-demon
#### Description

The idea behind _rumboot-daemon_ is to allow access allow several apps/users to work with the same board over network. Basically it's a serial-to-tcp bridge that also handles board resetting and queues users for access to the board. 

WARNING: rumboot-daemon lacks ANY kind of authorization or encryption and is supposed to be used in secure networks. Please, DO NOT EXPOSE IT TO THE INTERNET!!! You have been warned.

_rumboot-daemon_ can theoretically work without the _-r_ option, prompting the user to reset the board, but
in real life this is pretty much useless. 

See Typical Usage section for examples

When a user connects to rumboot-daemon, the tool powers on and resets the board, preloads it with any files specified on the commandline (if any) and redirects all serial traffic there. When the user disconnects, the board is powered off. If a second user connects when the board is in use, he/she would be placed in a virtual queue and wait until the board is available.


#### Options 
```
usage: rumboot-daemon [-h] [-l LOG] [-p port] [-b speed] [-f FILE]
                      [-c chip_id] [-r method] [--apc-ip APC_IP]
                      [--apc-user APC_USER] [--apc-pass APC_PASS]
                      [--apc-port APC_PORT] [-S value] [-P value]
                      [--pl2303-invert] [-L listen]

rumboot-daemon 0.9.1 - Collaborative board access daemon

(C) 2018-2020 Andrew Andrianov <andrew@ncrmnt.org>, RC Module
https://module.ru
https://github.com/RC-MODULE

optional arguments:
  -h, --help            show this help message and exit
  -f FILE, --file FILE  Image file (may be specified multiple times)
  -L listen, --listen listen
                        Specify address:port to listen (default 0.0.0.0:10000)

Serial Terminal Settings:
  -l LOG, --log LOG     Log terminal output to file
  -p port, --port port  Serial port to use
  -b speed, --baud speed
                        Serial line speed

File Handling:
  -c chip_id, --chip_id chip_id
                        Override chip id (by name or chip_id)

Reset Sequence options:
  These options control how the target board will be reset

  -r method, --reset method
                        Reset sequence to use (apc base mt12505 pl2303
                        powerhub)

apc reset sequence options:
  --apc-ip APC_IP       APC IP Address/hostname
  --apc-user APC_USER   APC IP username
  --apc-pass APC_PASS   APC IP username
  --apc-port APC_PORT   APC Power port

mt12505 reset sequence options:
  -S value, --ft232-serial value
                        FT232 serial number for MT125.05

pl2303 reset sequence options:
  -P value, --pl2303-port value
                        PL2303 physical port
  --pl2303-invert       Invert all pl2303 gpio signals
```


#### Typical Usage
##### Manually start the daemon with typical settings for 'basis' platform

```
~# rumboot-daemon -c basis -p /dev/ttyUSB0 -r pl2303
Detected chip:    basis (1888ВС048)
Reset method:     pl2303
Baudrate:         115200 bps
Serial Port:      /dev/ttyUSB0
Listen address:   ['0.0.0.0:10000']
Please, power-cycle board
waiting for a connection
```

Once the daemon is working, you can connect to it on port 10000 with rumboot-xrun:

```
rumboot-xrun -f rumboot-basis-PostProduction-spl-ok.bin -p socket://192.168.10.1:10000
```

N.B. Remember to specify the correct IP address.

##### Start the daemon on boot using systemd, listen on a different port

This will require
Create /etc/systemd/system/rumboot-daemon.service with the following contents

```ini
[Unit]
Description=Rumboot Daemon 
After=network.target

[Service]
User=developer
Group=codemonkeys
Type=simple
ExecStart=/home/developer/.local/bin/rumboot-daemon -r pl2303 -p /dev/ttyUSB0 -b 115200 -L 0.0.0.0:10001
Restart=always

[Install]
WantedBy=multi-user.target
```

Adjust the script for your desired User and Group

Next enable and start the daemon

```
  ~# systemctl enable rumboot-daemon
  ~# systemctl start rumboot-daemon
```

##### Preloading an application before giving the user access to the daemon


Sometimes it's useful to initialize some external memories (e.g. ddr) or execute an application before 
allowing user access to the board. You can specify one or several applications using the -f flag

```
~# rumboot-daemon -c basis -p /dev/ttyUSB0 -r pl2303 -f ddr_init.bin
Detected chip:    basis (1888ВС048)
Reset method:     pl2303
Baudrate:         115200 bps
Serial Port:      /dev/ttyUSB0
Listen address:   ['0.0.0.0:10000']
Please, power-cycle board
waiting for a connection
```

The ddr_init.bin in the example above should initialize the ddr memory and return to bootrom with code 0. _rumboot-daemon_ will send it to the board and only then redirect serial stream to the connected user. 
 

# Appendix A. Board reset methods

rumboot-xrun, rumboot-xflash and rumboot-daemon all accept the _-r_ option that configures the way boards are reset. The following reset methods are available: 

* pl2303 (linux-only) - Uses PL2303 chip GPIO for power and reset control. The two GPIO lines of PL2303HXA should be connected to reset and power lines. Most RC Module's reference boards have this circuit. rumboot-tools will try to guess the correct device if more than one pl2303 device are connected.

* mt12505 - Uses MT12505 board for power control. Internal RC Module's hardware. Don't use.

* apc - Uses telnet-accessible APC Switched Rack PDU. Requires a set of options to be supplied: 

```  
  --apc-ip APC_IP       APC IP Address/hostname
  --apc-user APC_USER   APC IP username
  --apc-pass APC_PASS   APC IP username
  --apc-port APC_PORT   APC Power port
```

If you wish to implement your own reset method - look into rumboot/resetSeq


### rumboot-combine
#### Description

_rumboot-combine_ is a simple to tool to compose a chain of several image file. Since Rumboot V2 the rom loader can load a chain of applications, one after another from flash media. Different boot sources require different size alignment, so this app can handle all that. For basis this tool is also used to append the .ini configuration file to the image.

#### Options

```
~# rumboot-combine --help
usage: rumboot-combine [-h] -i INPUT -o OUTPUT [-a ALIGN]

rumboot-combine 0.9.31 - RumBoot Image Merger Tool

(C) 2018-2021 Andrew Andrianov <andrew@ncrmnt.org>, STC "Module"
https://module.ru / https://github.com/RC-MODULE

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

options:
  -h, --help            show this help message and exit
  -i INPUT, --input INPUT
                        Input image file (may be specified several times)
  -o OUTPUT, --output OUTPUT
                        Output image
  -a ALIGN, --align ALIGN
                        Set alignment pattern of images in bytes or via
                        keyword (SD, physmap, ini)

```


#### Typical usage
##### Combine several apps into SPI flash image


```
  rumboot-combine -a spi -i ddr_init.bin -i memorytest.bin -i uboot.bin -o spiflash.bin
```

or 

```
  rumboot-combine -a 1 -i ddr_init.bin -i memorytest.bin -i uboot.bin -o spiflash.bin
```

##### Combine several apps into SD flash image

```
  rumboot-combine -a SD -i ddr_init.bin -i memorytest.bin -i uboot.bin -o spiflash.bin
```

##### Combine several apps into NOR flash image

```
  rumboot-combine -a physmap -i ddr_init.bin -i memorytest.bin -i uboot.bin -o spiflash.bin
```

##### Append ini to a chip config tool

```
  rumboot-combine -a ini -i tool.bin -i config.ini -o runme.bin
```

##### Combine images with custom alignment

```
  rumboot-combine -a 32 -i 1.bin -i 2.bin -o all.bin
```


## Appendix B. Adding Rumboot V1 header to your app

The tool expects that your compiled binary will already have a valid header that has all required fields except for the checksums and data length.
To to this, you have to add a single .c file to your project that will define the header structure.

The V1 is the initial header as implemented in 1888TX018. It's very basic, but may contain two entry points.

Your project should have the following C code that will put the header in your code.

```c
    extern void entry0();
    extern void entry1();

    #define BOOTHEADER_MAGIC__BOOT_IMAGE_VALID       0xbeefc0de
    #define BOOTHEADER_MAGIC__HOST_IMAGE_VALID       0xdeadc0de
    #define BOOTHEADER_MAGIC__RESUME_IMAGE_VALID     0xdeadbabe
    #define BOOTHEADER_MAGIC__CORERESET_IMAGE_VALID  0xdefec8ed


    struct legacy_bootheader
    {
        uint32_t magic;
        uint32_t length;
        uint32_t entry0;
        uint32_t entry1;
        uint32_t sum;
        uint32_t hdrsum; /* Checksum of all previous fields. */

        uint8_t imagedata[1]; /* Image data. */
    } __attribute__((packed));

    static const __attribute__((used)) __attribute__((section(".header")))
    struct legacy_bootheader hdr = {
    	.magic		= BOOTHEADER_MAGIC__BOOT_IMAGE_VALID,
    	.entry0	= (uint32_t) &entry0,
    	.entry1	= (uint32_t) &entry1,        
    };
```

A typical lds script tht will place that header at the very top of IM0 SRAM would look like this:

```ld
MEMORY
{
    IM0 (rwx): ORIGIN = 0x40000, LENGTH = 0x40000
}

SECTIONS
{


.text :
{
  KEEP(*(.header))
  *(.rumboot_platform_runtime_info);
  *(.text)
  *(.text.*)
  *(.rodata)
  *(.data)
} > IM0

.bss :
{
  rumboot_platform_bss_start = .;
  *(.bss)
  *(.bss.*)
  rumboot_platform_bss_end = .;
  rumboot_platform_heap_start = .;
  . = . + 0xf000; /* 60k heap */
  rumboot_platform_heap_end = .;
  rumboot_platform_spl_start = .;
  . = . + 0xf00;
  rumboot_platform_spl_end = .;
} > IM0

.data :
{
    *(.data)
} > IM0

.rodata :
{
  *(.rodata)
  *(.rodata).*
} > IM0

}
```

Once you compile and link your app, run 
```
rumboot-packimage -c -f file.bin
```
And it should do all magic, required to boot this image

## Appendix C. Adding Rumboot V2 header to your app

TODO: ...

## Appendix D. Adding NM6408 header to your app
TODO: ...

            

Raw data

            {
    "_id": null,
    "home_page": "http://github.com/RC-MODULE/rumboot-tools",
    "name": "rumboot-tools",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "rumboot image",
    "author": "Andrew Andrianov",
    "author_email": "andrew@ncrmnt.org",
    "download_url": "https://files.pythonhosted.org/packages/e0/c5/758d8adb7ed02a2aa997b7b99854df3444372eb9b41b258da8ed1a53fbe3/rumboot-tools-0.9.32.tar.gz",
    "platform": "any",
    "description": "# RumBoot Loader Tools\n\n## Summary\nThis repository is home to a set of tools to create, update and run rumboot v1, v2 and other images\nThis repository contains several tools\n\n\n* _rumboot-packimage_ - Adds/prints/updates checksums in image files\n* _rumboot-xrun_ - Directly executes images via serial line or network\n* _rumboot-xflash_ - Write on-board memories via serial line or network\n* _rumboot-flashrom_ - Wrapper around flashrom tool for advanced SPI flash programming\n* _rumboot-daemon_ - Provides network shared access to different boards\n\n\n\nSounds like too much? How you are you expected to use them in your app? \n\n* Use _rumboot-packimage_ to add valid checksums to your binaries, so that bootrom would accept them\n\n* Run them via UART using _rumboot-xrun_ (or your favourite jtag tool), flash them via _rumboot-xflash_\n\n* If rumboot-xflash doesn't work with your SPI Flash chip, check out _rumboot-flashrom_ instead\n\n* Have only one board for a few developers? Want easy remote access during COVID-19 or some other epidemic? Check out _rumboot-daemon_. \n\n* Want to combine a set of tests into one image? Check out the _rumboot-combine_ tool.\n\n## Chip IDs \n\nrumboot-tools use IDs to identify chips. Every supported chip has it's own id. \n\n\nPlatform Name | Part Number              | EDCL | Endianess | #Cores | ChipID | ChipRev | Image Format\n--------------|--------------------------|------|-----------|--------|--------|---------|------------------\nmm7705        | 1888\u0422\u0425018                | Yes  | big       | 2      | 1      | 1       | RumBoot V1\nmb7707        | \u041a1879\u0425\u04111YA               | Yes  | little    | -      | 2      | 1       | Legacy K1879XB1YA\nbasis         | 1888\u0412\u0421048                | No   | little    | 1      | 3      | 1       | RumBoot V2\noi10          | 1888\u0412\u041c018(A)/1888\u0412\u041c01H4 | Yes  | big       | 1      | 4      | 1       | RumBoot V2\nbbp3          | 1888\u0412\u0421058                | Yes  | little    | 1      | 5      | 1       | RumBoot V2\nnm6408        | 1888\u0412\u0421058                | Yes  | little    | 1      | 6      | 1       | Legacy NM6408\n              |                          |      |           |        |        |         |\nzed           | Zed Board / Tang Hex     | No   | little    | 2      | 255    | 1       | Other\nrpi4          | BCM2711 (Raspberry Pi 4) | No   | little    | 4      | 255    | 2       | Other\n\nSince different chips have different ROM loaders, default baudrates, flash memories and etc., some tools require you either set ChipId explicitly (via -c option) or try their best to guess it from image file header. Only newer (rumboot V2 and later) image formats have a dedicated field called chip_id. \n\nYou can either specify chip id via it's number or via platform name, whichever suits you. (`-c 2` and `-c mb7707` do the same).\n\nFor rumboot v2 and later, if the chip id doesn't match the one in silicon, the image is considered invalid\n\nThirdparty chips that are used for testing and prototyping always have chip id set as 255. \n\nThe chip revision may be used to distinguish different versions of the same chip, if any. It is only\nsupported by Rumboot V2 headers and later. If Chip revision of the file you are uploading and the one stored \nin silicon don't match - you'll get a warning.\n\n## EDCL Notes\n\n### Basic stuff\nUart is the simplest possible interface for all debugging stuff, but it's also quite slow if you are going\nto send huge files (e.g. linux kernel, initrd, etc.) Starting with version 0.9.4 rumboot-tools support a side-channel to do data transfers. Right now the only possible sidechannel is EDCL.\n\nEDCL stands for 'Ethernet communications debug link'. It provides a way to access physical memory via a special protocol over UDP. It exists in all RC Module's chips (except 'basis' platform). The protocol has *NO* security at all, so please disable edcl in a production enviroment. If you didn't get it, I'll write it in *bold*:\n\n*NEVER EVER ENABLE EDCL IN A PRODUCTION ENVIRONMENT OR YOU'LL MAKE EASY PREY FOR HAX0RS!!! *\n\n### Setting up network for EDCL\n\nEDCL IP and MAC adresses are hardcoded in silicon. Therefore putting several same chips in one LAN is not likely to work. The recommended setup is a dedicated network interface directly connected to the target board.\n\nIP: _192.168.0.1_ \nNetMask _255.255.0.0_\n\nAfter the interface setup is done, just add _-e_ option for xrun/xflash and enjoy the speedup\n\n### ARP Bugs and workarounds\n\nSome old chips have an invalid IP set as 192.168.0.0. The OS will discard ARP replies as invalid. However since EDCL only checks mac, we can set a static ARP record. The xrun does that automatically when needed using sudo/runas on linux/windows respectively. If a static record exists, no static record is added. When this hack is needed - you'll see UAC request in windows. In linux sudo will ask you for a password.\n\n### IP clash bug and workarounds \n\nOkay, so despite the warning above, you want to use several different chips in the same LAN and noticed that different chips (e.g. mm7705 and oi10) have the same IP, though MACs are unique. There's a special flag called \n--force-static-arp that make xrun/xflash always drop existing arp records (if any) and add proper ones.\nJust note that this usage case is not 'officially' supported and can cause confusion of you don't fully understand what's happening. \n\n## Installation\n### From pypi (Recommended for Linux)\n\nThis is the simplest way. Just type:\n\n```\n    pip3 install rumboot-tools\n```\n\nor \n\n```\n    pip3 install rumboot-tools\n```\n\nAnd you're all set. \n\n_WARNING_: Windows installations need Visual Studio Build Tools installed. It\u2019s a huge download, but it\u2019s\nneeded. Grab it at [Microsoft download\nsite](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017). \n\n_HINT_: We provide binary offline windows installers for some released versions. The don't need those and are easier to install.\n\n### From a binary release zip (Recommended for Windows)\n\nGrab a zip download from [Github Releases Page](https://github.com/RC-MODULE/rumboot-tools/releases) or directly from the artifacts tab of [Appveyor CI Page](https://ci.appveyor.com/project/nekromant/rumboot-tools)\n\nThe zip must match the python version currently installed. Unzip the archive and run either install_system.cmd or install_venv.cmd\n\n- install_system.cmd installs rumboot-tools and all dependencies into system directories and they are accessible immediately after installation.\n\n- install_venv.cmd installs rumboot-tools and all dependencies into 'venv' directory (will be created). Add venv\\Scripts to your %PATH% to run tools from the command line.\n### From source (Linux, Windows)\n\nThis is pretty much as simple as it is. Just run the following:\n\n```\n    pip3 install .\n```\n\nor \n\n```\n    pip3 install .\n```\n\nP.S. Make sure you have a proper internet connection, or pip will fail to fetch dependencies.\n\n_WARNING_: Windows installations need Visual Studio Build Tools installed. It\u2019s a huge download, but it\u2019s\nneeded. Grab it at [Microsoft download\nsite](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017). \n\n_HINT_: We provide binary offline installers for some released versions. The don't need those and are easier to install.\n\n## Tool descriptions\n\n### rumboot-packimage\n#### Description\n\nThis tool adds/checks/updates checksums in existing images. The image must already have a proper header placed by the linker. \n\n#### Options \n\n```\n~# rumboot-packimage --help\nusage: rumboot-packimage [-h] -f FILE [-i] [-c] [-C] [-r] [-R relocation] [-Z]\n                         [-U] [-z value] [-a value] [-F value value]\n                         [--set-data offset value] [-g key] [-s key value]\n                         [-e] [-E] [-w WRAP]\n\nrumboot-packimage 0.9.31 - Universal RumBoot Image Manipulation Tool\n\n(C) 2018-2021 Andrew Andrianov <andrew@ncrmnt.org>, STC \"Module\"\nhttps://module.ru / https://github.com/RC-MODULE\n\nThis program is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; either version 2 of the License, or\n(at your option) any later version.\n\noptions:\n  -h, --help            show this help message and exit\n  -f FILE, --file FILE  image file\n  -i, --info            Show information about the image\n  -c, --checksum        This option will modify the file! Calculates valid\n                        checksums to the header. The length is set to cover\n                        the full length of file ONLY if it's zero.\n  -C, --checksum_fix_length\n                        This option will modify the file! The same as\n                        --checksum/-c, but always overrides length to covert\n                        the full length of file\n  -r, --raw             Display raw header field names\n  -R relocation, --relocate relocation\n                        Tell bootrom to relocate the image at the specified\n                        address before executing it. Only RumBootV3 and above\n  -Z, --compress        Compress image data with heatshrink algorithm (V3 or\n                        above only)\n  -U, --decompress      Decompress image data with heatshrink algorithm (V3 or\n                        above only)\n  -z value, --add_zeroes value\n                        This option will add N bytes of zeroes to the end of\n                        the file (after checksummed area). This is required to\n                        avoid propagating 'X' during the next image check\n                        during simulation. Normally, you do not need this\n                        option\n  -a value, --align value\n                        Pad resulting image size to specified alignment.\n                        Remember to add -C to have correct checksums!\n  -F value value, --flag value value\n                        Set image flag to a desired value. Only RumBootV3 or\n                        above\n  --set-data offset value\n                        Sets data at byte 'offset' to value 'offset'\n  -g key, --get key     Get a single field from header. Nothing else will be\n                        printed. NOTE: The value will be formatted as hex\n  -s key value, --set key value\n                        This option will modify the file! Set a header key to\n                        specified value. Use -r flag on an existing image to\n                        find out what keys exist. Use -c to update the\n                        checksums\n  -e, --reverse-endianness\n                        Use this option to reverse endianness of all headers.\n                        This will not touch data. For testing only\n  -E, --reverse-data-endianness\n                        Use this option to reverse endianness of data section.\n                        This will not touch header. This might be required for\n                        booting some nmc chips.\n  -w WRAP, --wrap WRAP  Use this option to wrap arbitrary data to V1/V2/V3\n                        images.\n\n```\n\n#### Typical uses\n\n##### Check if an image file is valid\n\n```\n~# rumboot-packimage -f myimage.bin\n```\n\nThis command will silently validate an image and exit code 0 if everything's okay. 1 if something isn't right. Useful for scripts.\n\n##### Dump header information\n\n```\n~# rumboot-packimage -f image.bin -i\n\nDetected RumBootV1 image, endian: big\n=== RumBootV1 Header Information ===\nEndianess:              big\nMagic:                  0xbeefc0de\nData Length:            69108\nHeader CRC32:           0x1e955d90 [Valid]\nData CRC32:             0x1929eb8e [Valid]\n\n```\n\nThis command will dump all header contents of a file\n\n##### Write correct data length and checksums to the image\n\n```\n~# rumboot-packimage -f image.bin -\u0441\n\nDetected RumBootV1 image, endian: big\nWrote valid checksums to image header\n=== RumBootV1 Header Information ===\nEndianess:              big\nMagic:                  0xbeefc0de\nData Length:            69108\nHeader CRC32:           0x1e955d90 [Valid]\nData CRC32:             0x1929eb8e [Valid]\n```\n\n\n### rumboot-xrun\n#### Description\n\nThis tool directly uploads a binary to the target board, executes it and provides you with human-readable output. It also resets the board if necessary.\n\n#### Options \n\n```\n~# rumboot-xrun --help\nusage: rumboot-xrun [-h] [-f FILE] [-c chip_id] [-l LOG] [-p port] [-b speed]\n                    [-e] [--force-static-arp] [--edcl-ip EDCL_IP]\n                    [--edcl-mac EDCL_MAC] [--edcl-timeout EDCL_TIMEOUT]\n                    [-r method] [--apc-host APC_HOST] [--apc-user APC_USER]\n                    [--apc-pass APC_PASS] [--apc-outlet APC_OUTLET]\n                    [--hass-power-switch]\n                    [--hass-reset-switch HASS_RESET_SWITCH]\n                    [--hass-host-switch HASS_HOST_SWITCH]\n                    [--hass-token HASS_TOKEN] [--hass-server HASS_SERVER]\n                    [--mdb-ctl-port MDB_CTL_PORT]\n                    [--mt12505-serial MT12505_SERIAL] [--pl2303-invert-reset]\n                    [--pl2303-invert-power] [--pl2303-swap]\n                    [--powerhub-usb-port POWERHUB_USB_PORT]\n                    [-A [PLUSARGS ...]] [-R] [-I] [--replay-no-exit]\n\nrumboot-xrun 0.9.31 - RumBoot X-Modem execution tool\n\n(C) 2018-2021 Andrew Andrianov <andrew@ncrmnt.org>, STC \"Module\"\nhttps://module.ru / https://github.com/RC-MODULE\n\nThis program is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; either version 2 of the License, or\n(at your option) any later version.\n\noptions:\n  -h, --help            show this help message and exit\n  -f FILE, --file FILE  Image file (may be specified multiple times)\n  -R, --rebuild         Attempt to rebuild/update target before uploading\n  -I, --stdin           Use stdin redirection to tty\n  --replay-no-exit      Do not exit on panics/rom returns when replaying logs\n                        (for batch analysis)\n\nFile Handling:\n  -c chip_id, --chip_id chip_id\n                        Override chip id (by name or chip_id)\n\nConnection Settings:\n  -l LOG, --log LOG     Log terminal output to file\n  -p port, --port port  Serial port to use\n  -b speed, --baud speed\n                        Serial line speed\n  -e, --edcl            Use edcl for data uploads (when possible)\n  --force-static-arp    Always add static ARP entries\n  --edcl-ip EDCL_IP     Use specific EDCL IP address (default - from chip id)\n  --edcl-mac EDCL_MAC   Use specific EDCL MAC address (default - from chip id)\n  --edcl-timeout EDCL_TIMEOUT\n                        Use specific EDCL MAC address (default - from chip id)\n\nReset Sequence options:\n  These options control how the target board will be reset\n\n  -r method, --reset method\n                        Reset sequence to use (apc base hass Serial mdb\n                        mt12505 pl2303 powerhub)\n\napc reset sequence options:\n  --apc-host APC_HOST   APC IP Address/hostname\n  --apc-user APC_USER   APC Username\n  --apc-pass APC_PASS   APC Password\n  --apc-outlet APC_OUTLET\n                        APC Outlet Number\n\nhass reset sequence options:\n  --hass-power-switch   Home Assistant power switch\n  --hass-reset-switch HASS_RESET_SWITCH\n                        Home Assistant reset switch\n  --hass-host-switch HASS_HOST_SWITCH\n                        Home Assistant host switch\n  --hass-token HASS_TOKEN\n                        Secret token\n  --hass-server HASS_SERVER\n                        Hass server URL\n\nmdb reset sequence options:\n  --mdb-ctl-port MDB_CTL_PORT\n                        Malina Debug Bridge control port\n\nmt12505 reset sequence options:\n  --mt12505-serial MT12505_SERIAL\n                        FT232RL serial number to use\n\npl2303 reset sequence options:\n  --pl2303-invert-reset\n                        Invert pl2303 reset signal\n  --pl2303-invert-power\n                        Invert pl2303 power signal\n  --pl2303-swap         Swap pl2303 reset and power mapping\n\npowerhub reset sequence options:\n  --powerhub-usb-port POWERHUB_USB_PORT\n                        powerhub port number\n\nPlusargs parser options:\n  \n          rumboot-xrun can parse plusargs (similar to verilog simulator)\n          and use them for runtime file uploads. This option is intended\n          to be used for\n          \n\n  -A [PLUSARGS ...], --plusargs [PLUSARGS ...]\n\n```\n\n#### Configuration file\n\nThe rumboot-xrun tries to find a configuration file on your system in the following locations:\n\n* ~/.rumboot.yaml\n\n* /etc/rumboot.yaml\n\nExample configuration file is provided below:\n\n```yaml\nxrun:\n    defaults:\n        port: /dev/ttyUSB0\n    chips:\n        oi10:   \n            port: /dev/ttyUSB1\n            baudrate: 19200\n        basis:  \n            port: /dev/ttyUSB2\n        mm7705: \n            port: socket://10.7.11.59:10002\n```\n\nThe configuration file contains default ports and speeds for all known chip ids. If you supply a file to rumboot-xrun without any other options, rumboot-xrun will find out the chip id from the header file and set default port and baudrate accordingly. \n\nIf no configuration file can be found in any location, the default serial port will be /dev/ttyUSB0. Default baudrate will be taken from the internal chip database and should match most typical settings\n\n\n#### Typical usage\n##### Execute a file on bare metal enviroment\n\n```\n~# rumboot-xrun -f myimage.bin -p /dev/ttyUSB0\nDetected chip:    oi10 (1888\u0412\u041c018(A)/1888\u0412\u041c01H4)\nReset method:     None\nBaudrate:         115200 bps\nPort:             /dev/ttyUSB0\nPlease, power-cycle board\n\n\n\n\n\n\n    RC Module's          __                __\n   _______  ______ ___  / /_  ____  ____  / /_\n  / ___/ / / / __ `__ \\/ __ \\/ __ \\/ __ \\/ __/\n / /  / /_/ / / / / / / /_/ / /_/ / /_/ / /_\n/_/   \\__,_/_/ /_/ /_/_.___/\\____/\\____/\\__/\noi10 | Production | HEAD-0a2dc3a8\n--- RumBoot Configuration ---\nForce Host Mode: enabled\nSelftest:        disabled\nEDCL/RMAP:       enabled\nUART speed:      115200 bps\nMax SPL size:    131072 bytes\nSD Card:         Not inserted\nCPU ECC:         disabled\nNOR/SRAM ECC:    disabled\nDirect NOR boot: disabled\nReset cause:     SCTL: 0x800 SPR_DBCR0: 0x0\n---          ---          ---\nboot: host: Entering Host Mode\nboot: host: GRETH0 EDCL MAC: ec:17:66:e:10:0 IP: 192.168.1.48\nboot: host: GRETH1 EDCL MAC: ec:17:66:e:10:1 IP: 192.168.1.49\nboot: host: Hit 'X' for X-Modem upload\n\n\n\nboot: host: Received 40960 bytes, executing in 100ms\nboot: host: --- Boot Image Header ---\nboot: host: Magic:            0xb01dface\nboot: host: Header version:   2\nboot: host: Chip Id:          4\nboot: host: Chip Revision:    1\nboot: host: Data length:      40800\nboot: host: Header CRC32:     0xb47a8252\nboot: host: Data CRC32:       0x87065aa6\nboot: host: ---        ---        ---\nHello, World!\nboot: host: Back in rom, code 0\n\n```\n\nThis command waits for bootrom prompt, uploads a file via xmodem and prints everything received to stdout acting pretty much the same, as your favorite terminal program. The exit code from the program will be the exit code of rumboot-run (0 in the example above), therefore you can rumboot-xrun in your scripts during unit-testing.\n\nNOTE: Make sure the jumpers on the board are set to 'host mode'. After running the command press the reset button or supply power to the board.\n\n##### Start u-boot and enter interactive prompt\n\n```\n~# rumboot-xrun -f spl/u-boot-spl-dtb.rbi -f u-boot-dtb.img -e -I -r pl2303\n\nDetected chip:    oi10 (1888\u0412\u041c018(A)/1888\u0412\u041c01H4)\npl2303: /dev/ttyUSB8 detected at USB path 2-1.2\nReset method:               pl2303\nBaudrate:                   115200 bps\nPort:                       /dev/ttyUSB8\nPreferred data transport:   xmodem\n\n\n\n    RC Module's                           \n   _______  ______ ___  / /_  ____  ____  / /_\n  / ___/ / / /  ` \\/  \\/  \\/  \\/ /\n / /  / /_/ / / / / / / /_/ / /_/ / /_/ / /_  \n/_/   \\__,_/_/ /_/ /_/_.___/\\____/\\____/\\__/  \noi10 | Production | HEAD-0a2dc3a8\n--- RumBoot Configuration ---\nForce Host Mode: enabled\nSelftest:        disabled\nEDCL/RMAP:       enabled\nUART speed:      115200 bps\nMax SPL size:    131072 bytes\nSD Card:         Inserted\nCPU ECC:         enabled\nNOR/SRAM ECC:    disabled\nDirect NOR boot: disabled\nReset cause:     SCTL: 0x800 SPR_DBCR0: 0x0\n---          ---          ---\nboot: host: Entering Host Mode\nboot: host: GRETH0 EDCL MAC: ec:17:66:e:10:0 IP: 192.168.1.48\nboot: host: GRETH1 EDCL MAC: ec:17:66:e:10:1 IP: 192.168.1.49\nboot: host: Hit 'X' for X-Modem upload\nSending binary: 43.0kB [00:06, 6.73kB/s]                                        \n\n\n\nboot: host: Received 44032 bytes, executing in 100ms\nboot: host: --- Boot Image Header ---\nboot: host: Magic:            0xb01dface\nboot: host: Header version:   2\nboot: host: Chip Id:          4\nboot: host: Chip Revision:    1\nboot: host: Data length:      43907\nboot: host: Header CRC32:     0xb6bc96ec\nboot: host: Data CRC32:       0x6fd63f77\nboot: host: ---        ---        ---\n\nU-Boot SPL 2020.04-rc1-g67f6b3d9a6-dirty (Jul 21 2020 - 11:50:55 +0300)\nTesting SDRAM...\nTrying to boot from RUMBOOT\nSkip rumboot chain - host mode\nTrying to boot from X-MODEM/EDCL\nUPLOAD to 0x21e00000. 'X' for X-modem, 'E' for EDCL\nSending binary: 296kB [00:29, 10.4kB/s]                                         \n xyzModem - CRC mode, 0(SOH)/296(STX)/0(CAN) packets, 0 retries\nLoaded 302430 bytes\nThe image has been loaded\n\n\nU-Boot 2020.04-rc1-g67f6b3d9a6-dirty (Jul 21 2020 - 11:50:55 +0300)\n\nCPU:   RC Module PowerPC 476FP core\nModel: RCM MB150-02\nDRAM:  32 MiB\nMMC:   mmc0@D002C000: 0\nLoading Environment from MMC... OK\nIn:    uart0@D0029000\nOut:   uart0@D0029000\nErr:   uart0@D0029000\nNet:   eth0: greth0@D002A000\nHit any key to stop autoboot:  0 \n=>\n\n```\n\nThis command resets the board, uploads u-boot spl, u-boot and enters interactive mode for you to play with.\nThe uploads are performed using xmodem.\n\n##### Start u-boot and enter interactive prompt, prefer edcl for uploads\n\n```\n~# rumboot-xrun -f spl/u-boot-spl-dtb.rbi -f u-boot-dtb.img -e -I -r pl2303\n\nDetected chip:    oi10 (1888\u0412\u041c018(A)/1888\u0412\u041c01H4)\npl2303: /dev/ttyUSB8 detected at USB path 2-1.2\nReset method:               pl2303\nBaudrate:                   115200 bps\nPort:                       /dev/ttyUSB8\nPreferred data transport:   edcl\n\n\n\n    RC Module's                           \n   _______  ______ ___  / /_  ____  ____  / /_\n  / ___/ / / /  ` \\/  \\/  \\/  \\/ /\n / /  / /_/ / / / / / / /_/ / /_/ / /_/ / /_  \n/_/   \\__,_/_/ /_/ /_/_.___/\\____/\\____/\\__/  \noi10 | Production | HEAD-0a2dc3a8\n--- RumBoot Configuration ---\nForce Host Mode: enabled\nSelftest:        disabled\nEDCL/RMAP:       enabled\nUART speed:      115200 bps\nMax SPL size:    131072 bytes\nSD Card:         Inserted\nCPU ECC:         enabled\nNOR/SRAM ECC:    disabled\nDirect NOR boot: disabled\nReset cause:     SCTL: 0x800 SPR_DBCR0: 0x0\n---          ---          ---\nboot: host: Entering Host Mode\nboot: host: GRETH0 EDCL MAC: ec:17:66:e:10:0 IP: 192.168.1.48\nboot: host: GRETH1 EDCL MAC: ec:17:66:e:10:1 IP: 192.168.1.49\nboot: host: Hit 'X' for X-Modem upload\nConnected: oi10 (Greth #1)\nSending binary: 100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2589| 42.9k/42.9k [00:00<00:00, 1.15MB/s]\nboot: host: --- Boot Image Header ---\nboot: host: Magic:            0xb01dface\nboot: host: Header version:   2\nboot: host: Chip Id:          4\nboot: host: Chip Revision:    1\nboot: host: Data length:      43907\nboot: host: Header CRC32:     0xb6bc96ec\nboot: host: Data CRC32:       0x6fd63f77\nboot: host: ---        ---        ---\n\nU-Boot SPL 2020.04-rc1-g67f6b3d9a6-dirty (Jul 21 2020 - 11:50:55 +0300)\nTesting SDRAM...\nTrying to boot from RUMBOOT\nSkip rumboot chain - host mode\nTrying to boot from X-MODEM/EDCL\nUPLOAD to 0x21e00000. 'X' for X-modem, 'E' for EDCL\nSending binary: 100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2589| 295k/295k [00:00<00:00, 1.18MB/s]\nThe image has been loaded\n\n\nU-Boot 2020.04-rc1-g67f6b3d9a6-dirty (Jul 21 2020 - 11:50:55 +0300)\n\nCPU:   RC Module PowerPC 476FP core\nModel: RCM MB150-02\nDRAM:  32 MiB\nMMC:   mmc0@D002C000: 0\nLoading Environment from MMC... OK\nIn:    uart0@D0029000\nOut:   uart0@D0029000\nErr:   uart0@D0029000\nNet:   eth0: greth0@D002A000\nHit any key to stop autoboot:  0 \n=>\n```\n\nThis command resets the board, uploads u-boot spl, u-boot and enters interactive mode for you to play with.\nThe uploads are performed using edcl side-channel.\n\n##### Execute a file, custom port/speed, automatically reset board via pl2303\n\n```\n~# rumboot-xrun -f myimage.bin -p /dev/ttyUSB0 -b 19200 -r pl2303\n```\nThe -r option specifies one of the ways to reset board. For more info on\nboard reset mechanism, please see Appendix A\n\n##### Execute a chain of files without reset\n\n```\n~# rumboot-xrun -f init_ddr.bin -f test_ddr.bin -r pl2303\n```\n\nThe -f option can be specified multiple times. Every image should exit with code 0 for the chain to move on. (See rumboot docs for more about this logic)\n\n##### Log serial output to a file\n\n```\n~# rumboot-xrun -f init_ddr.bin -f test_ddr.bin -l uart.log\n```\n\nThe -l option can be used to log output to a file\n\n##### Using stdin\n\n```\n~# rumboot-xrun -f init_ddr.bin -I \n```\n\nThe -I options makes the terminal _bi-directional_. E.g. You can not only see what the board sends you, but you can also type in some commands. \n\n##### Auto-rebuilding project\n\n```\n~# rumboot-xrun -R -f example.bin \n```\n\nThe -R options convenience option invokes automatically _cmake --build example.all_ in the directory with the binary file. The target name is calculating by changing .bin to .all. This is hardcoded for 'rumboot' SDK for now.\n\n##### Automatic stack trace decoding\n\nrumboot-xrun provides a mechanism to decode runtime stack traces. To use this functionality, you have to place a .dmp file with disassembly in the same directory and with the same name as the .bin file\n\n### rumboot-xflash\n#### Description\n\nThis tool allows you to quickly program different flashes attached to the target chip. It is done by uploading a precompiled stub that implements the programming protocol of the target flash media and accepts an xmodem payload. Pre-compiled stubs are shipped with rumboot-tools.\nFor most chips these are heavily hacked u-boot spls. They run fully in internal on-chip SRAM, therefore don't care what DDR/SDRAM memories you have attached.\n\nThe tool provides users currently with two transports for programming: EDCL and SERIAL (XMODEM). \n\n*EDCL* is generally faster, but requires a direct connection between you PC and the target board via ethernet. Some legacy bootroms only support EDCL for initial upload. \n\n*Serial* (xmodem) is always present on newer chips. Some newer chips lack the edcl ip core (basis)\n\nThe transport for actual programming is serial by default, edcl can be selected by adding _-e_ switch. \n\nWriting will always be about twice slower than reading, since readback is usually integrated in the SPL doing all the work. \n\n*PRO TIP:* You can just write the image to SD Card by popping it into your PC. That would usually be waaay faster. \n#### Options \n\n```\n~# rumboot-xflash --help\nusage: rumboot-xflash [-h] [-f FILE] [-c chip_id] [-l LOG] [-p port]\n                      [-b speed] [-e] [--force-static-arp] [--edcl-ip EDCL_IP]\n                      [--edcl-mac EDCL_MAC] [--edcl-timeout EDCL_TIMEOUT] [-v]\n                      [-m memory] [-z SPL_PATH] [--no-spl] [-o OFFSET]\n                      [-L LENGTH] [-R] [-W] [-E] [-F FIRMWARE_FILE]\n                      [-U UPLOAD_BAUDRATE] [-r method] [--apc-host APC_HOST]\n                      [--apc-user APC_USER] [--apc-pass APC_PASS]\n                      [--apc-outlet APC_OUTLET] [--hass-power-switch]\n                      [--hass-reset-switch HASS_RESET_SWITCH]\n                      [--hass-host-switch HASS_HOST_SWITCH]\n                      [--hass-token HASS_TOKEN] [--hass-server HASS_SERVER]\n                      [--mdb-ctl-port MDB_CTL_PORT]\n                      [--mt12505-serial MT12505_SERIAL]\n                      [--pl2303-invert-reset] [--pl2303-invert-power]\n                      [--pl2303-swap] [--powerhub-usb-port POWERHUB_USB_PORT]\n\nrumboot-xflash 0.9.31 - RumBoot firmware updater tool\n\n(C) 2018-2021 Andrew Andrianov <andrew@ncrmnt.org>, STC \"Module\"\nhttps://module.ru / https://github.com/RC-MODULE\n\nThis program is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; either version 2 of the License, or\n(at your option) any later version.\n\noptions:\n  -h, --help            show this help message and exit\n  -f FILE, --file FILE  Image file (may be specified multiple times)\n  -v, --verbose         Print serial debug messages during update\n  -m memory, --memory memory\n                        Memory program. Help for a list of memories\n  -z SPL_PATH, --spl-path SPL_PATH\n                        Path for SPL writers (Debug only)\n  --no-spl              Do not upload spl, assume it boots on it's own (Debug\n                        only)\n  -o OFFSET, --offset OFFSET\n                        Memory offset for read/write operations\n  -L LENGTH, --length LENGTH\n                        How many bytes to read/write (defaults to whole\n                        file/flash)\n  -R, --read            Read flash to file\n  -W, --write           Write flash from file\n  -E, --erase           Erase flash\n  -F FIRMWARE_FILE, --firmware-file FIRMWARE_FILE\n                        Write firmware from configuration file\n  -U UPLOAD_BAUDRATE, --upload-baudrate UPLOAD_BAUDRATE\n                        Change baudrate for uploads\n\nFile Handling:\n  -c chip_id, --chip_id chip_id\n                        Override chip id (by name or chip_id)\n\nConnection Settings:\n  -l LOG, --log LOG     Log terminal output to file\n  -p port, --port port  Serial port to use\n  -b speed, --baud speed\n                        Serial line speed\n  -e, --edcl            Use edcl for data uploads (when possible)\n  --force-static-arp    Always add static ARP entries\n  --edcl-ip EDCL_IP     Use specific EDCL IP address (default - from chip id)\n  --edcl-mac EDCL_MAC   Use specific EDCL MAC address (default - from chip id)\n  --edcl-timeout EDCL_TIMEOUT\n                        Use specific EDCL MAC address (default - from chip id)\n\nReset Sequence options:\n  These options control how the target board will be reset\n\n  -r method, --reset method\n                        Reset sequence to use (apc base hass Serial mdb\n                        mt12505 pl2303 powerhub)\n\napc reset sequence options:\n  --apc-host APC_HOST   APC IP Address/hostname\n  --apc-user APC_USER   APC Username\n  --apc-pass APC_PASS   APC Password\n  --apc-outlet APC_OUTLET\n                        APC Outlet Number\n\nhass reset sequence options:\n  --hass-power-switch   Home Assistant power switch\n  --hass-reset-switch HASS_RESET_SWITCH\n                        Home Assistant reset switch\n  --hass-host-switch HASS_HOST_SWITCH\n                        Home Assistant host switch\n  --hass-token HASS_TOKEN\n                        Secret token\n  --hass-server HASS_SERVER\n                        Hass server URL\n\nmdb reset sequence options:\n  --mdb-ctl-port MDB_CTL_PORT\n                        Malina Debug Bridge control port\n\nmt12505 reset sequence options:\n  --mt12505-serial MT12505_SERIAL\n                        FT232RL serial number to use\n\npl2303 reset sequence options:\n  --pl2303-invert-reset\n                        Invert pl2303 reset signal\n  --pl2303-invert-power\n                        Invert pl2303 power signal\n  --pl2303-swap         Swap pl2303 reset and power mapping\n\npowerhub reset sequence options:\n  --powerhub-usb-port POWERHUB_USB_PORT\n                        powerhub port number\n\n```\n```\n~# rumboot-xflash -m help -c mm7705\n[!] Using configuration file: /home/necromant/.rumboot.yaml\nAvailable memories for chip 'mm7705'\n    mmc0: SD/MMC Card\n    sf00: SPI Flash\n     nor: NOR memory\n    nand: NAND memory\n\n```\n\nOr you can just specify the file you are going to flash instead, the tool will find out chip id from it. \nThe file must have the relevant header (See rumboot-packimage for header manipulation)\n\n```\n~# rumboot-xflash -m help -f rumboot-mm7705-Production-irq-irq-atomics.bin \n[!] Using configuration file: /home/necromant/.rumboot.yaml\nAvailable memories for chip 'mm7705'\n    mmc0: SD/MMC Card\n    sf00: SPI Flash\n     nor: NOR memory\n    nand: NAND memory\n```\n\n##### Print information about attached flash device\n\n```\n~# rumboot-xflash -c mm7705 -m nand\n[!] Using configuration file: /home/necromant/.rumboot.yaml\nDetected chip:    mm7705 (1888TX018)\nReset method:               None\nBaudrate:                   1000000 bps\nPort:                       /dev/ttyUSB0\nPreferred data transport:   xmodem\nWARN: Reset method doesn't support HOST mode switching\nWARN: If things don't work - check jumpers!\nPlease, power-cycle board\nWARNING: Bootloader doesn't support xmodem, forcing edcl upload\nStatic ARP record already exists, good\nConnected: mm7705 (Greth 1Gbit #1)\nSending stream: 100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2589| 183k/183k [00:00<00:00, 1.17MB/s]\nDevice: nand0 part: NAND 128MiB 3,3V 8-bit size: 256.0MiB erase_size: 128.0KiB write_size: 128.0KiB\n```\n\n##### Write image to flash via serial\n\n```\n~# rumboot-xflash -c mm7705 -m sf00 -f pattern.bin --write\n[!] Using configuration file: /home/necromant/.rumboot.yaml\nDetected chip:    mm7705 (1888TX018)\npl2303 /dev/ttyUSB0\nReset method:               PL2303HX\nBaudrate:                   1000000 bps\nPort:                       /dev/ttyUSB0\nPreferred data transport:   edcl\nWARN: Reset method doesn't support HOST mode switching\nWARN: If things don't work - check jumpers!\nWARNING: Bootloader doesn't support xmodem, forcing edcl upload\nStatic ARP record already exists, good\nConnected: mm7705 (Greth 1Gbit #1)\nSending stream: 100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2589| 174k/174k [00:00<00:00, 1.22MB/s]\nDevice: sf00 part: m25p32 size: 4.0MiB erase_size: 64.0KiB write_size: 64.0KiB\nWriting sf00: 100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 1.00M/1.00M [00:23<00:00, 44.6kB/s]\n\n```\n\n##### Write image to flash via edcl, reset automatically via pl2303\n\n```\n~# rumboot-xflash -c mm7705 -m sf00 -r pl2303 -f pattern.bin --write -e\n[!] Using configuration file: /home/necromant/.rumboot.yaml\nDetected chip:    mm7705 (1888TX018)\npl2303 /dev/ttyUSB0\nReset method:               PL2303HX\nBaudrate:                   1000000 bps\nPort:                       /dev/ttyUSB0\nPreferred data transport:   edcl\nWARN: Reset method doesn't support HOST mode switching\nWARN: If things don't work - check jumpers!\nWARNING: Bootloader doesn't support xmodem, forcing edcl upload\nStatic ARP record already exists, good\nConnected: mm7705 (Greth 1Gbit #1)\nSending stream: 100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2589| 174k/174k [00:00<00:00, 1.22MB/s]\nDevice: sf00 part: m25p32 size: 4.0MiB erase_size: 64.0KiB write_size: 64.0KiB\nWriting sf00: 100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 1.00M/1.00M [00:23<00:00, 44.6kB/s]\n\n```\n### rumboot-flashrom\n#### Description\n\nThis tool works as a flashrom (http://flashrom.org) frontend/wrapper and allows you to read/write SPI flash chips that are (for some reasons) unsupported by rumboot-xflash. It works by uploading a stub that implements serprog protocol and attaching the flashrom to it. This tool can be used along with boards accesible via _rumboot-daemon_ over the network.\n\n\n#### Options \n\nThis tool works differently, compared to other tools. It accepts two sets of arguments:\n* rumboot-flashrom arguments. They are needed to configure port, reset, find & upload stub etc.\n* flashrom options. These are passed directly to flashrom utility. They do all the work.\n\nIn the example below\n\n```\nrumboot-flashrom -p /dev/ttyUSB1 -c basis -- --read img.bin\n```\n\n* _-p /dev/ttyUSB1 -c basis_ are rumboot-flashrom's options. \n* -- is the separator\n* _--read img.bin_ are the flashrom options\n\n```\n~# rumboot-flashrom --help\n\n```\n```\n~# rumboot-flashrom -c basis -m spi0-gpio0_5-cs \nDetected chip:    basis (1888\u0412\u0421048)\nSPL               rumboot-basis-PostProduction-serprog-spi0-gpio0_5-cs.bin\nReset method:     None\nBaudrate:         115200 bps\nPort:             socket://10.7.11.59:10001\nFlashRom:         /usr/sbin/flashrom\nFlashRom args:    \nSending stream: 100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 10.6k/10.6k [00:16<00:00, 659B/s]\nSerprog stub ready!\nTrying port 20000\nInvoking flashrom: /usr/sbin/flashrom -p serprog:ip=127.0.0.1:20000 \nflashrom  on Linux 4.19.0-5-amd64 (x86_64)\nflashrom is free software, get the source code at https://flashrom.org\n\nUsing clock_gettime for delay loops (clk_id: 1, resolution: 1ns).\nserprog: Programmer name is \"rumboot:basis\"\nserprog: requested mapping AT45CS1282 is incompatible: 0x1080000 bytes at 0x00000000fef80000.\nFound Winbond flash chip \"W25Q32.V\" (4096 kB, SPI) on serprog.\nNo operations were specified.\n```\n\n##### Write data to SPI flash\nWARNING: The size of the image file must always match the size of SPI flash. This a flashrom limitation.\n\n```\n~# rumboot-flashrom -m spi0-gpio0_5-cs  -c basis -- --write img.bin\n```\n\n##### Read data from SPI flash\n\n```\n~# rumboot-flashrom -m spi0-gpio0_5-cs  -c basis -- --read img.bin\n```\n\n##### For more advanced usage please refer to flashrom docs\n\nhttps://flashrom.org/Flashrom\n\n\n### rumboot-demon\n#### Description\n\nThe idea behind _rumboot-daemon_ is to allow access allow several apps/users to work with the same board over network. Basically it's a serial-to-tcp bridge that also handles board resetting and queues users for access to the board. \n\nWARNING: rumboot-daemon lacks ANY kind of authorization or encryption and is supposed to be used in secure networks. Please, DO NOT EXPOSE IT TO THE INTERNET!!! You have been warned.\n\n_rumboot-daemon_ can theoretically work without the _-r_ option, prompting the user to reset the board, but\nin real life this is pretty much useless. \n\nSee Typical Usage section for examples\n\nWhen a user connects to rumboot-daemon, the tool powers on and resets the board, preloads it with any files specified on the commandline (if any) and redirects all serial traffic there. When the user disconnects, the board is powered off. If a second user connects when the board is in use, he/she would be placed in a virtual queue and wait until the board is available.\n\n\n#### Options \n```\nusage: rumboot-daemon [-h] [-l LOG] [-p port] [-b speed] [-f FILE]\n                      [-c chip_id] [-r method] [--apc-ip APC_IP]\n                      [--apc-user APC_USER] [--apc-pass APC_PASS]\n                      [--apc-port APC_PORT] [-S value] [-P value]\n                      [--pl2303-invert] [-L listen]\n\nrumboot-daemon 0.9.1 - Collaborative board access daemon\n\n(C) 2018-2020 Andrew Andrianov <andrew@ncrmnt.org>, RC Module\nhttps://module.ru\nhttps://github.com/RC-MODULE\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -f FILE, --file FILE  Image file (may be specified multiple times)\n  -L listen, --listen listen\n                        Specify address:port to listen (default 0.0.0.0:10000)\n\nSerial Terminal Settings:\n  -l LOG, --log LOG     Log terminal output to file\n  -p port, --port port  Serial port to use\n  -b speed, --baud speed\n                        Serial line speed\n\nFile Handling:\n  -c chip_id, --chip_id chip_id\n                        Override chip id (by name or chip_id)\n\nReset Sequence options:\n  These options control how the target board will be reset\n\n  -r method, --reset method\n                        Reset sequence to use (apc base mt12505 pl2303\n                        powerhub)\n\napc reset sequence options:\n  --apc-ip APC_IP       APC IP Address/hostname\n  --apc-user APC_USER   APC IP username\n  --apc-pass APC_PASS   APC IP username\n  --apc-port APC_PORT   APC Power port\n\nmt12505 reset sequence options:\n  -S value, --ft232-serial value\n                        FT232 serial number for MT125.05\n\npl2303 reset sequence options:\n  -P value, --pl2303-port value\n                        PL2303 physical port\n  --pl2303-invert       Invert all pl2303 gpio signals\n```\n\n\n#### Typical Usage\n##### Manually start the daemon with typical settings for 'basis' platform\n\n```\n~# rumboot-daemon -c basis -p /dev/ttyUSB0 -r pl2303\nDetected chip:    basis (1888\u0412\u0421048)\nReset method:     pl2303\nBaudrate:         115200 bps\nSerial Port:      /dev/ttyUSB0\nListen address:   ['0.0.0.0:10000']\nPlease, power-cycle board\nwaiting for a connection\n```\n\nOnce the daemon is working, you can connect to it on port 10000 with rumboot-xrun:\n\n```\nrumboot-xrun -f rumboot-basis-PostProduction-spl-ok.bin -p socket://192.168.10.1:10000\n```\n\nN.B. Remember to specify the correct IP address.\n\n##### Start the daemon on boot using systemd, listen on a different port\n\nThis will require\nCreate /etc/systemd/system/rumboot-daemon.service with the following contents\n\n```ini\n[Unit]\nDescription=Rumboot Daemon \nAfter=network.target\n\n[Service]\nUser=developer\nGroup=codemonkeys\nType=simple\nExecStart=/home/developer/.local/bin/rumboot-daemon -r pl2303 -p /dev/ttyUSB0 -b 115200 -L 0.0.0.0:10001\nRestart=always\n\n[Install]\nWantedBy=multi-user.target\n```\n\nAdjust the script for your desired User and Group\n\nNext enable and start the daemon\n\n```\n  ~# systemctl enable rumboot-daemon\n  ~# systemctl start rumboot-daemon\n```\n\n##### Preloading an application before giving the user access to the daemon\n\n\nSometimes it's useful to initialize some external memories (e.g. ddr) or execute an application before \nallowing user access to the board. You can specify one or several applications using the -f flag\n\n```\n~# rumboot-daemon -c basis -p /dev/ttyUSB0 -r pl2303 -f ddr_init.bin\nDetected chip:    basis (1888\u0412\u0421048)\nReset method:     pl2303\nBaudrate:         115200 bps\nSerial Port:      /dev/ttyUSB0\nListen address:   ['0.0.0.0:10000']\nPlease, power-cycle board\nwaiting for a connection\n```\n\nThe ddr_init.bin in the example above should initialize the ddr memory and return to bootrom with code 0. _rumboot-daemon_ will send it to the board and only then redirect serial stream to the connected user. \n \n\n# Appendix A. Board reset methods\n\nrumboot-xrun, rumboot-xflash and rumboot-daemon all accept the _-r_ option that configures the way boards are reset. The following reset methods are available: \n\n* pl2303 (linux-only) - Uses PL2303 chip GPIO for power and reset control. The two GPIO lines of PL2303HXA should be connected to reset and power lines. Most RC Module's reference boards have this circuit. rumboot-tools will try to guess the correct device if more than one pl2303 device are connected.\n\n* mt12505 - Uses MT12505 board for power control. Internal RC Module's hardware. Don't use.\n\n* apc - Uses telnet-accessible APC Switched Rack PDU. Requires a set of options to be supplied: \n\n```  \n  --apc-ip APC_IP       APC IP Address/hostname\n  --apc-user APC_USER   APC IP username\n  --apc-pass APC_PASS   APC IP username\n  --apc-port APC_PORT   APC Power port\n```\n\nIf you wish to implement your own reset method - look into rumboot/resetSeq\n\n\n### rumboot-combine\n#### Description\n\n_rumboot-combine_ is a simple to tool to compose a chain of several image file. Since Rumboot V2 the rom loader can load a chain of applications, one after another from flash media. Different boot sources require different size alignment, so this app can handle all that. For basis this tool is also used to append the .ini configuration file to the image.\n\n#### Options\n\n```\n~# rumboot-combine --help\nusage: rumboot-combine [-h] -i INPUT -o OUTPUT [-a ALIGN]\n\nrumboot-combine 0.9.31 - RumBoot Image Merger Tool\n\n(C) 2018-2021 Andrew Andrianov <andrew@ncrmnt.org>, STC \"Module\"\nhttps://module.ru / https://github.com/RC-MODULE\n\nThis program is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; either version 2 of the License, or\n(at your option) any later version.\n\noptions:\n  -h, --help            show this help message and exit\n  -i INPUT, --input INPUT\n                        Input image file (may be specified several times)\n  -o OUTPUT, --output OUTPUT\n                        Output image\n  -a ALIGN, --align ALIGN\n                        Set alignment pattern of images in bytes or via\n                        keyword (SD, physmap, ini)\n\n```\n\n\n#### Typical usage\n##### Combine several apps into SPI flash image\n\n\n```\n  rumboot-combine -a spi -i ddr_init.bin -i memorytest.bin -i uboot.bin -o spiflash.bin\n```\n\nor \n\n```\n  rumboot-combine -a 1 -i ddr_init.bin -i memorytest.bin -i uboot.bin -o spiflash.bin\n```\n\n##### Combine several apps into SD flash image\n\n```\n  rumboot-combine -a SD -i ddr_init.bin -i memorytest.bin -i uboot.bin -o spiflash.bin\n```\n\n##### Combine several apps into NOR flash image\n\n```\n  rumboot-combine -a physmap -i ddr_init.bin -i memorytest.bin -i uboot.bin -o spiflash.bin\n```\n\n##### Append ini to a chip config tool\n\n```\n  rumboot-combine -a ini -i tool.bin -i config.ini -o runme.bin\n```\n\n##### Combine images with custom alignment\n\n```\n  rumboot-combine -a 32 -i 1.bin -i 2.bin -o all.bin\n```\n\n\n## Appendix B. Adding Rumboot V1 header to your app\n\nThe tool expects that your compiled binary will already have a valid header that has all required fields except for the checksums and data length.\nTo to this, you have to add a single .c file to your project that will define the header structure.\n\nThe V1 is the initial header as implemented in 1888TX018. It's very basic, but may contain two entry points.\n\nYour project should have the following C code that will put the header in your code.\n\n```c\n    extern void entry0();\n    extern void entry1();\n\n    #define BOOTHEADER_MAGIC__BOOT_IMAGE_VALID       0xbeefc0de\n    #define BOOTHEADER_MAGIC__HOST_IMAGE_VALID       0xdeadc0de\n    #define BOOTHEADER_MAGIC__RESUME_IMAGE_VALID     0xdeadbabe\n    #define BOOTHEADER_MAGIC__CORERESET_IMAGE_VALID  0xdefec8ed\n\n\n    struct legacy_bootheader\n    {\n        uint32_t magic;\n        uint32_t length;\n        uint32_t entry0;\n        uint32_t entry1;\n        uint32_t sum;\n        uint32_t hdrsum; /* Checksum of all previous fields. */\n\n        uint8_t imagedata[1]; /* Image data. */\n    } __attribute__((packed));\n\n    static const __attribute__((used)) __attribute__((section(\".header\")))\n    struct legacy_bootheader hdr = {\n    \t.magic\t\t= BOOTHEADER_MAGIC__BOOT_IMAGE_VALID,\n    \t.entry0\t= (uint32_t) &entry0,\n    \t.entry1\t= (uint32_t) &entry1,        \n    };\n```\n\nA typical lds script tht will place that header at the very top of IM0 SRAM would look like this:\n\n```ld\nMEMORY\n{\n    IM0 (rwx): ORIGIN = 0x40000, LENGTH = 0x40000\n}\n\nSECTIONS\n{\n\n\n.text :\n{\n  KEEP(*(.header))\n  *(.rumboot_platform_runtime_info);\n  *(.text)\n  *(.text.*)\n  *(.rodata)\n  *(.data)\n} > IM0\n\n.bss :\n{\n  rumboot_platform_bss_start = .;\n  *(.bss)\n  *(.bss.*)\n  rumboot_platform_bss_end = .;\n  rumboot_platform_heap_start = .;\n  . = . + 0xf000; /* 60k heap */\n  rumboot_platform_heap_end = .;\n  rumboot_platform_spl_start = .;\n  . = . + 0xf00;\n  rumboot_platform_spl_end = .;\n} > IM0\n\n.data :\n{\n    *(.data)\n} > IM0\n\n.rodata :\n{\n  *(.rodata)\n  *(.rodata).*\n} > IM0\n\n}\n```\n\nOnce you compile and link your app, run \n```\nrumboot-packimage -c -f file.bin\n```\nAnd it should do all magic, required to boot this image\n\n## Appendix C. Adding Rumboot V2 header to your app\n\nTODO: ...\n\n## Appendix D. Adding NM6408 header to your app\nTODO: ...\n",
    "bugtrack_url": null,
    "license": "GPL",
    "summary": "RumBoot ROM Loader Tools",
    "version": "0.9.32",
    "project_urls": {
        "Homepage": "http://github.com/RC-MODULE/rumboot-tools"
    },
    "split_keywords": [
        "rumboot",
        "image"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e0c5758d8adb7ed02a2aa997b7b99854df3444372eb9b41b258da8ed1a53fbe3",
                "md5": "881eccc2832bc0a2672659ad8a58e4f5",
                "sha256": "36c24a90a84e46e81a5693fd4948710fcf8074106af2f0e57a7b0374e9be99cb"
            },
            "downloads": -1,
            "filename": "rumboot-tools-0.9.32.tar.gz",
            "has_sig": false,
            "md5_digest": "881eccc2832bc0a2672659ad8a58e4f5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 2402666,
            "upload_time": "2023-09-07T11:32:59",
            "upload_time_iso_8601": "2023-09-07T11:32:59.051616Z",
            "url": "https://files.pythonhosted.org/packages/e0/c5/758d8adb7ed02a2aa997b7b99854df3444372eb9b41b258da8ed1a53fbe3/rumboot-tools-0.9.32.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-07 11:32:59",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "RC-MODULE",
    "github_project": "rumboot-tools",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "appveyor": true,
    "requirements": [],
    "lcname": "rumboot-tools"
}
        
Elapsed time: 0.11035s