Commit Graph

96 Commits

Author SHA1 Message Date
Julian Oes 7be05396ba px_uploader.py: check for pyserial
If we dont explicitly check for pyserial, we can have the case where the
import works but the Serial object creation fails. However, we don't see
this because we have this huge try/catch block which swallows
everything.
2019-03-27 07:55:05 +01:00
Daniel Agar abb3817d31 boards new split VENDOR_MODEL naming convention 2018-11-26 14:40:14 -08:00
Pietro De Nicolao 6d3eb0450d px_uploader.py: exit code=1 if upload was not successful (#10681) 2018-10-15 11:21:31 -04:00
Matthias Grob e167e6bec4 px_uploader: catch non-standard baud exception
to fix Cygwin upload. It failed silently but when catching it prints
"non-standard baudrates are not supported on this platform".
Discussion about platform independet FTDI detection is in issue #10429.
2018-10-02 10:01:41 +02:00
Matthias Grob ebdea6e50d px_uploader: fix code and output spacing 2018-10-02 10:01:41 +02:00
David Sidrane 89a902524a px_uploader:Revert the rebooting text to have baudrate
Using the port name is platform dependent. It may give not
  provide the correct feedback. The port can be ttyS, or ftdi
  or CDC/ACM. While it is true that buadrate does not matter on
  CDC/ACM. It is better to give more information about what the
  code is doing before filtering by the port name.
2018-07-19 11:23:15 -07:00
David Sidrane f12acd7b0f px_uploader:Platform and Timming indepentant Serial detection
The correct determination of Windowed mode is critical to
   maximise the speed on a USB based upload.

   This commit bases the detection of a Serial (FTDI) on the
   fact a CDC ACM port (USB) does not really have a baud rate.
   We bump the baud rate to 233% of the requested baud rate to
   see if the SYNC is acked. If it is Acked it must be a USB
   port and Windowed mode is turned off. This removes unnessary
   baud rate based delays from the proframing logic. If it is a
   real Serial port getSync will not get the ACK and Windowed
   mode is turned on.
2018-07-18 08:11:11 +02:00
Julian Oes 11d4c32cd4 px_uploader: fix unknown variables 2018-07-17 07:44:58 -07:00
Julian Oes 8b91a68fea px_uploader: white space PEP8 fixes 2018-07-17 07:44:58 -07:00
Lorenz Meier 57c7e1a3eb Uploader: Ensure that we are not entering windowed mode on USB links 2018-07-15 16:15:21 +02:00
David Sidrane 05936f2ff7 px_uploader.py:Speed Improvments on Serial
The __getSync was costing about 16Ms per call.
  The commit uses a window based approch allowing
  the SYNC,<results> to be read all at one time.
  and delaying for programing based on transport
  time + 1 Ms;
  THe improvment at 2Mbps is >4 minutes to ~37
  seconds
2018-07-13 17:29:31 +02:00
Daniel Agar dec03873bc px_uploader add small delay before checking CRC result 2018-07-07 15:55:53 +02:00
Hamish Willee 7402d8223b Fix up references to pixhawk.org 2018-07-02 13:11:15 +02:00
Julian Oes 193993c54f px_uploader: fix typo and Python 3 issue 2018-06-29 08:46:45 +00:00
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