Skip to content
Snippets Groups Projects
Commit d9b4f5b1 authored by Andrew Tridgell's avatar Andrew Tridgell Committed by Lorenz Meier
Browse files

px_loader: added --force option

this can be used to override the board type check. Useful when
changing bootloaders
parent 9495ec4f
No related branches found
No related tags found
No related merge requests found
......@@ -416,7 +416,12 @@ class uploader(object):
def upload(self, fw):
# Make sure we are doing the right thing
if self.board_type != fw.property('board_id'):
raise IOError("Firmware not suitable for this board")
msg = "Firmware not suitable for this board (board_type=%u board_id=%u)" % (
self.board_type, fw.property('board_id'))
if args.force:
print("WARNING: %s" % msg)
else:
raise IOError(msg)
if self.fw_maxsize < fw.property('image_size'):
raise RuntimeError("Firmware image is too large for this board")
......@@ -486,6 +491,7 @@ else:
parser = argparse.ArgumentParser(description="Firmware uploader for the PX autopilot system.")
parser.add_argument('--port', action="store", required=True, help="Serial port(s) to which the FMU may be attached")
parser.add_argument('--baud', action="store", type=int, default=115200, help="Baud rate of the serial port (default is 115200), only required for true serial ports.")
parser.add_argument('--force', action='store_true', default=False, help='Override board type check and continue loading')
parser.add_argument('firmware', action="store", help="Firmware file to be uploaded")
args = parser.parse_args()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment