Commit Graph

82 Commits

Author SHA1 Message Date
Julian Oes b0ec64efe8 px_uploader: fixed a couple small PEP8 warnings 2018-06-29 08:46:45 +00:00
Julian Oes 48edf9b65e px_uploader: remove commented out line 2018-06-29 08:46:45 +00:00
Julian Oes 4e43cc3518 px_uploader.py fix flashing issue (#9792)
This fixes a problem where the pyserial write call gets stuck.
It happens on a specific Fedora 28 system with internal USB ports as
well as USB hubs.
It is not clear why the problem is resolved but it is clearly
reproducible that with a timeout of 0, the write can get stuck and with
a timeout > 0 it works every time.

The exception added as part of this commit makes sense but has never
been triggered in my testing.
2018-06-28 20:18:22 -04:00
Daniel Agar e78b9a063f px_uploader cleanup status messages and print used percentage 2018-06-28 19:35:36 +00:00
korigod 4dfd77a0cd cmake: add nuttx force-upload target (#9717)
If the PX4FMUv2 board does not have the v5 uploader, it's not possible
to check the silicon revision to make sure it's safe to upload the
firmware which is more than 1 MB. However, if the user is sure the
silicon revision is not affected by this errata, he can upload the
firmware using px4_uploader.py with --force argument. This commit adds
`force-upload` make target to do it more convenient way.

Signed-off-by: Andrei Korigodski <akorigod@gmail.com>
2018-06-20 10:37:01 -04:00
Matthias Grob 58dd7be12a Cygwin: enable arm nuttx upload within cygwin
In the Cygwin environment the native Windows serial COM# ports get mapped
to /dev/ttyS# for POSIX compatibility. While # is one number lower inside
the environment than the COM port number because it's 0 indexed instead
of 1.

I added the necessary handling to all the dependent parts I found which
allows uploading to /dev/ttyS# when the cygwin platform is detected.
Now the usual "make px4fmu-v4 upload" and
"./Tools/upload.sh build/px4fmu-v4_default/px4fmu-v4_default.px4" work.
2018-05-09 11:31:42 +02:00
Julian Oes d646abcee7 px_uploader: improve silicon check
- Move check to proper location, out of the try catch block for OTP.
- Add Pixhawk specific check to notify users that want to flash
  px4fmu-v3_default on Pixhawks with older v4 bootloaders that do not
  support the silicon errata check.
2018-02-04 18:14:51 +01:00
Julian Oes a1ab84e5b9 px_uploader: make rev check a bit more intuitive 2018-02-04 18:14:51 +01:00
Lorenz Meier 6d00de7b25 Uploader: Move flash size check into appropriate bootloader version region 2018-02-04 18:14:51 +01:00
Julian Oes d175a75691 px_uploader: fix Python3 upload
This fixes the error below when using Python3:

  File "Tools/px_uploader.py", line 128, in
  __init__
      self.image.append('\xff')
      TypeError: an integer is required
2018-02-03 09:33:13 -05:00
Beat Küng e11008f30e px_uploader: minor text message update 2018-01-17 10:14:04 +01:00
ritul jasuja fed06955bc Update debug message as per connection link 2018-01-17 10:10:33 +01:00
Lorenz Meier e7fe8f7268 Uploader: Enforce matching maximum flash sizes
The goal is to force developers to use the correct target with the correct flash size. This prevents criticial functionality missing and is in particular important for FMUv2/FMUv3 boards. It is unmaintainable otherwise for the Pixhawk series.
2018-01-01 09:29:55 -05:00
Lorenz Meier 9e312e8dba Uploader: Do not show timeout for larger binaries when everything is still as expected. 2017-08-13 11:36:12 +02:00
Julien Lecoeur 38fff6546d Fix python 3 compatibility in px_uploader.py 2017-06-08 07:57:00 +02:00
Lorenz Meier 5f4fb744ca Uploader: Signal GCS or other connected devices that a FiFirmware upload is pending and requires device access. 2017-06-05 22:44:21 +02:00
Julian Oes e9aef2eb95 px_uploader.py: properly loop through all baudrates
In case when the baudrate change failed, we should still try that
baudrate again in the next iteration.
2017-04-22 08:00:51 +02:00
Julian Oes 2467297acf px_uploader.py: fix exception on baudrate change
This prevents an exception happening inside the serial stack.
2017-04-22 08:00:51 +02:00
Julian Oes 12c7421be9 px_uploader.py: remove unused exception vars 2017-02-27 11:23:09 +01:00
Julian Oes 974a9a0673 px_uploader.py: enable file to be used as module
In order to use px_uploader as a module from another Python script, all
the action needs to be moved into a main() function which is only called
if the file is run directly.
2017-02-27 11:23:09 +01:00
Julian Oes 090d7ebd6b px_uploader: fix SerialException error
Sometimes right after reboot, we got a `raise SerialException(
msg.errno, "could not open port {}: {}".format(self._port, msg))`.
If this happens now, we will just try again later.
2017-02-27 11:23:09 +01:00
Julian Oes b0a8073e15 px_uploader.py: small whitespace fix
Found by PEP8 checker.
2017-02-27 11:23:09 +01:00
Julian Oes ff87d43be0 px_uploader.py: vim modeline for indent settings 2017-02-27 11:23:09 +01:00
Julian Oes 172f35042f px_uploader.py: use consistent indenting
This file had the indentending mixed up between 4 and 8 spaces.
This changes it to the Pythonic way of 4 spaces.
2017-02-27 11:23:09 +01:00
Lorenz Meier 495e16d510 Uploader script: Fix Python 2 issue and timing corner case on Mac OS, both in a robust fashion 2017-02-17 22:28:14 +01:00
Lucas De Marchi f9795ccbab px_uploader: support multiple baud rates
We may need to change the baud rate from one version to the other.
Allowing the script to try multiple baud rates makes the transition a
little bit less painful.

This also fixes a bug in which it would go the next port before trying
to identify the board after asking it to reboot.
2017-02-16 09:35:23 +01:00
Julian Oes c91b36bf1f px_uploader.py: try to follow PEP8 (#6278)
This fixes some non-Pythonic things and unneccessary semicolons.

Still to fix are line-length and multiple spaces before operators.
2017-01-12 02:51:06 -05:00
Julian Oes d57e9f13d7 px_uploader.py: catch exception in except block
This could lead to an exception if serial is not available.
2016-10-20 23:18:56 +02:00
Julian Oes d1822699a9 px_uploader.py: remove unused variable 2016-10-20 23:18:56 +02:00
Julian Oes a14c565ab1 px_uploader.py: trailing whitespace 2016-10-20 23:18:56 +02:00
José Roberto de Souza b9728ecf39 Uploader tool: Add option to set different baudrates for bootloader and flight stack
By default the baudrate in flight stack (Mavlink or NSH) 57600 and the default
baudrate of bootloader is 115200. So we may need to set different
baudrates.
2016-10-05 11:25:14 +02:00
José Roberto de Souza 7e0946466e Uploader tool: Reboot board and keep it in bootloader
The Mavlink reboot messages was only requesting the board to reboot.
If the flashed bootloader has a small or no timeout user will
never be able to update firmware.
2016-10-05 11:25:14 +02:00
Lorenz Meier 71fd4b9e98 Uploader tool: Try MAVLink reboot command first 2016-09-17 23:49:41 +02:00
Lorenz Meier f918b0c992 Uploader: Make sure to warn about wrong board type 2016-01-21 09:34:54 +01:00
David Sidrane 923a43b67f Support for Rev 5 of Bootloader 2015-12-04 13:10:29 -10:00
Andrew Tridgell 2c2359dcf0 px_uploader.py: added --boot-delay option
this sets the bootloader delay
2015-03-14 21:12:21 +11:00
Andrew Tridgell 332d42b105 px_uploader: print chip version 2015-03-07 09:46:27 +01:00
Andrew Tridgell d9b4f5b170 px_loader: added --force option
this can be used to override the board type check. Useful when
changing bootloaders
2015-03-07 09:45:51 +01:00
Lorenz Meier 200f0e9a93 Better error handling for multi-board setups 2015-03-02 23:05:03 +01:00
Lorenz Meier a31fccb0b0 Uploader: Fix flashing if multiple board types are connected 2015-03-02 22:36:48 +01:00
Lorenz Meier 6d2e8b9d08 Reduce delay between board search attempts, code style 2015-02-26 13:07:43 +01:00
Johan Jansen 74177a2688 px4_uploader: Push program bytes faster by using bigger blocks 2015-02-26 11:14:54 +01:00
Johan Jansen a8f9caaaa5 px4_uploader: Prevent spin-lock from hogging CPU 2015-02-26 11:14:06 +01:00
Simon Wilks 0a99a26fcc Cleanup uploader output. 2015-01-19 16:51:08 +01:00
Johan Jansen 11469ad9b5 px_uploader: Small fix to properly display timeouts 2015-01-12 12:25:30 +01:00
Johan Jansen 1eda1f816b px_uploader: Minor code cleanup 2015-01-08 16:30:47 +01:00
Johan Jansen 2aa7b3038a px_uploader: Added progress bar for erasing and uploading firmware 2015-01-08 13:18:50 +01:00
Lorenz Meier 8e8dd62fbd Let the uploader print the binary size 2014-11-15 13:49:06 +01:00
Lorenz Meier 72977ee909 Better error handling instructions 2014-11-02 22:13:59 +01:00
Lorenz Meier 44a2473632 Fix up reboot logic 2014-11-02 22:03:49 +01:00