diff --git a/fdls/sc6530_generic_0x34000000_single.bin b/fdls/sc6530_generic_0x34000000_single.bin new file mode 100644 index 0000000..8da7cf8 Binary files /dev/null and b/fdls/sc6530_generic_0x34000000_single.bin differ diff --git a/fdls/sc6531efm/nor_fdl.bin b/fdls/sc6531efm_generic_0x14000000_fdl2.bin similarity index 100% rename from fdls/sc6531efm/nor_fdl.bin rename to fdls/sc6531efm_generic_0x14000000_fdl2.bin diff --git a/fdls/sc6531efm/nor_fdl1.bin b/fdls/sc6531efm_generic_0x40004000_fdl1.bin similarity index 100% rename from fdls/sc6531efm/nor_fdl1.bin rename to fdls/sc6531efm_generic_0x40004000_fdl1.bin diff --git a/fdls/sc7703a_generic_0x40000000_fdl1.bin b/fdls/sc7703a_generic_0x40000000_fdl1.bin new file mode 100644 index 0000000..af4743d Binary files /dev/null and b/fdls/sc7703a_generic_0x40000000_fdl1.bin differ diff --git a/fdls/sc7703a_generic_0x80000000_fdl2.bin b/fdls/sc7703a_generic_0x80000000_fdl2.bin new file mode 100644 index 0000000..dae31d8 Binary files /dev/null and b/fdls/sc7703a_generic_0x80000000_fdl2.bin differ diff --git a/uniflash.py b/uniflash.py index 7a3d01b..301fcc9 100644 --- a/uniflash.py +++ b/uniflash.py @@ -166,10 +166,13 @@ if __name__ == '__main__': # main app start parser.add_argument('-bs','--block-size', type=auto_int, default=4096, help='Readback/write block size (in bytes), defaults to 4096') parser.add_argument('-dv','--device-vid', type=auto_int, default=UNISOC_VID, help='Override device vendor ID') parser.add_argument('-dp','--device-pid', type=auto_int, default=UNISOC_PID, help='Override device product ID') - parser.add_argument('-fdl1','--fdl1-file', default=rootdir+'/fdls/sc6531efm/nor_fdl1.bin', help='Path to FDL1, defaults to the generic SC6531E/F/M FDL1 shipped with UniDump') + parser.add_argument('-fdl1','--fdl1-file', default=rootdir+'/fdls/sc6531efm_generic_0x40004000_fdl1.bin', help='Path to FDL1, defaults to the generic SC6531E/F/M FDL1 shipped with UniFlash') parser.add_argument('-addr1','--fdl1-addr', type=auto_int, default=0x40004000, help='Address to load FDL1 into, defaults to 0x40004000') - parser.add_argument('-fdl2','--fdl2-file', default=rootdir+'/fdls/sc6531efm/nor_fdl.bin', help='Path to FDL2, defaults to the generic SC6531E/F/M FDL2 shipped with UniDump') + parser.add_argument('-fdl2','--fdl2-file', default=rootdir+'/fdls/sc6531efm_generic_0x14000000_fdl2.bin', help='Path to FDL2, defaults to the generic SC6531E/F/M FDL2 shipped with UniFlash') parser.add_argument('-addr2','--fdl2-addr', type=auto_int, default=0x14000000, help='Address to load FDL2 into, defaults to 0x14000000') + parser.add_argument('-sfdl','--single-fdl-file', default=None, help='Path to a single FDL (for old Spreadtrum chipsets)') + parser.add_argument('-saddr','--single-fdl-addr', type=auto_int, default=0x34000000, help='Address to load the single FDL into, defaults to 0x34000000') + args = parser.parse_args() is_flash = False @@ -182,15 +185,28 @@ if __name__ == '__main__': # main app start fdl2Addr = args.fdl2_addr fdl1Name = args.fdl1_file fdl2Name = args.fdl2_file + fdlSingleName = args.single_fdl_file + fdlSingleAddr = args.single_fdl_addr outfile = args.file partitionId = args.partid readbs = args.block_size readoffset = args.start readlen = args.length forceErase = args.force_erase + singleFdlMode = False + fdl1Label = 'FDL1' + fdl2Label = 'FDL2' - print('Using FDL1 %s, loading to 0x%X' % (fdl1Name, fdl1Addr)) - print('Using FDL2 %s, loading to 0x%X' % (fdl2Name, fdl2Addr)) + if fdlSingleName is not None: + singleFdlMode = True + fdl1Addr = fdlSingleAddr + fdl1Name = fdlSingleName + fdl1Label = 'FDL' + fdl2Label = 'FDL' + print('Using a single FDL %s, loading to 0x%X' % (fdlSingleName, fdlSingleAddr)) + else: + print('Using FDL1 %s, loading to 0x%X' % (fdl1Name, fdl1Addr)) + print('Using FDL2 %s, loading to 0x%X' % (fdl2Name, fdl2Addr)) # initial connection print('Connect the device %X:%X while holding the bootkey...' % (UNISOC_VID, UNISOC_PID) ) @@ -206,29 +222,32 @@ if __name__ == '__main__': # main app start print('Boot mode entered') - print('Sending FDL1') + print('Sending ' + fdl1Label) send_file_to_addr(fdl1Name, fdl1Addr) - print('Starting FDL1') + print('Starting ' + fdl1Label) resp = reqresp(unicmd.cmd_data_exec(fdl1Addr)) rcode, rlen, r = unicmd.resp_decode(resp, False) if rcode == unicmd.BSL_REP_ACK: - print('FDL1 started successfully, reconnecting...') + print(fdl1Label + ' started successfully, reconnecting...') reconnect() handshake(True) - print('Protocol set up, sending FDL2') - send_file_to_addr(fdl2Name, fdl2Addr, True) - print('Starting FDL2') - resp = reqresp(unicmd.cmd_data_exec(fdl2Addr), True) - rcode, rlen, r = unicmd.resp_decode(resp, True) + if singleFdlMode: + rcode = unicmd.BSL_REP_ACK + else: + print('Protocol set up, sending FDL2') + send_file_to_addr(fdl2Name, fdl2Addr, True) + print('Starting FDL2') + resp = reqresp(unicmd.cmd_data_exec(fdl2Addr), True) + rcode, rlen, r = unicmd.resp_decode(resp, True) if rcode == unicmd.BSL_REP_ACK: - print('FDL2 started successfully!') + print(fdl2Label + ' started successfully!') resp = reqresp(unicmd.cmd_sync_full(), True) rcode, rlen, r = unicmd.resp_decode(resp, True) assert rcode == unicmd.BSL_REP_ACK, 'Could not set the baudrate, response code is %X' % rcode - print('FDL2 running, may start interacting with flash memory') + print(fdl2Label + ' running, may start interacting with flash memory') if is_flash: print('Writing flash at offset 0x%X from %s...' % (readoffset, outfile))