osd-contiki/tools/stm32w/stm32w_flasher/py_files/prodeng.py

288 lines
86 KiB
Python
Raw Normal View History

# See comment in stm32w_flasher.py.
# Extraction and little adaptation performed by E.Duble (CNRS, LIG).
ASCII = 2
ASCII_REVERSED = 19
AUTO_U16_CHECKSUM = 15
AUTO_U16_CRC = 16
BOOTLOADER_CODE = 20
CIB_Mapping = None
DATE = 1
DIE_ID = 18
DIE_REV = 5
EUI64 = 10
FIB_Mapping = None
FIB_VERSION = 12
FLASH_SIZE = 21
FPEC_TIMING = 14
MANUFACTURER_INFO = 17
PART_NUMBER = 6
PART_SUFFIX = 7
RAM_SIZE = 13
READ_PROTECTION = 22
STACK_TYPE = 8
TEST_PROGRAM_INFO = 9
U16 = 0
U8 = 4
VOLTAGE = 11
WRITE_PROTECTION = 23
X_Y_TSMC = 3
bootloader = {'cut 1.2v2': [0, 2, 0, 32, 21, 7, 4, 8, 125, 0, 4, 8, 125, 0, 4, 8, 167, 15, 2, 0, 0, 0, 0, 0, 0, 8, 4, 8, 0, 0, 0, 8, 0, 2, 0, 32, 169, 1, 4, 8, 141, 2, 4, 8, 95, 234, 0, 13, 112, 71, 79, 240, 0, 81, 8, 96, 223, 248, 188, 6, 68, 242, 68, 65, 1, 96, 0, 34, 130, 96, 223, 248, 184, 6, 1, 96, 223, 248, 180, 6, 66, 97, 130, 97, 130, 96, 2, 96, 223, 248, 160, 6, 2, 96, 66, 96, 98, 182, 112, 71, 128, 181, 255, 247, 228, 255, 2, 72, 2, 73, 1, 96, 1, 189, 0, 191, 12, 237, 0, 224, 4, 0, 250, 5, 0, 72, 241, 231, 21, 1, 15, 240, 8, 73, 8, 96, 200, 104, 16, 240, 4, 15, 251, 208, 200, 104, 16, 240, 64, 15, 251, 208, 112, 71, 3, 72, 193, 104, 17, 240, 2, 15, 251, 208, 0, 104, 112, 71, 60, 200, 0, 64, 248, 181, 5, 70, 12, 0, 67, 191, 0, 38, 32, 70, 68, 66, 38, 70, 0, 39, 255, 247, 236, 255, 120, 85, 70, 64, 127, 28, 188, 66, 248, 210, 255, 247, 229, 255, 134, 66, 4, 208, 31, 32, 255, 247, 213, 255, 0, 32, 242, 189, 96, 28, 242, 189, 128, 181, 0, 240, 96, 249, 111, 240, 2, 1, 0, 168, 255, 247, 221, 255, 4, 40, 2, 208, 79, 240, 255, 48, 2, 189, 0, 240, 84, 249, 0, 152, 0, 186, 2, 189, 0, 0, 223, 248, 252, 21, 136, 66, 4, 211, 176, 241, 32, 47, 1, 210, 2, 32, 112, 71, 176, 241, 0, 111, 4, 211, 9, 73, 136, 66, 1, 210, 4, 32, 112, 71, 158, 73, 136, 66, 4, 211, 6, 73, 136, 66, 6, 210, 8, 32, 112, 71, 5, 73, 136, 66, 1, 211, 16, 32, 112, 71, 1, 32, 112, 71, 0, 0, 2, 8, 0, 10, 4, 8, 0, 0, 4, 8, 9, 72, 10, 73, 1, 96, 10, 74, 2, 96, 65, 96, 66, 96, 16, 73, 1, 34, 10, 96, 74, 104, 18, 240, 1, 15, 251, 208, 129, 104, 17, 240, 1, 15, 251, 209, 112, 71, 0, 191, 4, 128, 0, 64, 35, 1, 103, 69, 171, 137, 239, 205, 6, 72, 65, 104, 17, 240, 2, 15, 251, 209, 0, 33, 1, 96, 2, 72, 128, 33, 1, 96, 112, 71, 0, 191, 16, 128, 0, 64, 44, 64, 0, 64, 45, 233, 248, 67, 128, 70, 12, 70, 21, 70, 0, 38, 71, 70, 0, 45, 88, 208, 8, 240, 1, 0, 5, 240, 1, 1, 8, 67, 1, 208, 1, 32, 15, 224, 64, 70, 255, 247, 156, 255, 129, 70, 5, 235, 8, 0, 64, 30, 255, 247, 150, 255, 64, 234, 9, 0, 4, 40, 4, 208, 8, 40, 2, 208, 2, 32, 189, 232, 242, 131, 255, 247, 177, 255, 0, 32, 106, 73, 1, 224, 191, 28, 128, 28, 168, 66, 50, 210, 59, 136, 2, 25, 82, 120, 16, 248, 4, 128, 8, 235, 2, 34, 146, 178, 147, 66, 241, 208, 79, 246, 255, 120, 67, 69, 1, 208, 19, 0, 33, 209, 96, 75, 159, 66, 5, 211, 24, 75, 159, 66, 2, 210, 79, 244, 4, 115, 1, 224, 64, 242, 1, 35, 75, 96, 58, 128, 10, 104, 18, 240, 1, 15, 251, 209, 32, 34, 10, 96, 10, 104, 18, 240, 20, 15, 212, 208, 8, 104, 16, 240, 16, 15, 20, 191, 4, 38, 5, 38, 16, 32, 8, 96, 4, 32, 8, 96, 0, 224, 6, 38, 255, 247, 143, 255, 11, 224, 0, 32, 0, 224, 64, 28, 152, 66, 6, 210, 23, 248, 1, 27, 2, 93, 145, 66, 247, 208, 7, 32, 178, 231, 48, 70, 176, 231, 16, 8, 4, 8, 45, 233, 248, 67, 4, 70, 8, 70, 0, 39, 129, 10, 141, 2, 225, 178, 1, 41, 42, 209, 4, 38, 79, 240, 0, 104, 79, 244, 0, 73, 20, 244, 128, 127, 27, 208, 255, 247, 80, 255, 58, 72, 70, 96, 225, 178, 2, 41, 0, 209, 133, 96, 70, 240, 64, 1, 65, 96, 1, 104, 17, 240, 1, 15, 251, 209, 32, 33, 1, 96, 1, 104, 17, 240, 16, 15, 2, 208, 16, 33, 1, 96, 4, 39, 255, 247, 82, 255, 0, 47, 41, 209, 20, 244, 0, 127, 38, 208, 0, 32, 79, 240, 255, 50, 26, 224, 2, 41, 10, 209, 255, 247, 5, 255, 4, 40, 1, 208, 2, 32, 15, 224, 2, 38, 168, 70, 79, 244, 128, 121, 204, 231, 224, 178, 3, 40, 6, 209, 79, 244, 8, 118, 223, 248, 136, 128, 79, 240, 128, 9, 194, 231, 3, 32, 189, 232, 242, 131, 64, 28, 72, 69, 5, 210, 88, 248, 4, 27, 145, 66, 248, 208, 7, 32, 244, 231, 56, 70, 242, 231, 16, 181, 130, 176, 4, 70, 0, 240, 47, 248, 28, 177, 0, 32, 141, 248, 0, 0, 18, 224, 165, 32, 141, 248, 0, 0, 255, 247, 251, 254, 16, 76, 79, 244, 4, 112, 96, 96, 15, 72, 165, 33, 1, 128, 0, 33, 64, 242, 3, 16, 255, 247, 139, 255, 4, 32, 32, 96, 157, 248, 0, 0, 192, 67, 141, 248, 1, 0, 2, 35, 2, 34, 0, 169, 6, 72, 255, 247, 12, 255, 0, 40, 12, 191, 121, 32, 31, 32, 255, 247, 116, 254, 19, 189, 0, 0, 12, 128, 0, 64, 0, 8, 4, 8, 121, 32, 107, 230, 45, 233, 240, 67, 195, 176, 193, 72, 0, 104, 193, 73, 136, 66, 2, 208, 192, 72, 255, 247, 81, 254, 205, 72, 1, 104, 33, 240, 240, 1, 65, 240, 128, 1, 1, 96, 129, 104, 65, 240, 32, 1, 129
bootloader_cut_1_0v2 = [0, 2, 0, 32, 17, 7, 4, 8, 125, 0, 4, 8, 125, 0, 4, 8, 167, 15, 2, 0, 0, 0, 0, 0, 0, 8, 4, 8, 0, 0, 0, 8, 0, 2, 0, 32, 169, 1, 4, 8, 141, 2, 4, 8, 95, 234, 0, 13, 112, 71, 79, 240, 0, 81, 8, 96, 223, 248, 184, 6, 68, 242, 68, 65, 1, 96, 0, 34, 130, 96, 223, 248, 180, 6, 1, 96, 223, 248, 176, 6, 66, 97, 130, 97, 130, 96, 2, 96, 223, 248, 156, 6, 2, 96, 66, 96, 98, 182, 112, 71, 128, 181, 255, 247, 228, 255, 2, 72, 2, 73, 1, 96, 1, 189, 0, 191, 12, 237, 0, 224, 4, 0, 250, 5, 0, 72, 241, 231, 21, 1, 15, 240, 8, 73, 8, 96, 200, 104, 16, 240, 4, 15, 251, 208, 200, 104, 16, 240, 64, 15, 251, 208, 112, 71, 3, 72, 193, 104, 17, 240, 2, 15, 251, 208, 0, 104, 112, 71, 60, 200, 0, 64, 248, 181, 5, 70, 12, 0, 67, 191, 0, 38, 32, 70, 68, 66, 38, 70, 0, 39, 255, 247, 236, 255, 120, 85, 70, 64, 127, 28, 188, 66, 248, 210, 255, 247, 229, 255, 134, 66, 4, 208, 31, 32, 255, 247, 213, 255, 0, 32, 242, 189, 96, 28, 242, 189, 128, 181, 0, 240, 96, 249, 111, 240, 2, 1, 0, 168, 255, 247, 221, 255, 4, 40, 2, 208, 79, 240, 255, 48, 2, 189, 0, 240, 84, 249, 0, 152, 0, 186, 2, 189, 0, 0, 223, 248, 248, 21, 136, 66, 4, 211, 176, 241, 32, 47, 1, 210, 2, 32, 112, 71, 176, 241, 0, 111, 4, 211, 9, 73, 136, 66, 1, 210, 4, 32, 112, 71, 158, 73, 136, 66, 4, 211, 6, 73, 136, 66, 6, 210, 8, 32, 112, 71, 5, 73, 136, 66, 1, 211, 16, 32, 112, 71, 1, 32, 112, 71, 0, 0, 2, 8, 0, 10, 4, 8, 0, 0, 4, 8, 9, 72, 10, 73, 1, 96, 10, 74, 2, 96, 65, 96, 66, 96, 16, 73, 1, 34, 10, 96, 74, 104, 18, 240, 1, 15, 251, 208, 129, 104, 17, 240, 1, 15, 251, 209, 112, 71, 0, 191, 4, 128, 0, 64, 35, 1, 103, 69, 171, 137, 239, 205, 6, 72, 65, 104, 17, 240, 2, 15, 251, 209, 0, 33, 1, 96, 2, 72, 128, 33, 1, 96, 112, 71, 0, 191, 16, 128, 0, 64, 44, 64, 0, 64, 45, 233, 248, 67, 128, 70, 12, 70, 21, 70, 0, 38, 71, 70, 0, 45, 88, 208, 8, 240, 1, 0, 5, 240, 1, 1, 8, 67, 1, 208, 1, 32, 15, 224, 64, 70, 255, 247, 156, 255, 129, 70, 5, 235, 8, 0, 64, 30, 255, 247, 150, 255, 64, 234, 9, 0, 4, 40, 4, 208, 8, 40, 2, 208, 2, 32, 189, 232, 242, 131, 255, 247, 177, 255, 0, 32, 106, 73, 1, 224, 191, 28, 128, 28, 168, 66, 50, 210, 59, 136, 2, 25, 82, 120, 16, 248, 4, 128, 8, 235, 2, 34, 146, 178, 147, 66, 241, 208, 79, 246, 255, 120, 67, 69, 1, 208, 19, 0, 33, 209, 96, 75, 159, 66, 5, 211, 24, 75, 159, 66, 2, 210, 79, 244, 4, 115, 1, 224, 64, 242, 1, 35, 75, 96, 58, 128, 10, 104, 18, 240, 1, 15, 251, 209, 32, 34, 10, 96, 10, 104, 18, 240, 20, 15, 212, 208, 8, 104, 16, 240, 16, 15, 20, 191, 4, 38, 5, 38, 16, 32, 8, 96, 4, 32, 8, 96, 0, 224, 6, 38, 255, 247, 143, 255, 11, 224, 0, 32, 0, 224, 64, 28, 152, 66, 6, 210, 23, 248, 1, 27, 2, 93, 145, 66, 247, 208, 7, 32, 178, 231, 48, 70, 176, 231, 16, 8, 4, 8, 45, 233, 248, 67, 4, 70, 8, 70, 0, 39, 129, 10, 141, 2, 225, 178, 1, 41, 42, 209, 4, 38, 79, 240, 0, 104, 79, 244, 0, 73, 20, 244, 128, 127, 27, 208, 255, 247, 80, 255, 58, 72, 70, 96, 225, 178, 2, 41, 0, 209, 133, 96, 70, 240, 64, 1, 65, 96, 1, 104, 17, 240, 1, 15, 251, 209, 32, 33, 1, 96, 1, 104, 17, 240, 16, 15, 2, 208, 16, 33, 1, 96, 4, 39, 255, 247, 82, 255, 0, 47, 41, 209, 20, 244, 0, 127, 38, 208, 0, 32, 79, 240, 255, 50, 26, 224, 2, 41, 10, 209, 255, 247, 5, 255, 4, 40, 1, 208, 2, 32, 15, 224, 2, 38, 168, 70, 79, 244, 128, 121, 204, 231, 224, 178, 3, 40, 6, 209, 79, 244, 8, 118, 223, 248, 136, 128, 79, 240, 128, 9, 194, 231, 3, 32, 189, 232, 242, 131, 64, 28, 72, 69, 5, 210, 88, 248, 4, 27, 145, 66, 248, 208, 7, 32, 244, 231, 56, 70, 242, 231, 16, 181, 130, 176, 4, 70, 0, 240, 47, 248, 28, 177, 0, 32, 141, 248, 0, 0, 18, 224, 165, 32, 141, 248, 0, 0, 255, 247, 251, 254, 16, 76, 79, 244, 4, 112, 96, 96, 15, 72, 165, 33, 1, 128, 0, 33, 64, 242, 3, 16, 255, 247, 139, 255, 4, 32, 32, 96, 157, 248, 0, 0, 192, 67, 141, 248, 1, 0, 2, 35, 2, 34, 0, 169, 6, 72, 255, 247, 12, 255, 0, 40, 12, 191, 121, 32, 31, 32, 255, 247, 116, 254, 19, 189, 0, 0, 12, 128, 0, 64, 0, 8, 4, 8, 121, 32, 107, 230, 45, 233, 240, 67, 195, 176, 193, 72, 0, 104, 1, 40, 2, 208, 192, 72, 255, 247, 82, 254, 204, 72, 1, 104, 33, 240, 240, 1, 65, 240, 128, 1, 1, 96, 129, 104, 65, 240, 32, 1, 129, 96, 200, 73,
bootloader_cut_1_1v2 = [0, 2, 0, 32, 17, 7, 4, 8, 125, 0, 4, 8, 125, 0, 4, 8, 167, 15, 2, 0, 0, 0, 0, 0, 0, 8, 4, 8, 0, 0, 0, 8, 0, 2, 0, 32, 169, 1, 4, 8, 141, 2, 4, 8, 95, 234, 0, 13, 112, 71, 79, 240, 0, 81, 8, 96, 223, 248, 184, 6, 68, 242, 68, 65, 1, 96, 0, 34, 130, 96, 223, 248, 180, 6, 1, 96, 223, 248, 176, 6, 66, 97, 130, 97, 130, 96, 2, 96, 223, 248, 156, 6, 2, 96, 66, 96, 98, 182, 112, 71, 128, 181, 255, 247, 228, 255, 2, 72, 2, 73, 1, 96, 1, 189, 0, 191, 12, 237, 0, 224, 4, 0, 250, 5, 0, 72, 241, 231, 21, 1, 15, 240, 8, 73, 8, 96, 200, 104, 16, 240, 4, 15, 251, 208, 200, 104, 16, 240, 64, 15, 251, 208, 112, 71, 3, 72, 193, 104, 17, 240, 2, 15, 251, 208, 0, 104, 112, 71, 60, 200, 0, 64, 248, 181, 5, 70, 12, 0, 67, 191, 0, 38, 32, 70, 68, 66, 38, 70, 0, 39, 255, 247, 236, 255, 120, 85, 70, 64, 127, 28, 188, 66, 248, 210, 255, 247, 229, 255, 134, 66, 4, 208, 31, 32, 255, 247, 213, 255, 0, 32, 242, 189, 96, 28, 242, 189, 128, 181, 0, 240, 96, 249, 111, 240, 2, 1, 0, 168, 255, 247, 221, 255, 4, 40, 2, 208, 79, 240, 255, 48, 2, 189, 0, 240, 84, 249, 0, 152, 0, 186, 2, 189, 0, 0, 223, 248, 248, 21, 136, 66, 4, 211, 176, 241, 32, 47, 1, 210, 2, 32, 112, 71, 176, 241, 0, 111, 4, 211, 9, 73, 136, 66, 1, 210, 4, 32, 112, 71, 158, 73, 136, 66, 4, 211, 6, 73, 136, 66, 6, 210, 8, 32, 112, 71, 5, 73, 136, 66, 1, 211, 16, 32, 112, 71, 1, 32, 112, 71, 0, 0, 2, 8, 0, 10, 4, 8, 0, 0, 4, 8, 9, 72, 10, 73, 1, 96, 10, 74, 2, 96, 65, 96, 66, 96, 16, 73, 1, 34, 10, 96, 74, 104, 18, 240, 1, 15, 251, 208, 129, 104, 17, 240, 1, 15, 251, 209, 112, 71, 0, 191, 4, 128, 0, 64, 35, 1, 103, 69, 171, 137, 239, 205, 6, 72, 65, 104, 17, 240, 2, 15, 251, 209, 0, 33, 1, 96, 2, 72, 128, 33, 1, 96, 112, 71, 0, 191, 16, 128, 0, 64, 44, 64, 0, 64, 45, 233, 248, 67, 128, 70, 12, 70, 21, 70, 0, 38, 71, 70, 0, 45, 88, 208, 8, 240, 1, 0, 5, 240, 1, 1, 8, 67, 1, 208, 1, 32, 15, 224, 64, 70, 255, 247, 156, 255, 129, 70, 5, 235, 8, 0, 64, 30, 255, 247, 150, 255, 64, 234, 9, 0, 4, 40, 4, 208, 8, 40, 2, 208, 2, 32, 189, 232, 242, 131, 255, 247, 177, 255, 0, 32, 106, 73, 1, 224, 191, 28, 128, 28, 168, 66, 50, 210, 59, 136, 2, 25, 82, 120, 16, 248, 4, 128, 8, 235, 2, 34, 146, 178, 147, 66, 241, 208, 79, 246, 255, 120, 67, 69, 1, 208, 19, 0, 33, 209, 96, 75, 159, 66, 5, 211, 24, 75, 159, 66, 2, 210, 79, 244, 4, 115, 1, 224, 64, 242, 1, 35, 75, 96, 58, 128, 10, 104, 18, 240, 1, 15, 251, 209, 32, 34, 10, 96, 10, 104, 18, 240, 20, 15, 212, 208, 8, 104, 16, 240, 16, 15, 20, 191, 4, 38, 5, 38, 16, 32, 8, 96, 4, 32, 8, 96, 0, 224, 6, 38, 255, 247, 143, 255, 11, 224, 0, 32, 0, 224, 64, 28, 152, 66, 6, 210, 23, 248, 1, 27, 2, 93, 145, 66, 247, 208, 7, 32, 178, 231, 48, 70, 176, 231, 16, 8, 4, 8, 45, 233, 248, 67, 4, 70, 8, 70, 0, 39, 129, 10, 141, 2, 225, 178, 1, 41, 42, 209, 4, 38, 79, 240, 0, 104, 79, 244, 0, 73, 20, 244, 128, 127, 27, 208, 255, 247, 80, 255, 58, 72, 70, 96, 225, 178, 2, 41, 0, 209, 133, 96, 70, 240, 64, 1, 65, 96, 1, 104, 17, 240, 1, 15, 251, 209, 32, 33, 1, 96, 1, 104, 17, 240, 16, 15, 2, 208, 16, 33, 1, 96, 4, 39, 255, 247, 82, 255, 0, 47, 41, 209, 20, 244, 0, 127, 38, 208, 0, 32, 79, 240, 255, 50, 26, 224, 2, 41, 10, 209, 255, 247, 5, 255, 4, 40, 1, 208, 2, 32, 15, 224, 2, 38, 168, 70, 79, 244, 128, 121, 204, 231, 224, 178, 3, 40, 6, 209, 79, 244, 8, 118, 223, 248, 136, 128, 79, 240, 128, 9, 194, 231, 3, 32, 189, 232, 242, 131, 64, 28, 72, 69, 5, 210, 88, 248, 4, 27, 145, 66, 248, 208, 7, 32, 244, 231, 56, 70, 242, 231, 16, 181, 130, 176, 4, 70, 0, 240, 47, 248, 28, 177, 0, 32, 141, 248, 0, 0, 18, 224, 165, 32, 141, 248, 0, 0, 255, 247, 251, 254, 16, 76, 79, 244, 4, 112, 96, 96, 15, 72, 165, 33, 1, 128, 0, 33, 64, 242, 3, 16, 255, 247, 139, 255, 4, 32, 32, 96, 157, 248, 0, 0, 192, 67, 141, 248, 1, 0, 2, 35, 2, 34, 0, 169, 6, 72, 255, 247, 12, 255, 0, 40, 12, 191, 121, 32, 31, 32, 255, 247, 116, 254, 19, 189, 0, 0, 12, 128, 0, 64, 0, 8, 4, 8, 121, 32, 107, 230, 45, 233, 240, 67, 195, 176, 193, 72, 0, 104, 176, 241, 1, 31, 2, 208, 191, 72, 255, 247, 81, 254, 204, 72, 1, 104, 33, 240, 240, 1, 65, 240, 128, 1, 1, 96, 129, 104, 65, 240, 32, 1, 129, 96,
bootloader_cut_1_2v2 = [0, 2, 0, 32, 21, 7, 4, 8, 125, 0, 4, 8, 125, 0, 4, 8, 167, 15, 2, 0, 0, 0, 0, 0, 0, 8, 4, 8, 0, 0, 0, 8, 0, 2, 0, 32, 169, 1, 4, 8, 141, 2, 4, 8, 95, 234, 0, 13, 112, 71, 79, 240, 0, 81, 8, 96, 223, 248, 188, 6, 68, 242, 68, 65, 1, 96, 0, 34, 130, 96, 223, 248, 184, 6, 1, 96, 223, 248, 180, 6, 66, 97, 130, 97, 130, 96, 2, 96, 223, 248, 160, 6, 2, 96, 66, 96, 98, 182, 112, 71, 128, 181, 255, 247, 228, 255, 2, 72, 2, 73, 1, 96, 1, 189, 0, 191, 12, 237, 0, 224, 4, 0, 250, 5, 0, 72, 241, 231, 21, 1, 15, 240, 8, 73, 8, 96, 200, 104, 16, 240, 4, 15, 251, 208, 200, 104, 16, 240, 64, 15, 251, 208, 112, 71, 3, 72, 193, 104, 17, 240, 2, 15, 251, 208, 0, 104, 112, 71, 60, 200, 0, 64, 248, 181, 5, 70, 12, 0, 67, 191, 0, 38, 32, 70, 68, 66, 38, 70, 0, 39, 255, 247, 236, 255, 120, 85, 70, 64, 127, 28, 188, 66, 248, 210, 255, 247, 229, 255, 134, 66, 4, 208, 31, 32, 255, 247, 213, 255, 0, 32, 242, 189, 96, 28, 242, 189, 128, 181, 0, 240, 96, 249, 111, 240, 2, 1, 0, 168, 255, 247, 221, 255, 4, 40, 2, 208, 79, 240, 255, 48, 2, 189, 0, 240, 84, 249, 0, 152, 0, 186, 2, 189, 0, 0, 223, 248, 252, 21, 136, 66, 4, 211, 176, 241, 32, 47, 1, 210, 2, 32, 112, 71, 176, 241, 0, 111, 4, 211, 9, 73, 136, 66, 1, 210, 4, 32, 112, 71, 158, 73, 136, 66, 4, 211, 6, 73, 136, 66, 6, 210, 8, 32, 112, 71, 5, 73, 136, 66, 1, 211, 16, 32, 112, 71, 1, 32, 112, 71, 0, 0, 2, 8, 0, 10, 4, 8, 0, 0, 4, 8, 9, 72, 10, 73, 1, 96, 10, 74, 2, 96, 65, 96, 66, 96, 16, 73, 1, 34, 10, 96, 74, 104, 18, 240, 1, 15, 251, 208, 129, 104, 17, 240, 1, 15, 251, 209, 112, 71, 0, 191, 4, 128, 0, 64, 35, 1, 103, 69, 171, 137, 239, 205, 6, 72, 65, 104, 17, 240, 2, 15, 251, 209, 0, 33, 1, 96, 2, 72, 128, 33, 1, 96, 112, 71, 0, 191, 16, 128, 0, 64, 44, 64, 0, 64, 45, 233, 248, 67, 128, 70, 12, 70, 21, 70, 0, 38, 71, 70, 0, 45, 88, 208, 8, 240, 1, 0, 5, 240, 1, 1, 8, 67, 1, 208, 1, 32, 15, 224, 64, 70, 255, 247, 156, 255, 129, 70, 5, 235, 8, 0, 64, 30, 255, 247, 150, 255, 64, 234, 9, 0, 4, 40, 4, 208, 8, 40, 2, 208, 2, 32, 189, 232, 242, 131, 255, 247, 177, 255, 0, 32, 106, 73, 1, 224, 191, 28, 128, 28, 168, 66, 50, 210, 59, 136, 2, 25, 82, 120, 16, 248, 4, 128, 8, 235, 2, 34, 146, 178, 147, 66, 241, 208, 79, 246, 255, 120, 67, 69, 1, 208, 19, 0, 33, 209, 96, 75, 159, 66, 5, 211, 24, 75, 159, 66, 2, 210, 79, 244, 4, 115, 1, 224, 64, 242, 1, 35, 75, 96, 58, 128, 10, 104, 18, 240, 1, 15, 251, 209, 32, 34, 10, 96, 10, 104, 18, 240, 20, 15, 212, 208, 8, 104, 16, 240, 16, 15, 20, 191, 4, 38, 5, 38, 16, 32, 8, 96, 4, 32, 8, 96, 0, 224, 6, 38, 255, 247, 143, 255, 11, 224, 0, 32, 0, 224, 64, 28, 152, 66, 6, 210, 23, 248, 1, 27, 2, 93, 145, 66, 247, 208, 7, 32, 178, 231, 48, 70, 176, 231, 16, 8, 4, 8, 45, 233, 248, 67, 4, 70, 8, 70, 0, 39, 129, 10, 141, 2, 225, 178, 1, 41, 42, 209, 4, 38, 79, 240, 0, 104, 79, 244, 0, 73, 20, 244, 128, 127, 27, 208, 255, 247, 80, 255, 58, 72, 70, 96, 225, 178, 2, 41, 0, 209, 133, 96, 70, 240, 64, 1, 65, 96, 1, 104, 17, 240, 1, 15, 251, 209, 32, 33, 1, 96, 1, 104, 17, 240, 16, 15, 2, 208, 16, 33, 1, 96, 4, 39, 255, 247, 82, 255, 0, 47, 41, 209, 20, 244, 0, 127, 38, 208, 0, 32, 79, 240, 255, 50, 26, 224, 2, 41, 10, 209, 255, 247, 5, 255, 4, 40, 1, 208, 2, 32, 15, 224, 2, 38, 168, 70, 79, 244, 128, 121, 204, 231, 224, 178, 3, 40, 6, 209, 79, 244, 8, 118, 223, 248, 136, 128, 79, 240, 128, 9, 194, 231, 3, 32, 189, 232, 242, 131, 64, 28, 72, 69, 5, 210, 88, 248, 4, 27, 145, 66, 248, 208, 7, 32, 244, 231, 56, 70, 242, 231, 16, 181, 130, 176, 4, 70, 0, 240, 47, 248, 28, 177, 0, 32, 141, 248, 0, 0, 18, 224, 165, 32, 141, 248, 0, 0, 255, 247, 251, 254, 16, 76, 79, 244, 4, 112, 96, 96, 15, 72, 165, 33, 1, 128, 0, 33, 64, 242, 3, 16, 255, 247, 139, 255, 4, 32, 32, 96, 157, 248, 0, 0, 192, 67, 141, 248, 1, 0, 2, 35, 2, 34, 0, 169, 6, 72, 255, 247, 12, 255, 0, 40, 12, 191, 121, 32, 31, 32, 255, 247, 116, 254, 19, 189, 0, 0, 12, 128, 0, 64, 0, 8, 4, 8, 121, 32, 107, 230, 45, 233, 240, 67, 195, 176, 193, 72, 0, 104, 193, 73, 136, 66, 2, 208, 192, 72, 255, 247, 81, 254, 205, 72, 1, 104, 33, 240, 240, 1, 65, 240, 128, 1, 1, 96, 129, 104, 65, 240, 32, 1, 129, 96
bootloader_cut_1_2v3 = [0, 2, 0, 32, 21, 7, 4, 8, 125, 0, 4, 8, 125, 0, 4, 8, 167, 15, 3, 0, 0, 0, 0, 0, 0, 8, 4, 8, 0, 0, 0, 8, 0, 2, 0, 32, 169, 1, 4, 8, 141, 2, 4, 8, 95, 234, 0, 13, 112, 71, 79, 240, 0, 81, 8, 96, 223, 248, 188, 6, 68, 242, 68, 65, 1, 96, 0, 34, 130, 96, 223, 248, 184, 6, 1, 96, 223, 248, 180, 6, 66, 97, 130, 97, 130, 96, 2, 96, 223, 248, 160, 6, 2, 96, 66, 96, 98, 182, 112, 71, 128, 181, 255, 247, 228, 255, 2, 72, 2, 73, 1, 96, 1, 189, 0, 191, 12, 237, 0, 224, 4, 0, 250, 5, 0, 72, 241, 231, 21, 1, 15, 240, 8, 73, 8, 96, 200, 104, 16, 240, 4, 15, 251, 208, 200, 104, 16, 240, 64, 15, 251, 208, 112, 71, 3, 72, 193, 104, 17, 240, 2, 15, 251, 208, 0, 104, 112, 71, 60, 200, 0, 64, 248, 181, 5, 70, 12, 0, 67, 191, 0, 38, 32, 70, 68, 66, 38, 70, 0, 39, 255, 247, 236, 255, 120, 85, 70, 64, 127, 28, 188, 66, 248, 210, 255, 247, 229, 255, 134, 66, 4, 208, 31, 32, 255, 247, 213, 255, 0, 32, 242, 189, 96, 28, 242, 189, 128, 181, 0, 240, 96, 249, 111, 240, 2, 1, 0, 168, 255, 247, 221, 255, 4, 40, 2, 208, 79, 240, 255, 48, 2, 189, 0, 240, 84, 249, 0, 152, 0, 186, 2, 189, 0, 0, 223, 248, 252, 21, 136, 66, 4, 211, 176, 241, 32, 47, 1, 210, 2, 32, 112, 71, 176, 241, 0, 111, 4, 211, 9, 73, 136, 66, 1, 210, 4, 32, 112, 71, 158, 73, 136, 66, 4, 211, 6, 73, 136, 66, 6, 210, 8, 32, 112, 71, 5, 73, 136, 66, 1, 211, 16, 32, 112, 71, 1, 32, 112, 71, 0, 0, 2, 8, 0, 10, 4, 8, 0, 0, 4, 8, 9, 72, 10, 73, 1, 96, 10, 74, 2, 96, 65, 96, 66, 96, 16, 73, 1, 34, 10, 96, 74, 104, 18, 240, 1, 15, 251, 208, 129, 104, 17, 240, 1, 15, 251, 209, 112, 71, 0, 191, 4, 128, 0, 64, 35, 1, 103, 69, 171, 137, 239, 205, 6, 72, 65, 104, 17, 240, 2, 15, 251, 209, 0, 33, 1, 96, 2, 72, 128, 33, 1, 96, 112, 71, 0, 191, 16, 128, 0, 64, 44, 64, 0, 64, 45, 233, 248, 67, 128, 70, 12, 70, 21, 70, 0, 38, 71, 70, 0, 45, 88, 208, 8, 240, 1, 0, 5, 240, 1, 1, 8, 67, 1, 208, 1, 32, 15, 224, 64, 70, 255, 247, 156, 255, 129, 70, 5, 235, 8, 0, 64, 30, 255, 247, 150, 255, 64, 234, 9, 0, 4, 40, 4, 208, 8, 40, 2, 208, 2, 32, 189, 232, 242, 131, 255, 247, 177, 255, 0, 32, 106, 73, 1, 224, 191, 28, 128, 28, 168, 66, 50, 210, 59, 136, 2, 25, 82, 120, 16, 248, 4, 128, 8, 235, 2, 34, 146, 178, 147, 66, 241, 208, 79, 246, 255, 120, 67, 69, 1, 208, 19, 0, 33, 209, 96, 75, 159, 66, 5, 211, 24, 75, 159, 66, 2, 210, 79, 244, 4, 115, 1, 224, 64, 242, 1, 35, 75, 96, 58, 128, 10, 104, 18, 240, 1, 15, 251, 209, 32, 34, 10, 96, 10, 104, 18, 240, 20, 15, 212, 208, 8, 104, 16, 240, 16, 15, 20, 191, 4, 38, 5, 38, 16, 32, 8, 96, 4, 32, 8, 96, 0, 224, 6, 38, 255, 247, 143, 255, 11, 224, 0, 32, 0, 224, 64, 28, 152, 66, 6, 210, 23, 248, 1, 27, 2, 93, 145, 66, 247, 208, 7, 32, 178, 231, 48, 70, 176, 231, 16, 8, 4, 8, 45, 233, 248, 67, 4, 70, 8, 70, 0, 39, 129, 10, 141, 2, 225, 178, 1, 41, 42, 209, 4, 38, 79, 240, 0, 104, 79, 244, 0, 73, 20, 244, 128, 127, 27, 208, 255, 247, 80, 255, 58, 72, 70, 96, 225, 178, 2, 41, 0, 209, 133, 96, 70, 240, 64, 1, 65, 96, 1, 104, 17, 240, 1, 15, 251, 209, 32, 33, 1, 96, 1, 104, 17, 240, 16, 15, 2, 208, 16, 33, 1, 96, 4, 39, 255, 247, 82, 255, 0, 47, 41, 209, 20, 244, 0, 127, 38, 208, 0, 32, 79, 240, 255, 50, 26, 224, 2, 41, 10, 209, 255, 247, 5, 255, 4, 40, 1, 208, 2, 32, 15, 224, 2, 38, 168, 70, 79, 244, 128, 121, 204, 231, 224, 178, 3, 40, 6, 209, 79, 244, 8, 118, 223, 248, 136, 128, 79, 240, 128, 9, 194, 231, 3, 32, 189, 232, 242, 131, 64, 28, 72, 69, 5, 210, 88, 248, 4, 27, 145, 66, 248, 208, 7, 32, 244, 231, 56, 70, 242, 231, 16, 181, 130, 176, 4, 70, 0, 240, 47, 248, 28, 177, 0, 32, 141, 248, 0, 0, 18, 224, 165, 32, 141, 248, 0, 0, 255, 247, 251, 254, 16, 76, 79, 244, 4, 112, 96, 96, 15, 72, 165, 33, 1, 128, 0, 33, 64, 242, 3, 16, 255, 247, 139, 255, 4, 32, 32, 96, 157, 248, 0, 0, 192, 67, 141, 248, 1, 0, 2, 35, 2, 34, 0, 169, 6, 72, 255, 247, 12, 255, 0, 40, 12, 191, 121, 32, 31, 32, 255, 247, 116, 254, 19, 189, 0, 0, 12, 128, 0, 64, 0, 8, 4, 8, 121, 32, 107, 230, 45, 233, 240, 67, 195, 176, 193, 72, 0, 104, 193, 73, 136, 66, 2, 208, 192, 72, 255, 247, 81, 254, 205, 72, 1, 104, 33, 240, 240, 1, 65, 240, 128, 1, 1, 96, 129, 104, 65, 240, 32, 1, 129, 96
bootloader_cut_1_3v3 = [0, 2, 0, 32, 25, 7, 4, 8, 125, 0, 4, 8, 125, 0, 4, 8, 167, 15, 3, 0, 0, 0, 0, 0, 0, 8, 4, 8, 0, 0, 0, 8, 0, 2, 0, 32, 169, 1, 4, 8, 141, 2, 4, 8, 95, 234, 0, 13, 112, 71, 79, 240, 0, 81, 8, 96, 223, 248, 192, 6, 68, 242, 68, 65, 1, 96, 0, 34, 130, 96, 223, 248, 188, 6, 1, 96, 223, 248, 184, 6, 66, 97, 130, 97, 130, 96, 2, 96, 223, 248, 164, 6, 2, 96, 66, 96, 98, 182, 112, 71, 128, 181, 255, 247, 228, 255, 2, 72, 2, 73, 1, 96, 1, 189, 0, 191, 12, 237, 0, 224, 4, 0, 250, 5, 0, 72, 241, 231, 21, 1, 15, 240, 8, 73, 8, 96, 200, 104, 16, 240, 4, 15, 251, 208, 200, 104, 16, 240, 64, 15, 251, 208, 112, 71, 3, 72, 193, 104, 17, 240, 2, 15, 251, 208, 0, 104, 112, 71, 60, 200, 0, 64, 248, 181, 5, 70, 12, 0, 67, 191, 0, 38, 32, 70, 68, 66, 38, 70, 0, 39, 255, 247, 236, 255, 120, 85, 70, 64, 127, 28, 188, 66, 248, 210, 255, 247, 229, 255, 134, 66, 4, 208, 31, 32, 255, 247, 213, 255, 0, 32, 242, 189, 96, 28, 242, 189, 128, 181, 0, 240, 96, 249, 111, 240, 2, 1, 0, 168, 255, 247, 221, 255, 4, 40, 2, 208, 79, 240, 255, 48, 2, 189, 0, 240, 84, 249, 0, 152, 0, 186, 2, 189, 0, 0, 223, 248, 0, 22, 136, 66, 4, 211, 176, 241, 32, 47, 1, 210, 2, 32, 112, 71, 176, 241, 0, 111, 4, 211, 9, 73, 136, 66, 1, 210, 4, 32, 112, 71, 158, 73, 136, 66, 4, 211, 6, 73, 136, 66, 6, 210, 8, 32, 112, 71, 5, 73, 136, 66, 1, 211, 16, 32, 112, 71, 1, 32, 112, 71, 0, 0, 2, 8, 0, 10, 4, 8, 0, 0, 4, 8, 9, 72, 10, 73, 1, 96, 10, 74, 2, 96, 65, 96, 66, 96, 16, 73, 1, 34, 10, 96, 74, 104, 18, 240, 1, 15, 251, 208, 129, 104, 17, 240, 1, 15, 251, 209, 112, 71, 0, 191, 4, 128, 0, 64, 35, 1, 103, 69, 171, 137, 239, 205, 6, 72, 65, 104, 17, 240, 2, 15, 251, 209, 0, 33, 1, 96, 2, 72, 128, 33, 1, 96, 112, 71, 0, 191, 16, 128, 0, 64, 44, 64, 0, 64, 45, 233, 248, 67, 128, 70, 12, 70, 21, 70, 0, 38, 71, 70, 0, 45, 88, 208, 8, 240, 1, 0, 5, 240, 1, 1, 8, 67, 1, 208, 1, 32, 15, 224, 64, 70, 255, 247, 156, 255, 129, 70, 5, 235, 8, 0, 64, 30, 255, 247, 150, 255, 64, 234, 9, 0, 4, 40, 4, 208, 8, 40, 2, 208, 2, 32, 189, 232, 242, 131, 255, 247, 177, 255, 0, 32, 106, 73, 1, 224, 191, 28, 128, 28, 168, 66, 50, 210, 59, 136, 2, 25, 82, 120, 16, 248, 4, 128, 8, 235, 2, 34, 146, 178, 147, 66, 241, 208, 79, 246, 255, 120, 67, 69, 1, 208, 19, 0, 33, 209, 96, 75, 159, 66, 5, 211, 24, 75, 159, 66, 2, 210, 79, 244, 4, 115, 1, 224, 64, 242, 1, 35, 75, 96, 58, 128, 10, 104, 18, 240, 1, 15, 251, 209, 32, 34, 10, 96, 10, 104, 18, 240, 20, 15, 212, 208, 8, 104, 16, 240, 16, 15, 20, 191, 4, 38, 5, 38, 16, 32, 8, 96, 4, 32, 8, 96, 0, 224, 6, 38, 255, 247, 143, 255, 11, 224, 0, 32, 0, 224, 64, 28, 152, 66, 6, 210, 23, 248, 1, 27, 2, 93, 145, 66, 247, 208, 7, 32, 178, 231, 48, 70, 176, 231, 16, 8, 4, 8, 45, 233, 248, 67, 4, 70, 8, 70, 0, 39, 129, 10, 141, 2, 225, 178, 1, 41, 42, 209, 4, 38, 79, 240, 0, 104, 79, 244, 0, 73, 20, 244, 128, 127, 27, 208, 255, 247, 80, 255, 58, 72, 70, 96, 225, 178, 2, 41, 0, 209, 133, 96, 70, 240, 64, 1, 65, 96, 1, 104, 17, 240, 1, 15, 251, 209, 32, 33, 1, 96, 1, 104, 17, 240, 16, 15, 2, 208, 16, 33, 1, 96, 4, 39, 255, 247, 82, 255, 0, 47, 41, 209, 20, 244, 0, 127, 38, 208, 0, 32, 79, 240, 255, 50, 26, 224, 2, 41, 10, 209, 255, 247, 5, 255, 4, 40, 1, 208, 2, 32, 15, 224, 2, 38, 168, 70, 79, 244, 128, 121, 204, 231, 224, 178, 3, 40, 6, 209, 79, 244, 8, 118, 223, 248, 136, 128, 79, 240, 128, 9, 194, 231, 3, 32, 189, 232, 242, 131, 64, 28, 72, 69, 5, 210, 88, 248, 4, 27, 145, 66, 248, 208, 7, 32, 244, 231, 56, 70, 242, 231, 16, 181, 130, 176, 4, 70, 0, 240, 47, 248, 28, 177, 0, 32, 141, 248, 0, 0, 18, 224, 165, 32, 141, 248, 0, 0, 255, 247, 251, 254, 16, 76, 79, 244, 4, 112, 96, 96, 15, 72, 165, 33, 1, 128, 0, 33, 64, 242, 3, 16, 255, 247, 139, 255, 4, 32, 32, 96, 157, 248, 0, 0, 192, 67, 141, 248, 1, 0, 2, 35, 2, 34, 0, 169, 6, 72, 255, 247, 12, 255, 0, 40, 12, 191, 121, 32, 31, 32, 255, 247, 116, 254, 19, 189, 0, 0, 12, 128, 0, 64, 0, 8, 4, 8, 121, 32, 107, 230, 45, 233, 240, 67, 195, 176, 194, 72, 0, 104, 0, 2, 0, 10, 193, 73, 136, 66, 2, 208, 192, 72, 255, 247, 79, 254, 205, 72, 1, 104, 33, 240, 240, 1, 65, 240, 128, 1, 1, 96, 129, 104, 65, 240, 32,
cibDecoder = None
fibDecoder = None
class IBDecoder(object):
def __init__(self, baseAddress, decodeInfo):
self.baseAddress = baseAddress
self.decodeInfo = []
for i in decodeInfo:
CName = None
if len(i) > 6:
CName = (i[6])
self.decodeInfo = (self.decodeInfo + [IBEntry((i[0]), (i[1]), (i[2]), (i[3]), (i[4]), (i[5]), CName)])
def decodeRawData(self, rawData):
for i in self.decodeInfo:
i.rawData = rawData[(i.address - (self.baseAddress & 65535)):((i.address - (self.baseAddress & 65535)) + i.length)]
autoData = None
if i.name == 'Die Info Checksum':
autoData = rawData[1918:1936]
else:
if i.name == 'Configuration Info Checksum':
autoData = rawData[1942:30710]
item0, item1 = i.type.decode(i.rawData, i.validRange, autoData, rawData)
i.valid = item0
i.value = item1
class IBEntry(object):
def __init__(self, name, address, length, description, validRange, type, CName=None):
self.name = name
self.address = address
self.length = length
self.description = description
self.validRange = validRange
self.type = type
self.value = None
self.CName = CName
self.rawData = None
self.valid = None
class VALUE(object):
def __init__(self, type):
self.type = type
def decode(self, data, validRange, autoData=None, rawData=None):
valid = True
minVal, maxVal = validRangeMinMax(validRange)
if minVal != None:
tempValue = 0
for i in range(len(data)):
tempValue = (tempValue + ((data[i]) << (8 * i)))
continue
if (tempValue < minVal or tempValue > maxVal):
valid = False
if self.type == U16:
retVal = ('0x%04X' % ((data[0]) + ((data[1]) << 8)))
else:
if self.type == DATE:
tmp = ((data[0]) + ((data[1]) << 8))
try:
retVal = time.strftime('%a, %d %b %Y', time.localtime(((tmp * 24) * 3600)))
except:
retVal = 'Invalid'
else:
if self.type == ASCII_REVERSED:
retVal = ''.join(('%c' % a) for a in reversed(data))
else:
if self.type == ASCII:
try:
dataTemp = data[:data.index(255)]
except ValueError:
dataTemp = data
retVal = ''.join(('%c' % a) for a in dataTemp)
else:
if self.type == X_Y_TSMC:
retVal = ('x = %d, y = %d' % ((data[1]), (data[0])))
else:
if self.type == U8:
retVal = ('0x%02X' % (data[0]))
else:
if self.type == DIE_REV:
dieRevMap = ['cut 1.0', 'cut 1.1', 'cut 1.2', 'cut 1.3']
try:
retVal = (dieRevMap[(data[0])])
except:
retVal = 'Unknown'
else:
if self.type == MANUFACTURER_INFO:
manufacturerInfoMap = ['Ember', 'STMicroelectronics']
try:
retVal = (manufacturerInfoMap[(data[0])])
except:
retVal = 'Unknown'
else:
if self.type == DIE_ID:
dieIdMap = ['Stromboli']
try:
retVal = (dieIdMap[(data[0])])
except:
retVal = 'Unknown'
else:
if self.type == PART_NUMBER:
partNumberMap = ['STM32W108C', 'STM32W108H']
try:
retVal = (partNumberMap[(data[0])])
except:
retVal = 'Unknown'
else:
if self.type == PART_SUFFIX:
partNumberSuffix = ['', 'ES']
try:
retVal = (partNumberSuffix[(data[0])])
except:
retVal = 'Unknown'
else:
if self.type == STACK_TYPE:
tmp = []
if ((data[0]) & 1):
tmp = (tmp + ['SimpleMAC'])
if ((data[0]) & 2):
tmp = (tmp + ['RF4CE'])
if ((data[0]) & 128):
tmp = (tmp + ['EmberZNet'])
retVal = ','.join(('%s' % a) for a in tmp)
else:
if self.type == TEST_PROGRAM_INFO:
retVal = ('Tester = %d, revision %d.%d' % ((data[3]), ((data[0]) + ((data[1]) << 8)), (data[2])))
else:
if self.type == EUI64:
retVal = ('0x' + ''.join(('%02X' % a) for a in reversed(data)))
else:
if self.type == VOLTAGE:
tmp = (((data[0]) + ((data[1]) << 8)) / 10000.0)
retVal = ('%.04f V' % tmp)
else:
if self.type == FIB_VERSION:
if (data[0]) != ((~(data[1])) & 255):
retVal = 'Version invalid'
else:
retVal = ('Version %d' % (data[1]))
else:
if self.type == RAM_SIZE:
if ((data[0]) != ((~(data[1])) & 255) or (data[0]) != 2):
retVal = 'Invalid RAM size'
else:
retVal = '8KB RAM'
else:
if self.type == FLASH_SIZE:
if ((data[0]) != ((~(data[1])) & 255) or (data[0]) != 128):
retVal = 'Invalid Flash size'
else:
retVal = '128KB FLASH'
else:
if self.type == READ_PROTECTION:
if ((data[0]) != ((~(data[1])) & 255) and (data[0]) != 255):
retVal = 'Invalid value'
else:
if ((data[0]) == 165 and (data[1]) == 90):
retVal = 'Read protection not active'
else:
retVal = 'Read protection active'
else:
if self.type == WRITE_PROTECTION:
if (data[0]) != ((~(data[1])) & 255):
retVal = 'Invalid value'
else:
if (data[0]) == 255:
retVal = 'Write protection not active'
else:
retVal = 'Write protection active'
else:
if self.type == FPEC_TIMING:
if ((data[0]) != ((~(data[1])) & 255) or (data[1]) != 170):
retVal = 'Invalid'
else:
retVal = '19us program, 20ms erase'
else:
if self.type == AUTO_U16_CHECKSUM:
tmp = ((data[0]) + ((data[1]) << 8))
checkSum = 0
for i in range(len(autoData)):
checkSum = (checkSum + (autoData[i]))
continue
checkSum = (checkSum & 65535)
if tmp != checkSum:
valid = False
retVal = ('0x%04X (0x%04x)' % (tmp, checkSum))
else:
retVal = ('0x%04X' % tmp)
else:
if self.type == AUTO_U16_CRC:
tmp = ((data[0]) + ((data[1]) << 8))
crc = 65535
for i in range(len(autoData)):
crc = crc16((autoData[i]), crc)
continue
if tmp != crc:
valid = False
retVal = ('0x%04X (0x%04x)' % (tmp, crc))
else:
retVal = ('0x%04X' % tmp)
else:
if self.type == BOOTLOADER_CODE:
dieRev = (rawData[1944])
dieRevMap = ['cut 1.0', 'cut 1.1', 'cut 1.2', 'cut 1.3']
try:
rev = (dieRevMap[dieRev])
except:
rev = 'cut x.x'
if data != ([255] * len(data)):
blCut = 'invalid'
else:
blCut = 'not present'
for key in bootloader.keys():
bl = (bootloader[key])
if bl == data[0:len(bl)]:
blCut = key[:-2]
break
else:
continue
retVal = (('Bootloader ' + blCut) + (' (Version %d)' % (data[18])))
if rev != blCut:
valid = False
retVal = (retVal + (' die rev is ' + rev))
else:
retVal = None
return (valid, retVal)
def crc16(byte, crc):
byte = (byte & 255)
crc = (crc & 65535)
crc = ((crc >> 8) | (crc << 8))
crc = (crc ^ byte)
crc = (crc ^ ((crc & 255) >> 4))
crc = (crc ^ ((crc << 8) << 4))
crc = (crc ^ (((crc & 255) << 4) << 1))
return (crc & 65535)
def validRangeMinMax(validRange):
minValue, maxValue = (None, None)
if validRange != 'Not specified':
tmp = validRange.split('-')
minValue = int((tmp[0]), 16)
maxValue = minValue
if len(tmp) > 1:
maxValue = int((tmp[1]), 16)
return (minValue, maxValue)