Artemis OpenLog - Uploading Firmware

Hey guys,

I just noticed that the Artemis Firmware Uploader (AFU) is made to operate only in Windows. Can you please advise how those of us who are not using Windows can upload firmware to the Artemis OpenLog?

Cheers,

Adam

The GUI basically wraps the functionality of two tools that are part of the Artemis SDK:

  • - [[artemis_svl.py](https://github.com/sparkfun/Arduino_Apollo3/blob/master/tools/artemis/artemis_svl.py) - to send images to the bootloader
  • - [[ambiq_bin2board.py](https://github.com/sparkfun/Arduino_Apollo3/blob/master/tools/ambiq/ambiq_bin2board.py) - to update the bootloader itself
  • [/list]

    What worked for me on a Linux machine was to install Arduino and then install the Apollo3 core per the [SparkFun instructions (I already had this done before I got the OpenLog). Once that’s done you need to install a couple of Python dependencies and then you can use the scripts from the Arduino core directory on your machine. This same procedure should also work on a Mac with slightly different commands to install the Python packages and slightly different paths for the Arduino core.

    # install dependencies (this is for Ubuntu)
    sudo apt-get update
    sudo apt install python3-serial python3-pycryptodome
    
    # now you can use the scripts
    # this assumes your device is on /dev/ttyUSB1
    
    # upload an image called "Blink.bin"
    python3 ~/.arduino15/packages/SparkFun/hardware/apollo3/1.0.30/tools/artemis/artemis_svl.py -v -f ./Blink.bin -b 115200 /dev/ttyUSB1
    
    # update the bootloader using bootloader image "artemis_svl.bin"
    python3 ~/.arduino15/packages/SparkFun/hardware/apollo3/1.0.30/tools/ambiq/ambiq_bin2board.py --bin ./artemis_svl.bin --load-address-blob 0x20000 --magic-num 0xCB --version 0x0 --load-address-wired 0xC000 -i 6 --options 0x1 -b 115200 -port /dev/ttyUSB1 -r 2 -v
    

    I’d be careful if updating the bootloader and double check the command line arguments. I don’t know how forgiving it is if you sign the blob incorrectly or put it at the wrong offset. You may need to have an SWD probe on hand to reflash it if you get it in a funky state. Updating the firmware itself shouldn’t be an issue, only the bootloader.

    It seems like it’d be pretty straightforward to add these Python scripts directly to the GUI application’s PyQt codebase and then there wouldn’t be a need to embed other executables in the package.](Artemis Development with Arduino - SparkFun Learn)](https://github.com/sparkfun/Arduino_Apollo3/blob/master/tools/ambiq/ambiq_bin2board.py)](https://github.com/sparkfun/Arduino_Apollo3/blob/master/tools/artemis/artemis_svl.py)

    Hi Matt,

    Thanks for the advice! I’ll be sure to give this a try once I have some time to delve into it.

    Cheers,

    Adam

    Hey Matt,

    Thanks again for your help. It turned out to be pretty simple on macOS.

    pip install pyserial
    pip install pycryptodome
    
    python3 /Users/adam/Library/Arduino15/packages/SparkFun/hardware/apollo3/1.1.1/tools/artemis/artemis_svl.py -v -f ./OpenLog_Artemis.bin -b 115200 /dev/tty.usbserial-1420
    
    Artemis SVL Bootloader
    Script version 1.7
    
    Phase:	Setup
    	Cleared startup blip
    	Got SVL Bootloader Version: 5
    	Sending 'enter bootloader' command
    
    Phase:	Bootload
    	have 124224 bytes to send in 61 frames
    	Sending frame #1, length: 2048
    	Sending frame #2, length: 2048
    	Sending frame #3, length: 2048
    	Sending frame #4, length: 2048
    	Sending frame #5, length: 2048
    	Sending frame #6, length: 2048
    	Sending frame #7, length: 2048
    	Sending frame #8, length: 2048
    	Sending frame #9, length: 2048
    	Sending frame #10, length: 2048
    	Sending frame #11, length: 2048
    	Sending frame #12, length: 2048
    	Sending frame #13, length: 2048
    	Sending frame #14, length: 2048
    	Sending frame #15, length: 2048
    	Sending frame #16, length: 2048
    	Sending frame #17, length: 2048
    	Sending frame #18, length: 2048
    	Sending frame #19, length: 2048
    	Sending frame #20, length: 2048
    	Sending frame #21, length: 2048
    	Sending frame #22, length: 2048
    	Sending frame #23, length: 2048
    	Sending frame #24, length: 2048
    	Sending frame #25, length: 2048
    	Sending frame #26, length: 2048
    	Sending frame #27, length: 2048
    	Sending frame #28, length: 2048
    		Retrying...
    	Sending frame #28, length: 2048
    	Sending frame #29, length: 2048
    	Sending frame #30, length: 2048
    	Sending frame #31, length: 2048
    	Sending frame #32, length: 2048
    	Sending frame #33, length: 2048
    	Sending frame #34, length: 2048
    	Sending frame #35, length: 2048
    	Sending frame #36, length: 2048
    	Sending frame #37, length: 2048
    	Sending frame #38, length: 2048
    	Sending frame #39, length: 2048
    	Sending frame #40, length: 2048
    	Sending frame #41, length: 2048
    	Sending frame #42, length: 2048
    	Sending frame #43, length: 2048
    	Sending frame #44, length: 2048
    	Sending frame #45, length: 2048
    	Sending frame #46, length: 2048
    	Sending frame #47, length: 2048
    	Sending frame #48, length: 2048
    	Sending frame #49, length: 2048
    	Sending frame #50, length: 2048
    	Sending frame #51, length: 2048
    	Sending frame #52, length: 2048
    	Sending frame #53, length: 2048
    	Sending frame #54, length: 2048
    	Sending frame #55, length: 2048
    	Sending frame #56, length: 2048
    	Sending frame #57, length: 2048
    	Sending frame #58, length: 2048
    	Sending frame #59, length: 2048
    	Sending frame #60, length: 2048
    	Sending frame #61, length: 1344
    
    	Upload complete
    
    	Nominal bootload bps: 9198.69
    

    Cheers,

    Adam

    Also, I forgot to mention that not having to Bootcamp into Windows to upload the firmware is a HUGE time saver.

    Could be very useful to include in a SparkFun Hookup Guide for the Artemis.

    Cheers,

    Adam

    Hi adam.g,

    If you don’t mind being a beta-tester, you might find this branch useful:

    https://github.com/sparkfun/Artemis-Fir … d_Uploader

    If you have PyQt5 etc. already installed, you can run the python direct from the tools folder using:

    python3 artemis_firmware_uploader_gui.py

    If that works, then you can create your own executable using:

    pyinstaller --onefile --distpath=. --icon=artemis_firmware_uploader_gui.ico --add-data=“artemis_svl.bin:.” --add-data=“Artemis-Logo-Rounded.png:.” artemis_firmware_uploader_gui.py

    (https://github.com/sparkfun/Artemis-Fir … gui.py#L18)

    Please let me know if this meets your needs!

    Best wishes,

    Paul