FaradayRF / Faraday-Software

Faraday node software
https://www.faradayrf.com
Other
47 stars 19 forks source link

Pull in Windows Bootstrap Loader Python Package #249

Open kb1lqc opened 7 years ago

kb1lqc commented 7 years ago

This PR creates a faraday-bsl program which pulls in a lot of @kb1lqd code used to bootstrap load the FaradayRF hardware. This ONLY works in windows and please be sure to have the FTDI drivers installed (http://www.ftdichip.com/Drivers/D2XX.htm). This whole operation isn't ideal but it's what works for the time being.

Changes

Operation

After configuring the config files, updating the master firmware from the internet, it's as simple as... bsl

@el-iso @reillyeon @jbemenheiser

kb1lqd commented 7 years ago

@kb1lqc

It won't work for me (com port setup earlier):

Brent@Brent-surface MINGW64 ~/Documents/Faraday_GIthub_Software/Pull_Request_Reviews/firmwareinstall/Faraday-Software (bsl)
$ faraday-bsl --getmaster --start
2017-07-20 01:03:23,871 - BSL - INFO - Downloading latest Master firmware...
2017-07-20 01:03:24,503 - BSL - INFO - Download complete
2017-07-20 01:03:24,503 - BSL - INFO - Starting Faraday Bootstrap Loader application
---------------------------------------------------------
BSL Scripter 3.1.0.0
PC software for BSL programming
2017-Jul-20 01:03:30
---------------------------------------------------------
Input file script is : C:/Users/Brent/Documents/Faraday_GIthub_Software/Pull_Request_Reviews/firmwareinstall/Faraday-Software/etc/faraday/faradayFirmwareUpgradeScript.txt
MODE 6xx UART 9600 com112 PARITY
CHANGE_BAUD_RATE 115200
        BSL ACK is received.
VERBOSE

RX_PASSWORD pass32_wrong.txt

Brent@Brent-surface MINGW64 ~/Documents/Faraday_GIthub_Software/Pull_Request_Reviews/firmwareinstall/Faraday-Software (bsl)
kb1lqc commented 7 years ago

Is there any other info? What you posted doesn't tell me much unless I'm missing something.

kb1lqc commented 7 years ago

Yeah @kb1lqd we will need to figure out what you're doing. I uninstalled all Faraday software from my computer and cleaned out config/file directories followed by installing with a wheel file (same as installing from PyPI). Bootstrap loading worked for me fine.

I did notice that I still had some issues with having to run it from the github directory but that is not the issue you seem to be having. In order for this to move forward I need more info from you on what isn't working.

kb1lqd commented 7 years ago

@kb1lqc Below is a BSL test from a clean install:

Brent@Brent-surface MINGW64 ~/Documents/Faraday_GIthub_Software/Pull_Request_Reviews/firmwareinstall/Faraday-Software (bsl)
$ ls
Applications/    etc/                        LICENSE.md        setup.cfg
CONTRIBUTING.md  faraday/                    Proxy/            setup.py*
Debug/           faraday.egg-info/           README            Tutorials/
Device_Test/     Firmware_Bootstrap_Loader/  README.md
docs/            images/                     requirements.txt

Brent@Brent-surface MINGW64 ~/Documents/Faraday_GIthub_Software/Pull_Request_Reviews/firmwareinstall/Faraday-Software (bsl)
$ faraday-bsl --init-config
2017-07-20 08:55:48,802 - BSL - INFO - Initializing BSL
2017-07-20 08:55:48,818 - BSL - INFO - Initialization complete

Brent@Brent-surface MINGW64 ~/Documents/Faraday_GIthub_Software/Pull_Request_Reviews/firmwareinstall/Faraday-Software (bsl)
$ faraday-bsl --help
usage: faraday-bsl [-h] [--init-config] [--start] [--getmaster] [--port PORT]

BSL will Boostrap load firmware onto Faraday via USB connection. Requires
http://www.ftdichip.com/Drivers/D2XX.htm

optional arguments:
  -h, --help     show this help message and exit
  --init-config  Initialize BSL configuration file
  --start        Start Boostrap loader
  --getmaster    Download newest firmware from master firmware repository
  --port PORT    Set UART port to bootstrap load firmware

Brent@Brent-surface MINGW64 ~/Documents/Faraday_GIthub_Software/Pull_Request_Reviews/firmwareinstall/Faraday-Software (bsl)
$ faraday-bsl --port COM21 --getmaster
2017-07-20 08:56:18,016 - BSL - INFO - Downloading latest Master firmware...
2017-07-20 08:56:18,737 - BSL - INFO - Download complete
2017-07-20 08:56:18,737 - BSL - WARNING - --start option not present, exiting BSL server!

Brent@Brent-surface MINGW64 ~/Documents/Faraday_GIthub_Software/Pull_Request_Reviews/firmwareinstall/Faraday-Software (bsl)
$ faraday-bsl --start
2017-07-20 08:56:31,440 - BSL - INFO - Starting Faraday Bootstrap Loader application
---------------------------------------------------------
BSL Scripter 3.1.0.0
PC software for BSL programming
2017-Jul-20 08:56:37
---------------------------------------------------------
Input file script is : C:/Users/Brent/Documents/Faraday_GIthub_Software/Pull_Request_Reviews/firmwareinstall/Faraday-Software/etc/faraday/faradayFirmwareUpgradeScript.txt
MODE 6xx UART 9600 COM21 PARITY
CHANGE_BAUD_RATE 115200
        BSL ACK is received.
VERBOSE

RX_PASSWORD pass32_wrong.txt

Brent@Brent-surface MINGW64 ~/Documents/Faraday_GIthub_Software/Pull_Request_Reviews/firmwareinstall/Faraday-Software (bsl)
kb1lqd commented 7 years ago

First, the unit trying to be reprogrammed does get RESET and reboots but doesn't reprogram due to the BSL program failing.

Interesting, when I run in from windows command line:

image

kb1lqc commented 6 years ago

Strange @kb1lqd I tried this on my Microsoft Surface Pro 4 and it worked fine. Can you try installing from a fresh git? Have you rebooted your computer and tried?

kb1lqc commented 6 years ago

Oh snap the problem maybe that my setup.cfg never pulls in etc/faraday/bsl-scripter-windows.exe as a package element. etc/faraday may not be the best folder but it works for now. On both my computers I probably manually moved this so it's present in both locations as I developed on it. I thought I cleaned it out though but this definitely needs to be included in setup.cfg along with any other exe required.