pypicoboot 1.3__tar.gz → 1.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pypicoboot-1.3 → pypicoboot-1.3.2}/PKG-INFO +1 -1
- {pypicoboot-1.3 → pypicoboot-1.3.2}/picoboot/__init__.py +1 -1
- {pypicoboot-1.3 → pypicoboot-1.3.2}/picoboot/_version.py +1 -1
- {pypicoboot-1.3 → pypicoboot-1.3.2}/picoboot/picoboot.py +23 -13
- {pypicoboot-1.3 → pypicoboot-1.3.2}/pypicoboot.egg-info/PKG-INFO +1 -1
- {pypicoboot-1.3 → pypicoboot-1.3.2}/pyproject.toml +1 -1
- {pypicoboot-1.3 → pypicoboot-1.3.2}/LICENSE +0 -0
- {pypicoboot-1.3 → pypicoboot-1.3.2}/README.md +0 -0
- {pypicoboot-1.3 → pypicoboot-1.3.2}/picoboot/core/__init__.py +0 -0
- {pypicoboot-1.3 → pypicoboot-1.3.2}/picoboot/core/enums.py +0 -0
- {pypicoboot-1.3 → pypicoboot-1.3.2}/picoboot/core/exceptions.py +0 -0
- {pypicoboot-1.3 → pypicoboot-1.3.2}/picoboot/core/log.py +0 -0
- {pypicoboot-1.3 → pypicoboot-1.3.2}/picoboot/picobootmonitor.py +0 -0
- {pypicoboot-1.3 → pypicoboot-1.3.2}/picoboot/tools/picotool.py +0 -0
- {pypicoboot-1.3 → pypicoboot-1.3.2}/picoboot/utils.py +0 -0
- {pypicoboot-1.3 → pypicoboot-1.3.2}/pypicoboot.egg-info/SOURCES.txt +0 -0
- {pypicoboot-1.3 → pypicoboot-1.3.2}/pypicoboot.egg-info/dependency_links.txt +0 -0
- {pypicoboot-1.3 → pypicoboot-1.3.2}/pypicoboot.egg-info/requires.txt +0 -0
- {pypicoboot-1.3 → pypicoboot-1.3.2}/pypicoboot.egg-info/top_level.txt +0 -0
- {pypicoboot-1.3 → pypicoboot-1.3.2}/setup.cfg +0 -0
- {pypicoboot-1.3 → pypicoboot-1.3.2}/setup.py +0 -0
- {pypicoboot-1.3 → pypicoboot-1.3.2}/tests/test_000_init.py +0 -0
|
@@ -127,7 +127,7 @@ class PartitionInfoType(NamedIntEnum):
|
|
|
127
127
|
SLOT_1 = -3
|
|
128
128
|
IMAGE = -4
|
|
129
129
|
|
|
130
|
-
class
|
|
130
|
+
class Platform(NamedIntEnum):
|
|
131
131
|
RP2040 = 0x01754d
|
|
132
132
|
RP2350 = 0x02754d
|
|
133
133
|
UNKNOWN = 0x000000
|
|
@@ -149,9 +149,9 @@ class PicoBoot:
|
|
|
149
149
|
logger.debug("Guessing flash size...")
|
|
150
150
|
self._memory = self._guess_flash_size()
|
|
151
151
|
logger.debug(f"Detected flash size: {self._memory // 1024} kB")
|
|
152
|
-
logger.debug("Determining
|
|
153
|
-
self.
|
|
154
|
-
logger.debug(f"Detected
|
|
152
|
+
logger.debug("Determining platform...")
|
|
153
|
+
self._platform = self._determine_platform()
|
|
154
|
+
logger.debug(f"Detected platform: {self._platform.name}")
|
|
155
155
|
|
|
156
156
|
class PicoBootObserver(PicoBootMonitorObserver):
|
|
157
157
|
|
|
@@ -270,6 +270,16 @@ class PicoBoot:
|
|
|
270
270
|
def has_device(self):
|
|
271
271
|
return self.dev is not None
|
|
272
272
|
|
|
273
|
+
@property
|
|
274
|
+
def serial_number(self) -> int:
|
|
275
|
+
s = usb.util.get_string(self.dev, self.dev.iSerialNumber)
|
|
276
|
+
return int(s, 16)
|
|
277
|
+
|
|
278
|
+
@property
|
|
279
|
+
def serial_number_str(self) -> str:
|
|
280
|
+
s = usb.util.get_string(self.dev, self.dev.iSerialNumber)
|
|
281
|
+
return s
|
|
282
|
+
|
|
273
283
|
def interface_reset(self) -> None:
|
|
274
284
|
logger.debug("Resetting interface...")
|
|
275
285
|
self.dev.ctrl_transfer(
|
|
@@ -437,9 +447,9 @@ class PicoBoot:
|
|
|
437
447
|
|
|
438
448
|
def reboot(self, delay_ms: int = 100) -> None:
|
|
439
449
|
logger.debug(f"Rebooting device with delay_ms={delay_ms}")
|
|
440
|
-
if (self.
|
|
450
|
+
if (self.platform == Platform.RP2040):
|
|
441
451
|
self.reboot1(delay_ms=delay_ms)
|
|
442
|
-
elif (self.
|
|
452
|
+
elif (self.platform == Platform.RP2350):
|
|
443
453
|
self.reboot2(delay_ms=delay_ms)
|
|
444
454
|
|
|
445
455
|
def exit_xip(self) -> None:
|
|
@@ -450,17 +460,17 @@ class PicoBoot:
|
|
|
450
460
|
logger.debug("Requesting exclusive access to flash...")
|
|
451
461
|
self._send_command(CommandID.EXCLUSIVE_ACCESS, args=struct.pack("<B", 1), transfer_length=0)
|
|
452
462
|
|
|
453
|
-
def
|
|
454
|
-
logger.debug("Determining device
|
|
455
|
-
if (hasattr(self, "
|
|
456
|
-
return self.
|
|
463
|
+
def _determine_platform(self) -> str:
|
|
464
|
+
logger.debug("Determining device platform...")
|
|
465
|
+
if (hasattr(self, "_platform")) and (self._platform is not None):
|
|
466
|
+
return self._platform
|
|
457
467
|
data = self.flash_read(Addresses.BOOTROM_MAGIC, 4)
|
|
458
468
|
(magic,) = struct.unpack("<I", data)
|
|
459
|
-
return
|
|
469
|
+
return Platform(magic & 0xf0ffffff)
|
|
460
470
|
|
|
461
471
|
@property
|
|
462
|
-
def
|
|
463
|
-
return self.
|
|
472
|
+
def platform(self) -> str:
|
|
473
|
+
return self._platform
|
|
464
474
|
|
|
465
475
|
def _guess_flash_size(self) -> int:
|
|
466
476
|
logger.debug("Guessing flash size...")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|