BA
/
BaBoRo_test2
Backup 1
mbed-os/tools/targets/NCS.py@0:02dd72d1d465, 2018-04-24 (annotated)
- Committer:
- borlanic
- Date:
- Tue Apr 24 11:45:18 2018 +0000
- Revision:
- 0:02dd72d1d465
BaBoRo_test2 - backup 1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
borlanic | 0:02dd72d1d465 | 1 | """ |
borlanic | 0:02dd72d1d465 | 2 | @copyright (c) 2012 ON Semiconductor. All rights reserved. |
borlanic | 0:02dd72d1d465 | 3 | ON Semiconductor is supplying this software for use with ON Semiconductor |
borlanic | 0:02dd72d1d465 | 4 | processor based microcontrollers only. |
borlanic | 0:02dd72d1d465 | 5 | THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED |
borlanic | 0:02dd72d1d465 | 6 | OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF |
borlanic | 0:02dd72d1d465 | 7 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. |
borlanic | 0:02dd72d1d465 | 8 | ON SEMICONDUCTOR SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, |
borlanic | 0:02dd72d1d465 | 9 | INCIDENTAL, OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. |
borlanic | 0:02dd72d1d465 | 10 | """ |
borlanic | 0:02dd72d1d465 | 11 | |
borlanic | 0:02dd72d1d465 | 12 | from __future__ import absolute_import |
borlanic | 0:02dd72d1d465 | 13 | from __future__ import print_function |
borlanic | 0:02dd72d1d465 | 14 | |
borlanic | 0:02dd72d1d465 | 15 | import itertools |
borlanic | 0:02dd72d1d465 | 16 | import binascii |
borlanic | 0:02dd72d1d465 | 17 | import intelhex |
borlanic | 0:02dd72d1d465 | 18 | from tools.config import Config |
borlanic | 0:02dd72d1d465 | 19 | |
borlanic | 0:02dd72d1d465 | 20 | FIB_BASE = 0x2000 |
borlanic | 0:02dd72d1d465 | 21 | TRIM_BASE = 0x2800 |
borlanic | 0:02dd72d1d465 | 22 | FLASH_BASE = 0x3000 |
borlanic | 0:02dd72d1d465 | 23 | FLASHA_SIZE = 0x52000 |
borlanic | 0:02dd72d1d465 | 24 | FLASHB_BASE = 0x00102000 |
borlanic | 0:02dd72d1d465 | 25 | FLASHB_SIZE = 0x52000 |
borlanic | 0:02dd72d1d465 | 26 | FW_REV = 0x01000100 |
borlanic | 0:02dd72d1d465 | 27 | |
borlanic | 0:02dd72d1d465 | 28 | def ranges(i): |
borlanic | 0:02dd72d1d465 | 29 | for _, b in itertools.groupby(enumerate(i), lambda x_y: x_y[1] - x_y[0]): |
borlanic | 0:02dd72d1d465 | 30 | b = list(b) |
borlanic | 0:02dd72d1d465 | 31 | yield b[0][1], b[-1][1] |
borlanic | 0:02dd72d1d465 | 32 | |
borlanic | 0:02dd72d1d465 | 33 | |
borlanic | 0:02dd72d1d465 | 34 | def add_fib_at_start(arginput): |
borlanic | 0:02dd72d1d465 | 35 | input_file = arginput + ".hex" |
borlanic | 0:02dd72d1d465 | 36 | file_name_hex = arginput + ".hex" |
borlanic | 0:02dd72d1d465 | 37 | file_name_bin = arginput + ".bin" |
borlanic | 0:02dd72d1d465 | 38 | |
borlanic | 0:02dd72d1d465 | 39 | # Read in hex file |
borlanic | 0:02dd72d1d465 | 40 | input_hex_file = intelhex.IntelHex() |
borlanic | 0:02dd72d1d465 | 41 | input_hex_file.loadhex(input_file) |
borlanic | 0:02dd72d1d465 | 42 | #set padding value to be returned when reading from unspecified address |
borlanic | 0:02dd72d1d465 | 43 | input_hex_file.padding = 0xFF |
borlanic | 0:02dd72d1d465 | 44 | # Create new hex file |
borlanic | 0:02dd72d1d465 | 45 | output_hex_file = intelhex.IntelHex() |
borlanic | 0:02dd72d1d465 | 46 | |
borlanic | 0:02dd72d1d465 | 47 | # Get the starting and ending address |
borlanic | 0:02dd72d1d465 | 48 | addresses = input_hex_file.addresses() |
borlanic | 0:02dd72d1d465 | 49 | addresses.sort() |
borlanic | 0:02dd72d1d465 | 50 | start_end_pairs = list(ranges(addresses)) |
borlanic | 0:02dd72d1d465 | 51 | regions = len(start_end_pairs) |
borlanic | 0:02dd72d1d465 | 52 | |
borlanic | 0:02dd72d1d465 | 53 | if regions == 1: |
borlanic | 0:02dd72d1d465 | 54 | #single range indicating fits within first flash block (<320K) |
borlanic | 0:02dd72d1d465 | 55 | start, end = start_end_pairs[0] |
borlanic | 0:02dd72d1d465 | 56 | print("Memory start 0x%08X, end 0x%08X" % (start, end)) |
borlanic | 0:02dd72d1d465 | 57 | # Compute checksum over the range (don't include data at location of crc) |
borlanic | 0:02dd72d1d465 | 58 | size = end - start + 1 |
borlanic | 0:02dd72d1d465 | 59 | data = input_hex_file.tobinarray(start=start, size=size) |
borlanic | 0:02dd72d1d465 | 60 | crc32 = binascii.crc32(data) & 0xFFFFFFFF |
borlanic | 0:02dd72d1d465 | 61 | else: |
borlanic | 0:02dd72d1d465 | 62 | #multiple ranges indicating requires both flash blocks (>320K) |
borlanic | 0:02dd72d1d465 | 63 | start, end = start_end_pairs[0] |
borlanic | 0:02dd72d1d465 | 64 | start2, end2 = start_end_pairs[1] |
borlanic | 0:02dd72d1d465 | 65 | print("Region 1: memory start 0x%08X, end 0x%08X" % (start, end)) |
borlanic | 0:02dd72d1d465 | 66 | print("Region 2: memory start 0x%08X, end 0x%08X" % (start2, end2)) |
borlanic | 0:02dd72d1d465 | 67 | # Compute checksum over the range (don't include data at location of crc) |
borlanic | 0:02dd72d1d465 | 68 | # replace end with end of flash block A |
borlanic | 0:02dd72d1d465 | 69 | end = FLASHA_SIZE - 1 |
borlanic | 0:02dd72d1d465 | 70 | size = end - start + 1 |
borlanic | 0:02dd72d1d465 | 71 | data = input_hex_file.tobinarray(start=start, size=size) |
borlanic | 0:02dd72d1d465 | 72 | |
borlanic | 0:02dd72d1d465 | 73 | # replace start2 with base of flash block B |
borlanic | 0:02dd72d1d465 | 74 | start2 = FLASHB_BASE |
borlanic | 0:02dd72d1d465 | 75 | size2 = end2 - start2 + 1 |
borlanic | 0:02dd72d1d465 | 76 | data2 = input_hex_file.tobinarray(start=start2, size=size2) |
borlanic | 0:02dd72d1d465 | 77 | |
borlanic | 0:02dd72d1d465 | 78 | #concatenate data and data2 arrays together |
borlanic | 0:02dd72d1d465 | 79 | data.extend(data2) |
borlanic | 0:02dd72d1d465 | 80 | crc32 = binascii.crc32(data) & 0xFFFFFFFF |
borlanic | 0:02dd72d1d465 | 81 | |
borlanic | 0:02dd72d1d465 | 82 | #replace size with sum of two memory region sizes |
borlanic | 0:02dd72d1d465 | 83 | size = size + size2 |
borlanic | 0:02dd72d1d465 | 84 | |
borlanic | 0:02dd72d1d465 | 85 | assert start >= FLASH_BASE, ("Error - start 0x%x less than begining of user\ |
borlanic | 0:02dd72d1d465 | 86 | flash area" %start) |
borlanic | 0:02dd72d1d465 | 87 | |
borlanic | 0:02dd72d1d465 | 88 | assert regions <= 2, ("Error - more than 2 memory regions found") |
borlanic | 0:02dd72d1d465 | 89 | |
borlanic | 0:02dd72d1d465 | 90 | fw_rev = FW_REV |
borlanic | 0:02dd72d1d465 | 91 | |
borlanic | 0:02dd72d1d465 | 92 | checksum = (start + size + crc32 + fw_rev) & 0xFFFFFFFF |
borlanic | 0:02dd72d1d465 | 93 | |
borlanic | 0:02dd72d1d465 | 94 | print("Writing FIB: base 0x%08X, size 0x%08X, crc32 0x%08X, fw rev 0x%08X,\ |
borlanic | 0:02dd72d1d465 | 95 | checksum 0x%08X" % (start, size, crc32, fw_rev, checksum)) |
borlanic | 0:02dd72d1d465 | 96 | |
borlanic | 0:02dd72d1d465 | 97 | #expected initial values used by daplink to validate that it is a valid bin |
borlanic | 0:02dd72d1d465 | 98 | #file added as dummy values in this file because the fib area preceeds the |
borlanic | 0:02dd72d1d465 | 99 | #application area the bootloader will ignore these dummy values |
borlanic | 0:02dd72d1d465 | 100 | # 00 is stack pointer (RAM address) |
borlanic | 0:02dd72d1d465 | 101 | # 04 is Reset vector (FLASH address) |
borlanic | 0:02dd72d1d465 | 102 | # 08 NMI_Handler (FLASH address) |
borlanic | 0:02dd72d1d465 | 103 | # 0C HardFault_Handler(FLASH address) |
borlanic | 0:02dd72d1d465 | 104 | # 10 dummy |
borlanic | 0:02dd72d1d465 | 105 | dummy_sp = 0x3FFFFC00 |
borlanic | 0:02dd72d1d465 | 106 | dummy_reset_vector = 0x00003625 |
borlanic | 0:02dd72d1d465 | 107 | dummy_nmi_handler = 0x00003761 |
borlanic | 0:02dd72d1d465 | 108 | dummy_hardfault_handler = 0x00003691 |
borlanic | 0:02dd72d1d465 | 109 | dummy_blank = 0x00000000 |
borlanic | 0:02dd72d1d465 | 110 | |
borlanic | 0:02dd72d1d465 | 111 | #expected fib structure |
borlanic | 0:02dd72d1d465 | 112 | #typedef struct fib{ |
borlanic | 0:02dd72d1d465 | 113 | #uint32_t base; /**< Base offset of firmware, indicating what flash the |
borlanic | 0:02dd72d1d465 | 114 | # firmware is in. (will never be 0x11111111) */ |
borlanic | 0:02dd72d1d465 | 115 | #uint32_t size; /**< Size of the firmware */ |
borlanic | 0:02dd72d1d465 | 116 | #uint32_t crc; /**< CRC32 for firmware correctness check */ |
borlanic | 0:02dd72d1d465 | 117 | #uint32_t rev; /**< Revision number */ |
borlanic | 0:02dd72d1d465 | 118 | #uint32_t checksum; /**< Check-sum of information block */ |
borlanic | 0:02dd72d1d465 | 119 | #}fib_t, *fib_pt; |
borlanic | 0:02dd72d1d465 | 120 | |
borlanic | 0:02dd72d1d465 | 121 | fib_start = FIB_BASE |
borlanic | 0:02dd72d1d465 | 122 | dummy_fib_size = 20 |
borlanic | 0:02dd72d1d465 | 123 | fib_size = 20 |
borlanic | 0:02dd72d1d465 | 124 | trim_size = 24 |
borlanic | 0:02dd72d1d465 | 125 | user_code_start = FLASH_BASE |
borlanic | 0:02dd72d1d465 | 126 | trim_area_start = TRIM_BASE |
borlanic | 0:02dd72d1d465 | 127 | |
borlanic | 0:02dd72d1d465 | 128 | # Write FIB to the file in little endian |
borlanic | 0:02dd72d1d465 | 129 | output_hex_file[fib_start + 0] = (dummy_sp >> 0) & 0xFF |
borlanic | 0:02dd72d1d465 | 130 | output_hex_file[fib_start + 1] = (dummy_sp >> 8) & 0xFF |
borlanic | 0:02dd72d1d465 | 131 | output_hex_file[fib_start + 2] = (dummy_sp >> 16) & 0xFF |
borlanic | 0:02dd72d1d465 | 132 | output_hex_file[fib_start + 3] = (dummy_sp >> 24) & 0xFF |
borlanic | 0:02dd72d1d465 | 133 | |
borlanic | 0:02dd72d1d465 | 134 | output_hex_file[fib_start + 4] = (dummy_reset_vector >> 0) & 0xFF |
borlanic | 0:02dd72d1d465 | 135 | output_hex_file[fib_start + 5] = (dummy_reset_vector >> 8) & 0xFF |
borlanic | 0:02dd72d1d465 | 136 | output_hex_file[fib_start + 6] = (dummy_reset_vector >> 16) & 0xFF |
borlanic | 0:02dd72d1d465 | 137 | output_hex_file[fib_start + 7] = (dummy_reset_vector >> 24) & 0xFF |
borlanic | 0:02dd72d1d465 | 138 | |
borlanic | 0:02dd72d1d465 | 139 | output_hex_file[fib_start + 8] = (dummy_nmi_handler >> 0) & 0xFF |
borlanic | 0:02dd72d1d465 | 140 | output_hex_file[fib_start + 9] = (dummy_nmi_handler >> 8) & 0xFF |
borlanic | 0:02dd72d1d465 | 141 | output_hex_file[fib_start + 10] = (dummy_nmi_handler >> 16) & 0xFF |
borlanic | 0:02dd72d1d465 | 142 | output_hex_file[fib_start + 11] = (dummy_nmi_handler >> 24) & 0xFF |
borlanic | 0:02dd72d1d465 | 143 | |
borlanic | 0:02dd72d1d465 | 144 | output_hex_file[fib_start + 12] = (dummy_hardfault_handler >> 0) & 0xFF |
borlanic | 0:02dd72d1d465 | 145 | output_hex_file[fib_start + 13] = (dummy_hardfault_handler >> 8) & 0xFF |
borlanic | 0:02dd72d1d465 | 146 | output_hex_file[fib_start + 14] = (dummy_hardfault_handler >> 16) & 0xFF |
borlanic | 0:02dd72d1d465 | 147 | output_hex_file[fib_start + 15] = (dummy_hardfault_handler >> 24) & 0xFF |
borlanic | 0:02dd72d1d465 | 148 | |
borlanic | 0:02dd72d1d465 | 149 | output_hex_file[fib_start + 16] = (dummy_blank >> 0) & 0xFF |
borlanic | 0:02dd72d1d465 | 150 | output_hex_file[fib_start + 17] = (dummy_blank >> 8) & 0xFF |
borlanic | 0:02dd72d1d465 | 151 | output_hex_file[fib_start + 18] = (dummy_blank >> 16) & 0xFF |
borlanic | 0:02dd72d1d465 | 152 | output_hex_file[fib_start + 19] = (dummy_blank >> 24) & 0xFF |
borlanic | 0:02dd72d1d465 | 153 | |
borlanic | 0:02dd72d1d465 | 154 | # Write FIB to the file in little endian |
borlanic | 0:02dd72d1d465 | 155 | output_hex_file[fib_start + 20] = (start >> 0) & 0xFF |
borlanic | 0:02dd72d1d465 | 156 | output_hex_file[fib_start + 21] = (start >> 8) & 0xFF |
borlanic | 0:02dd72d1d465 | 157 | output_hex_file[fib_start + 22] = (start >> 16) & 0xFF |
borlanic | 0:02dd72d1d465 | 158 | output_hex_file[fib_start + 23] = (start >> 24) & 0xFF |
borlanic | 0:02dd72d1d465 | 159 | |
borlanic | 0:02dd72d1d465 | 160 | output_hex_file[fib_start + 24] = (size >> 0) & 0xFF |
borlanic | 0:02dd72d1d465 | 161 | output_hex_file[fib_start + 25] = (size >> 8) & 0xFF |
borlanic | 0:02dd72d1d465 | 162 | output_hex_file[fib_start + 26] = (size >> 16) & 0xFF |
borlanic | 0:02dd72d1d465 | 163 | output_hex_file[fib_start + 27] = (size >> 24) & 0xFF |
borlanic | 0:02dd72d1d465 | 164 | |
borlanic | 0:02dd72d1d465 | 165 | output_hex_file[fib_start + 28] = (crc32 >> 0) & 0xFF |
borlanic | 0:02dd72d1d465 | 166 | output_hex_file[fib_start + 29] = (crc32 >> 8) & 0xFF |
borlanic | 0:02dd72d1d465 | 167 | output_hex_file[fib_start + 30] = (crc32 >> 16) & 0xFF |
borlanic | 0:02dd72d1d465 | 168 | output_hex_file[fib_start + 31] = (crc32 >> 24) & 0xFF |
borlanic | 0:02dd72d1d465 | 169 | |
borlanic | 0:02dd72d1d465 | 170 | output_hex_file[fib_start + 32] = (fw_rev >> 0) & 0xFF |
borlanic | 0:02dd72d1d465 | 171 | output_hex_file[fib_start + 33] = (fw_rev >> 8) & 0xFF |
borlanic | 0:02dd72d1d465 | 172 | output_hex_file[fib_start + 34] = (fw_rev >> 16) & 0xFF |
borlanic | 0:02dd72d1d465 | 173 | output_hex_file[fib_start + 35] = (fw_rev >> 24) & 0xFF |
borlanic | 0:02dd72d1d465 | 174 | |
borlanic | 0:02dd72d1d465 | 175 | output_hex_file[fib_start + 36] = (checksum >> 0) & 0xFF |
borlanic | 0:02dd72d1d465 | 176 | output_hex_file[fib_start + 37] = (checksum >> 8) & 0xFF |
borlanic | 0:02dd72d1d465 | 177 | output_hex_file[fib_start + 38] = (checksum >> 16) & 0xFF |
borlanic | 0:02dd72d1d465 | 178 | output_hex_file[fib_start + 39] = (checksum >> 24) & 0xFF |
borlanic | 0:02dd72d1d465 | 179 | |
borlanic | 0:02dd72d1d465 | 180 | #pad the rest of the file |
borlanic | 0:02dd72d1d465 | 181 | for i in range(fib_start + dummy_fib_size + fib_size, trim_area_start): |
borlanic | 0:02dd72d1d465 | 182 | output_hex_file[i] = 0xFF |
borlanic | 0:02dd72d1d465 | 183 | |
borlanic | 0:02dd72d1d465 | 184 | # Read in configuration data from the config parameter in targets.json |
borlanic | 0:02dd72d1d465 | 185 | configData = Config('NCS36510') |
borlanic | 0:02dd72d1d465 | 186 | paramData = configData.get_target_config_data() |
borlanic | 0:02dd72d1d465 | 187 | for v in paramData.values(): |
borlanic | 0:02dd72d1d465 | 188 | if (v.name == "target.mac-addr-high"): |
borlanic | 0:02dd72d1d465 | 189 | mac_addr_high = int(v.value, 16) |
borlanic | 0:02dd72d1d465 | 190 | elif (v.name == "target.mac-addr-low"): |
borlanic | 0:02dd72d1d465 | 191 | mac_addr_low = int(v.value,16) |
borlanic | 0:02dd72d1d465 | 192 | elif (v.name == "target.32KHz-clk-trim"): |
borlanic | 0:02dd72d1d465 | 193 | clk_32k_trim = int(v.value,16) |
borlanic | 0:02dd72d1d465 | 194 | elif (v.name == "target.32MHz-clk-trim"): |
borlanic | 0:02dd72d1d465 | 195 | clk_32m_trim = int(v.value,16) |
borlanic | 0:02dd72d1d465 | 196 | elif (v.name == "target.rssi-trim"): |
borlanic | 0:02dd72d1d465 | 197 | rssi = int(v.value,16) |
borlanic | 0:02dd72d1d465 | 198 | elif (v.name == "target.txtune-trim"): |
borlanic | 0:02dd72d1d465 | 199 | txtune = int(v.value,16) |
borlanic | 0:02dd72d1d465 | 200 | else: |
borlanic | 0:02dd72d1d465 | 201 | print("Not a valid param") |
borlanic | 0:02dd72d1d465 | 202 | |
borlanic | 0:02dd72d1d465 | 203 | output_hex_file[trim_area_start + 0] = mac_addr_low & 0xFF |
borlanic | 0:02dd72d1d465 | 204 | output_hex_file[trim_area_start + 1] = (mac_addr_low >> 8) & 0xFF |
borlanic | 0:02dd72d1d465 | 205 | output_hex_file[trim_area_start + 2] = (mac_addr_low >> 16) & 0xFF |
borlanic | 0:02dd72d1d465 | 206 | output_hex_file[trim_area_start + 3] = (mac_addr_low >> 24) & 0xFF |
borlanic | 0:02dd72d1d465 | 207 | |
borlanic | 0:02dd72d1d465 | 208 | output_hex_file[trim_area_start + 4] = mac_addr_high & 0xFF |
borlanic | 0:02dd72d1d465 | 209 | output_hex_file[trim_area_start + 5] = (mac_addr_high >> 8) & 0xFF |
borlanic | 0:02dd72d1d465 | 210 | output_hex_file[trim_area_start + 6] = (mac_addr_high >> 16) & 0xFF |
borlanic | 0:02dd72d1d465 | 211 | output_hex_file[trim_area_start + 7] = (mac_addr_high >> 24) & 0xFF |
borlanic | 0:02dd72d1d465 | 212 | |
borlanic | 0:02dd72d1d465 | 213 | output_hex_file[trim_area_start + 8] = clk_32k_trim & 0xFF |
borlanic | 0:02dd72d1d465 | 214 | output_hex_file[trim_area_start + 9] = (clk_32k_trim >> 8) & 0xFF |
borlanic | 0:02dd72d1d465 | 215 | output_hex_file[trim_area_start + 10] = (clk_32k_trim >> 16) & 0xFF |
borlanic | 0:02dd72d1d465 | 216 | output_hex_file[trim_area_start + 11] = (clk_32k_trim >> 24) & 0xFF |
borlanic | 0:02dd72d1d465 | 217 | |
borlanic | 0:02dd72d1d465 | 218 | output_hex_file[trim_area_start + 12] = clk_32m_trim & 0xFF |
borlanic | 0:02dd72d1d465 | 219 | output_hex_file[trim_area_start + 13] = (clk_32m_trim >> 8) & 0xFF |
borlanic | 0:02dd72d1d465 | 220 | output_hex_file[trim_area_start + 14] = (clk_32m_trim >> 16) & 0xFF |
borlanic | 0:02dd72d1d465 | 221 | output_hex_file[trim_area_start + 15] = (clk_32m_trim >> 24) & 0xFF |
borlanic | 0:02dd72d1d465 | 222 | |
borlanic | 0:02dd72d1d465 | 223 | output_hex_file[trim_area_start + 16] = rssi & 0xFF |
borlanic | 0:02dd72d1d465 | 224 | output_hex_file[trim_area_start + 17] = (rssi >> 8) & 0xFF |
borlanic | 0:02dd72d1d465 | 225 | output_hex_file[trim_area_start + 18] = (rssi >> 16) & 0xFF |
borlanic | 0:02dd72d1d465 | 226 | output_hex_file[trim_area_start + 19] = (rssi >> 24) & 0xFF |
borlanic | 0:02dd72d1d465 | 227 | |
borlanic | 0:02dd72d1d465 | 228 | output_hex_file[trim_area_start + 20] = txtune & 0xFF |
borlanic | 0:02dd72d1d465 | 229 | output_hex_file[trim_area_start + 21] = (txtune >> 8) & 0xFF |
borlanic | 0:02dd72d1d465 | 230 | output_hex_file[trim_area_start + 22] = (txtune >> 16) & 0xFF |
borlanic | 0:02dd72d1d465 | 231 | output_hex_file[trim_area_start + 23] = (txtune >> 24) & 0xFF |
borlanic | 0:02dd72d1d465 | 232 | |
borlanic | 0:02dd72d1d465 | 233 | # pad the rest of the area with 0xFF |
borlanic | 0:02dd72d1d465 | 234 | for i in range(trim_area_start + trim_size, user_code_start): |
borlanic | 0:02dd72d1d465 | 235 | output_hex_file[i] = 0xFF |
borlanic | 0:02dd72d1d465 | 236 | |
borlanic | 0:02dd72d1d465 | 237 | #merge two hex files |
borlanic | 0:02dd72d1d465 | 238 | output_hex_file.merge(input_hex_file, overlap='error') |
borlanic | 0:02dd72d1d465 | 239 | |
borlanic | 0:02dd72d1d465 | 240 | # Write out file(s) |
borlanic | 0:02dd72d1d465 | 241 | output_hex_file.tofile(file_name_hex, 'hex') |