Commit 881bab33 authored by Carmelo Magnafico's avatar Carmelo Magnafico
Browse files

bug fix on adress and page shift

parent 5f206eb6
Loading
Loading
Loading
Loading
(6 KiB)

File changed.

No diff preview for this file type.

+13 −9
Original line number Diff line number Diff line
@@ -116,12 +116,9 @@ if (len(data) % dataword) != 0:
	#CHECK FOR THAT RULE


block_num = math.ceil(len(data)/(datasplit*2) ) #number of commands to sent


#parsing xml template
tree = ET.parse(templatefile)
templateXML = tree.getroot()


#generating variables
now = datetime.now()
@@ -154,10 +151,17 @@ else:

print('split the date into blocks')


for i in range(2):

	#parsing xml template
	tree = ET.parse(templatefile)
	templateXML = tree.getroot()

	data_part = data[i*32*1024*2:(i+1)*32*1024*2];

	block_num = math.ceil(len(data_part)/(datasplit*2) ) #number of commands to sent


	if int(checksum(data_part[:-4]),INT_BITS) == int(data_part[-4:],INT_BITS):
		print('Page checksum comparison passed!\n writing MDOR ...');
	else:
@@ -181,7 +185,7 @@ for i in range(2):

	page_code = format(int(page_code), '02X')
	totaldatabit = len(data_part)*4 #data in bit
	
	print('writing %i bit' % totaldatabit)

	#+++++++++++++++++
	# write the MDOR
@@ -220,12 +224,12 @@ for i in range(2):
		fin = ini + length_hex

		if (index == block_num-1) & (len(data_part) % length_hex != 0):
			length = int((len(data) % (datasplit*2) )/(dataword/4)) #in words
			length = int((len(data_part) % (datasplit*2) )/(dataword/4)) #in words
			fin = ini + length*4
			length_hex = length*4


		datablock = data[ini:fin];		
		datablock = data_part[ini:fin];		
		
		#modify this command:mpo
		c.find('uniqueID').text = uniqueID_value
@@ -244,7 +248,7 @@ for i in range(2):
				parameter.find('value').text = datablock.decode('ascii')
		
		#prepare for the next block
		start_tot_address = format(int(start_tot_address,16) + int(length_hex*4),'08X')
		start_tot_address = format(int(start_tot_address,16) + int(length_hex),'08X')

		index += 1
		

MDOR_BPSA_T000_codepatch_0001.bc

deleted100644 → 0
+0 −7041

File deleted.

Preview size limit exceeded, changes collapsed.

MDOR_BPSA_T000_codepatch_0002.bc

deleted100644 → 0
+0 −14049

File deleted.

Preview size limit exceeded, changes collapsed.

+0 −7041

File deleted.

Preview size limit exceeded, changes collapsed.

Loading