Update Binary_Signature.ino (#278)

Clean up the comments, add bitmasks.
This commit is contained in:
Ben Lye 2019-10-02 09:15:13 +01:00 committed by pascallanger
parent 032e0641a5
commit 331da37840

View File

@ -28,8 +28,8 @@ declares 'flag' variables for the options we are interested in.
When the pre-compiler parses the source code these variables are either present or not in the parsed cpp file, When the pre-compiler parses the source code these variables are either present or not in the parsed cpp file,
typically '$build_dir$/preproc/ctags_target_for_gcc_minus_e.cpp'. typically '$build_dir$/preproc/ctags_target_for_gcc_minus_e.cpp'.
Once the .bin file is compiled an additional command-line tool scans the parsed cpp file, detects the flags, Once the .bin file is created an additional command-line build tool scans the parsed cpp file, detects the
assembles the signature, and finally appends to the end of the binary file. flags, assembles the signature, and finally appends the signature to the end of the binary file.
The signature is 24 bytes long: The signature is 24 bytes long:
multi-x[8-byte hex code]-[8-byte version number] multi-x[8-byte hex code]-[8-byte version number]
@ -39,28 +39,32 @@ multi-x1234abcd-01020199
The 8-byte hex code is a 32-bit bitmask value indicating the configuration options, currently: The 8-byte hex code is a 32-bit bitmask value indicating the configuration options, currently:
Bit(s) Option Comment Bit(s) Bitmask Option Comment
1-2 Module type Read as a two-bit value indicating a number from 0-3 which maps to a module type (AVR, STM32, OrangeRX) 1-2 0x3 Module type Read as a two-bit value indicating a number from 0-3 which maps to a module type (AVR, STM32, OrangeRX)
3-7 Channel order Read as a five-bit value indicating a number from 0-23 which maps to as channel order (AETR, TAER, RETA, etc) 3-7 0x7C Channel order Read as a five-bit value indicating a number from 0-23 which maps to as channel order (AETR, TAER, RETA, etc) (right-shift two bits to read)
8 Bootloader support Indicates whether or not the firmware was built with support for the bootloader 8 0x80 Bootloader support Indicates whether or not the firmware was built with support for the bootloader
9 CHECK_FOR_BOOTLOADER 9 0x100 CHECK_FOR_BOOTLOADER Indicates if CHECK_FOR_BOOTLOADER is defined
10 INVERT_TELEMETRY 10 0x200 INVERT_TELEMETRY Indicates if INVERT_TELEMETRY is defined
11 MULTI_STATUS 11 0x400 MULTI_STATUS Indicates if MULTI_STATUS is defined
12 MULTI_TELEMETRY 12 0x800 MULTI_TELEMETRY Indicates if MULTI_TELEMETRY is defined
13 DEBUG_SERIAL 13 0x1000 DEBUG_SERIAL Indicates if DEBUG_SERIAL is defined
The 8-byte version number is the version number zero-padded to a fixed width of two-bytes per segment and no separator. The 8-byte version number is the version number zero-padded to a fixed width of two-bytes per segment and no separator.
E.g. 1.2.3.45 becomes 01020345. E.g. 1.2.3.45 becomes 01020345.
Module types are mapped to the following decimal / binary values: Multi Telemetery Type can be read from bits 11 and 12 using the bitmask 0xC00 and right-shifting ten bits:
Telemetry Type Decimal Value Binary Value
Undefined 0 00
erSkyTX 1 01
OpenTX 2 10
Module types are mapped to the following decimal / binary values:
Module Type Decimal Value Binary Valsue Module Type Decimal Value Binary Valsue
AVR 0 00 AVR 0 00
STM32 1 01 STM32 1 01
OrangeRX 2 10 OrangeRX 2 10
Channel orders are mapped to the following decimal / binary values: Channel orders are mapped to the following decimal / binary values:
Channel Order Decimal Value Binary Value Channel Order Decimal Value Binary Value
AETR 0 00000 AETR 0 00000
AERT 1 00001 AERT 1 00001
@ -86,7 +90,6 @@ RAET 20 10100
RATE 21 10101 RATE 21 10101
RTAE 22 10110 RTAE 22 10110
RTEA 23 10111 RTEA 23 10111
*/ */
// Set the flags for detecting and writing the firmware signature // Set the flags for detecting and writing the firmware signature