more improvements
All checks were successful
Rust/va416xx-rs/pipeline/pr-main This commit looks good
All checks were successful
Rust/va416xx-rs/pipeline/pr-main This commit looks good
This commit is contained in:
parent
edd5d73b5b
commit
dc7918a696
@ -15,6 +15,9 @@ interface.
|
|||||||
|
|
||||||
## Using the Python image loader
|
## Using the Python image loader
|
||||||
|
|
||||||
|
The Python image loader communicates with the Rust flashload application using a dedicated serial
|
||||||
|
port with a baudrate of 115200.
|
||||||
|
|
||||||
It is recommended to run the script in a dedicated virtual environment. For example, on UNIX
|
It is recommended to run the script in a dedicated virtual environment. For example, on UNIX
|
||||||
systems you can use `python3 -m venv venv` and then `source venv/bin/activate` to create
|
systems you can use `python3 -m venv venv` and then `source venv/bin/activate` to create
|
||||||
and activate a virtual environment.
|
and activate a virtual environment.
|
||||||
|
@ -23,26 +23,27 @@ from elftools.elf.elffile import ELFFile
|
|||||||
|
|
||||||
|
|
||||||
BAUD_RATE = 115200
|
BAUD_RATE = 115200
|
||||||
|
|
||||||
BOOTLOADER_START_ADDR = 0x0
|
BOOTLOADER_START_ADDR = 0x0
|
||||||
BOOTLOADER_END_ADDR = 0x4000
|
BOOTLOADER_END_ADDR = 0x4000
|
||||||
BOOTLOADER_CRC_ADDR = 0x3FFC
|
BOOTLOADER_CRC_ADDR = BOOTLOADER_END_ADDR - 4
|
||||||
BOOTLOADER_MAX_SIZE = BOOTLOADER_END_ADDR - BOOTLOADER_START_ADDR - 4
|
BOOTLOADER_MAX_SIZE = BOOTLOADER_END_ADDR - BOOTLOADER_START_ADDR - 4
|
||||||
|
|
||||||
APP_A_START_ADDR = 0x4000
|
APP_A_START_ADDR = 0x4000
|
||||||
APP_A_END_ADDR = 0x22000
|
APP_A_END_ADDR = 0x22000
|
||||||
# The actual size of the image which is relevant for CRC calculation.
|
# The actual size of the image which is relevant for CRC calculation.
|
||||||
APP_A_SIZE_ADDR = 0x21FF8
|
APP_A_SIZE_ADDR = APP_A_END_ADDR - 8
|
||||||
APP_A_CRC_ADDR = 0x21FFC
|
APP_A_CRC_ADDR = APP_A_END_ADDR - 4
|
||||||
APP_A_MAX_SIZE = APP_A_END_ADDR - APP_A_START_ADDR - 8
|
APP_A_MAX_SIZE = APP_A_END_ADDR - APP_A_START_ADDR - 8
|
||||||
|
|
||||||
APP_B_START_ADDR = 0x22000
|
APP_B_START_ADDR = 0x22000
|
||||||
APP_B_END_ADDR = 0x40000
|
APP_B_END_ADDR = 0x40000
|
||||||
# The actual size of the image which is relevant for CRC calculation.
|
# The actual size of the image which is relevant for CRC calculation.
|
||||||
APP_B_SIZE_ADDR = 0x3FFF8
|
APP_B_SIZE_ADDR = APP_B_END_ADDR - 8
|
||||||
APP_B_CRC_ADDR = 0x3FFFC
|
APP_B_CRC_ADDR = APP_B_END_ADDR - 4
|
||||||
APP_B_MAX_SIZE = APP_A_END_ADDR - APP_A_START_ADDR - 8
|
APP_B_MAX_SIZE = APP_A_END_ADDR - APP_A_START_ADDR - 8
|
||||||
|
|
||||||
APP_IMG_SZ = 0x1E000
|
APP_IMG_SZ = (APP_B_END_ADDR - APP_A_START_ADDR) // 2
|
||||||
|
|
||||||
CHUNK_SIZE = 896
|
CHUNK_SIZE = 896
|
||||||
|
|
||||||
@ -74,7 +75,7 @@ class LoadableSegment:
|
|||||||
class Target(enum.Enum):
|
class Target(enum.Enum):
|
||||||
BOOTLOADER = 0
|
BOOTLOADER = 0
|
||||||
APP_A = 1
|
APP_A = 1
|
||||||
APP_B = 1
|
APP_B = 2
|
||||||
|
|
||||||
|
|
||||||
class ImageLoader:
|
class ImageLoader:
|
||||||
@ -290,7 +291,8 @@ def main() -> int:
|
|||||||
result = -1
|
result = -1
|
||||||
if args.ping:
|
if args.ping:
|
||||||
image_loader.handle_ping_cmd()
|
image_loader.handle_ping_cmd()
|
||||||
result = 0
|
com_if.close()
|
||||||
|
return 0
|
||||||
if target:
|
if target:
|
||||||
if not args.corrupt:
|
if not args.corrupt:
|
||||||
if not args.path:
|
if not args.path:
|
||||||
@ -299,11 +301,11 @@ def main() -> int:
|
|||||||
if not file_path.exists():
|
if not file_path.exists():
|
||||||
_LOGGER.error("File does not exist")
|
_LOGGER.error("File does not exist")
|
||||||
if args.corrupt:
|
if args.corrupt:
|
||||||
if target:
|
if not target:
|
||||||
image_loader.handle_corruption_cmd(target)
|
|
||||||
result = 0
|
|
||||||
else:
|
|
||||||
_LOGGER.error("target for corruption command required")
|
_LOGGER.error("target for corruption command required")
|
||||||
|
com_if.close()
|
||||||
|
return -1
|
||||||
|
image_loader.handle_corruption_cmd(target)
|
||||||
else:
|
else:
|
||||||
assert file_path is not None
|
assert file_path is not None
|
||||||
assert target is not None
|
assert target is not None
|
||||||
|
@ -7,7 +7,6 @@ edition = "2021"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cortex-m-rt = "0.7"
|
cortex-m-rt = "0.7"
|
||||||
va416xx-hal = { path = "../../va416xx-hal", features = ["va41630"] }
|
|
||||||
panic-rtt-target = { version = "0.1.3" }
|
panic-rtt-target = { version = "0.1.3" }
|
||||||
rtt-target = { version = "0.5" }
|
rtt-target = { version = "0.5" }
|
||||||
cortex-m = { version = "0.7", features = ["critical-section-single-core"] }
|
cortex-m = { version = "0.7", features = ["critical-section-single-core"] }
|
||||||
|
@ -7,7 +7,6 @@ edition = "2021"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cortex-m-rt = "0.7"
|
cortex-m-rt = "0.7"
|
||||||
va416xx-hal = { path = "../../va416xx-hal", features = ["va41630"] }
|
|
||||||
panic-rtt-target = { version = "0.1.3" }
|
panic-rtt-target = { version = "0.1.3" }
|
||||||
rtt-target = { version = "0.5" }
|
rtt-target = { version = "0.5" }
|
||||||
cortex-m = { version = "0.7", features = ["critical-section-single-core"] }
|
cortex-m = { version = "0.7", features = ["critical-section-single-core"] }
|
||||||
|
Loading…
Reference in New Issue
Block a user