Merge branch 'dev-02'

# Conflicts:
#	vbf-tool/src/vbf_parser/parser.rs
tree: 65a79d3e8981e6f005dde2ec48947a645e9106d8
  1. vbf-tool/
  2. .gitignore
  3. README.md
README.md

vbf-tool

try to imple vbf-tool by rust

VBF file format

ref. https://mk4-wiki.denkdose.de/artikel/vbf/start

The VBF format contains a readable part in ASCII format and a machine part in binary format.

  • Header
vbf_version = 2.6;

header {
    //**********************************************************
    //*
    //*                  Volvo Car Corporation
    //*
    //*     This file is generated by VBF CONVERT ver. 5.10.0
    //*
    //*                        DO NOT EDIT !
    //*
    //**********************************************************

    // Volvo software part number
       sw_part_number = "8894084567";

    // Software Version: 
       sw_version = "A";

    // Volvo software part type: Executable
       sw_part_type = EXE;

    // Data format identifier: 0x00 = Uncompressed, 0x10 = Compressed
       data_format_identifier = 0x00;

    // ECU Address: 
       ecu_address = 0x1234;

    // Erase information
    //         start,     length
       erase = { { 0x0cc00000, 0x0004ef15 },
                 { 0xffffe800, 0x0000002c }
               }; 

    // Start address of the hash table
       verification_block_start = 0xFFFFE800;

    // Length of the hash table
       verification_block_length = 0x0000002C;

    // Root hash value
       verification_block_root_hash = 0x3E263C8F66129C46B39D59E5964D7F3254FFA272AD3A3E70FC57ED95D73E1234;

    // Blocks sorted
    // Blocks grouped
    // Blocks:   2
    // Bytes:    323476

    file_checksum = 0x6A8DB4CC;
}
  • Payload: The binary part (payload) the VBF begins directly after the last ASCII character of the description part (the }). The following data are to be interpreted as bytes in big endian.
OffsetLENGTHBYTESDATETYPEFUNCTIONSAMPLE
0x00004 BytesDWORDDATA_STARTStart address on the target system0x000004F4
0x00034 BytesDWORDDATA_LENGTHLength of the following block
0x0007x BytesBYTEDATAdata of the block
0x0007 + DATA_LENGTH2 BytesWORDDATA_CRCCRC-16 CCITT checksum of the DATA
  • VBT(verification block table)

    The verification block table, encoded with big endian, shall have the following format:

    • Verification Block Table Format Identifier. [ size 16 bits]
    • Number of data blocks. [ size 16bits]
    • StartAddress [ size 32 bits] , Length [ size 32 bits], Hash value. Every data blocks shall be defined, except the block table itself. The size of the hash is dependent of the hash function used and is specified elsewhere. The Length is the unprocessed length
    • The data blocks shall be sorted according to the order the data blocks are being programmed to the ECU.
    • SHA-256 hash function is used, i.e. each hash value is 256 bits.

VBB scripts

the description of vbf file parameters.

usage example

$ vbf-tool ./vbb_script.json