Skip to content

Commit

Permalink
flasher cli: add version
Browse files Browse the repository at this point in the history
Add version to the flasher CLI.
Fix the build command to properly include the mini driver.

PROD-10321

Signed-off-by: Ryan Erickson <[email protected]>
  • Loading branch information
rerickson1 committed May 8, 2024
1 parent 61820aa commit 39ad779
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
13 changes: 11 additions & 2 deletions if820_flasher_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
pyinstaller command to produce a single executable file:
pyinstaller --clean --console --noconfirm --onefile --add-data "files/v1.4.12.12_int-ant/minidriver-20820A1-uart-patchram.hex:files" --collect-all pyocd --collect-all cmsis_pack_manager -p common_lib/libraries if820_flasher_cli.py
pyinstaller --clean --console --noconfirm --onefile --add-data "files/v1.4.12.12_int-ant/minidriver-20820A1-uart-patchram.hex:files/v1.4.12.12_int-ant/" --collect-all pyocd --collect-all cmsis_pack_manager -p common_lib/libraries if820_flasher_cli.py
"""

Expand All @@ -19,6 +19,7 @@
from HciProgrammer import HciProgrammer

LOG_MODULE_HCI_PORT = 'hci_port'
VERSION = '2.0.0'


def resource_path(relative_path):
Expand All @@ -45,6 +46,8 @@ def resource_path(relative_path):
help="Enable verbose debug messages")
parser.add_argument('-f', '--file',
help="application hex file to flash")
parser.add_argument('-v', '--version', action='store_true',
help="Print the version of the tool and exit.")

logging.basicConfig(
format='%(asctime)s | %(levelname)s | %(message)s', level=logging.INFO)
Expand All @@ -53,8 +56,14 @@ def resource_path(relative_path):
logging.info("Debugging mode enabled")
logging.getLogger().setLevel(logging.DEBUG)

if args.version:
print(f"{VERSION}")
exit(0)

print(f"IF820 Flasher CLI v{VERSION}")

mini_driver = resource_path(
'files/v1.4.12.12_int-ant/minidriver-20820A1-uart-patchram.hex')
f'files{os.sep}v1.4.12.12_int-ant{os.sep}minidriver-20820A1-uart-patchram.hex')
com_port = args.connection
firmware = args.file
chip_erase = args.chip_erase
Expand Down
3 changes: 2 additions & 1 deletion if820_flasher_cli.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- mode: python ; coding: utf-8 -*-
from PyInstaller.utils.hooks import collect_all

datas = [('files/v1.4.12.12_int-ant/minidriver-20820A1-uart-patchram.hex', 'files')]
datas = [('files/v1.4.12.12_int-ant/minidriver-20820A1-uart-patchram.hex', 'files/v1.4.12.12_int-ant/')]
binaries = []
hiddenimports = []
tmp_ret = collect_all('pyocd')
Expand All @@ -21,6 +21,7 @@ a = Analysis(
runtime_hooks=[],
excludes=[],
noarchive=False,
optimize=0,
)
pyz = PYZ(a.pure)

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
hci==0.0.8
intelhex==2.3.0
pyinstaller==6.1.0
pyinstaller==6.6.0
pyocd==0.36.0
pyserial==3.5
wxPython==4.2.1

0 comments on commit 39ad779

Please sign in to comment.