Closed PaulZC closed 4 years ago
I'm testing on windows and a few oddities:
Switching back to v2.0, hitting 'update bootloader' goes very fast and immediately fails. I don't think 'Tries = 3' is getting reset to 0? Yep, I fixed this and committed. I still can't bootload a new BL.
Artemis Bootloader Update
Installing bootloader version 5
Header Size = 0x80
original app_size 12944
load_address 0xc000
app_size 12944
w0 = 0xcb003310
Security Value 0x10
w2 = 0x10008080
addrWord = 0xc000
versionKeyWord = 0x0
child0/feature = 0xffffffff
child1 = 0xffffffff
crc = 0x826a7429
Writing to file application_OTA_blob.bin
testing: application_OTA_blob.bin
Header Size = 0x60
app_size = 13072
Writing to file application_Wired_OTA_blob.bin
Image from 0x0 to 0x3310 will be loaded at 0x20000
Connecting over serial port...
Sending Hello.
No response for command bytearray(b'\x00\x00\x08\x00')
Failed to respond
Fail
Sending Hello.
No response for command bytearray(b'\x00\x00\x08\x00')
Failed to respond
Fail
Sending Hello.
No response for command bytearray(b'\x00\x00\x08\x00')
Failed to respond
Fail
Tries = 3
Upload failed!
Please get Update Bootloader working then I'm ready to merge.
Thanks @nseidle ,
Thanks for the --noconsole
suggestion. Done.
I'm guessing/hoping your Update Bootloader problems were baud rate related.
On my Windows machine I can upload at 921600 but to update the bootloader I have to drop the rate to 115200.
On RPi I can only upload at 460800. 921600 fails.
So, I've done two things:
Hopefully all better now? Paul
All better! Thanks.
I forgot about the baud for uploading. Yep, that was the issue. Nice catch and fix.
I really it. @oclyke Please have a review so we can merge at your convenience.
Update Bootloader now uses 115200 (whether you like it or not)
This is probably OK considering that this is the "Artemis" firmware uploader. However I think it is worth mentioning that the Edge board is still produced with the ASB set to 921600. Could/should there be a small menu option to enable use of this tool with the Edge?
Thanks @oclyke ! I don't have any hardware to test it on, but adding a checkbox for the Edge (that forces Update Bootloader to use 921600) is no problem. Just say the word and I'll add it. All the best, Paul
I'm onboard.... @nseidle do you think we should support the Edge here? THe drawback is possibly clutter in UI but I can't think of anything else. I will hold off on generating binaries until we decide which way to go.
Agreed, add the checkbox. This is a tool, I'd rather have functionality than form.
OK. Leave it with me. I'll try and rotate the label so it runs vertically up the left edge (geddit?!) of the GUI. Unless that's a lame idea?!
Clever idea - I'd like to see it at least to see if it is useable - worried it could be hard to read.
In the meantime I just got to testing this on my Mac. No matter what serial port I select I get an immediate failure with this message:
Artemis SVL Uploader
Could not communicate with board!
Also of note (I guess) is that hitting the button again did not produce any more of that error message. I could not tell if it was trying again and getting the same error and overwriting it in the status window, or if it was just not trying after the one error.
Some thoughts:
Hi @oclyke / @nseidle ,
I've made a few changes and we now have a Board Type
menu with radio buttons for Aretmis and Apollo3 (Edge). The status bar at the bottom of the window displays helpful information when you hover over the two options. Update Bootloader automatically uses 115200 for Artemis and 921600 for Apollo3.
I've stopped the messages box from being cleared between updates/uploads, so you can see the full history.
Refreshing the com ports will leave the previous port selected (if it still exists).
A nice touch is that the window size can now be changed too - by dragging the bottom right corner of the window.
I can't explain why you're seeing Mac com failures but I suspect it is something fairly low level linked to the serial port and/or its baud rate capability. On my Windows machine, I see an instant failure if I leave COM1 selected (the default non-USB com port) and have 921600 baud selected. If I change the baud rate to 115200, the code does attempt to talk to COM1 before timing out.
If you have time, can you please try running the artemis_svl.py and ambiq_bin2board.py as per this post. Does that work?
Adam Garbo has built and run the executable successfully on macOS Catalina 10.15.4. Here's a copy of his pip3 list just in case that helps? This was before he replaced crypto with pycryptodome (pip3 uninstall crypto
followed by pip3 install pycryptodome
)
All the best,
Paul
Here's how I tested:
owenlyke@Owens-MacBook-Pro-10 1.1.1 % python3 tools/artemis/artemis_svl.py -v -f ~/Desktop/Temporary/Blink/Blink.ino.bin /dev/cu.wchusbserial1410
Artemis SVL Bootloader Script version 1.7
Phase: Setup Cleared startup blip Got SVL Bootloader Version: 5 Sending 'enter bootloader' command
Phase: Bootload have 8660 bytes to send in 5 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: 468
Upload complete
Nominal bootload bps: 8870.31
3. Fetch latest changes from your PR in the GUI repo
a. test a few of your feature additions (nice!)
4. Update bootloader using GUI (success)
Updating bootloader
Artemis Bootloader Update
Installing bootloader version 5 Header Size = 0x80 original app_size 12944 load_address 0xc000 app_size 12944 w0 = 0xcb003310 Security Value 0x10 w2 = 0x10008080 addrWord = 0xc000 versionKeyWord = 0x0 child0/feature = 0xffffffff child1 = 0xffffffff crc = 0x826a7429 Writing to file application_OTA_blob.bin testing: application_OTA_blob.bin Header Size = 0x60 app_size = 13072 Writing to file application_Wired_OTA_blob.bin Image from 0x0 to 0x3310 will be loaded at 0x20000 Connecting over serial port... Changing Baud Rate to 115200 Sending Hello. Received response for Hello Bootloader connected Received Status Length = 0x58 Version = 0x5 Max Storage = 0x4ffa0 Status = 0x2 State = 0x7 Sending OTA Descriptor = 0xfe000 Sending Update Command. Number of updates needed = 1 Sending block of size 0x3370 from 0x0 to 0x3370 Sending Data Packet of length 8180 Sending Data Packet of length 4988 Sending Reset Command. Tries = 0 Bootloader updated to version 5
5. Test uploading code at 921600 baud (success)
Uploading firmware
Artemis SVL Uploader
Phase: Setup Cleared startup blip Got SVL Bootloader Version: 5 Sending 'enter bootloader' command Phase: Bootload Sending 8784 bytes in 5 frames Got frame request Sending frame #1, length: 2048 Got frame request Sending frame #2, length: 2048 Got frame request Sending frame #3, length: 2048 Got frame request Sending frame #4, length: 2048 Retrying... Sending frame #4, length: 2048 Got frame request Sending frame #5, length: 592 Got frame request Upload complete! Nominal bootload 6097.96 bytes/sec
So somewhere in there my issues got resolved, it seems. I will go ahead and generate binaries for mac / linux (ubuntu).
Thanks Paul, this is sweet!
@PaulZC I've just added the binaries for OSX and Ubuntu. Nate and I agree that you can go ahead and merge this PR 👍
Thanks @oclyke - glad you like it! Can you or @nseidle please update the screenshot when you have time? https://cdn.sparkfun.com/assets/home_page_posts/3/2/4/5/Artemis_Firmware_Uploader_GUI.jpg Cheers!
@PaulZC New image here:
https://cdn.sparkfun.com/assets/home_page_posts/3/1/2/3/Artemis-GUI-v2.jpg
Hi @oclyke / @nseidle , I think I'm about done with this. I've updated the README and added the pyinstaller build instructions. It is missing the executables for OSX and Linux, please drop those in when time permits (and delete the DELETE_ME.txt placeholders). The code is not quite as elegant as I would like - it passes many things using self. 'globals' - Owen may need to put on his rose tinted specs when reviewing it! - but it is a neat stand-alone arg-less one-file solution. Enjoy! Paul