After various memory exercises, then back to GPS to get UBlox working. UBlox is working. TODO: start libraries, downplay SD Card as we can use memory for interim logging
This commit is contained in:
parent
c7646e169e
commit
41c1fe6819
16 changed files with 2016 additions and 71 deletions
26
exercises/17_Flash/show_partition_table.py
Normal file
26
exercises/17_Flash/show_partition_table.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import struct
|
||||
|
||||
with open('partitions_backup.bin', 'rb') as f:
|
||||
data = f.read()
|
||||
|
||||
print("Name | Type | SubType | Offset | Size | Flags")
|
||||
print("-" * 75)
|
||||
|
||||
for i in range(0, len(data), 32):
|
||||
entry = data[i:i+32]
|
||||
if len(entry) < 32:
|
||||
break
|
||||
|
||||
magic = struct.unpack('<H', entry[0:2])[0]
|
||||
|
||||
if magic == 0x50aa: # Valid partition magic
|
||||
type_val = entry[2]
|
||||
subtype = entry[3]
|
||||
offset = struct.unpack('<I', entry[4:8])[0]
|
||||
size = struct.unpack('<I', entry[8:12])[0]
|
||||
flags = struct.unpack('<H', entry[12:14])[0]
|
||||
name = entry[16:32].rstrip(b'\x00').decode('ascii', errors='ignore')
|
||||
|
||||
print(f"{name:<13} | {type_val:02x} | {subtype:02x} | 0x{offset:08x} | 0x{size:08x} | {flags:04x}")
|
||||
elif magic == 0xebeb:
|
||||
break # End marker
|
||||
Loading…
Add table
Add a link
Reference in a new issue