Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 15:31 19 Jul 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Easy .uf2 file creation?

Author Message
carlschneider
Senior Member

Joined: 04/08/2023
Location: South Africa
Posts: 147
Posted: 11:54pm 14 Sep 2023
Copy link to clipboard 
Print this post

Hi

I notice that some code is being delivered in a .uf2 file as a means of installing the complete package with all supporting files through a simple drag and drop.

XModem in MMEdit is padding transferred files to 128 byte boundaries when transferring in MMCC, which is a problem for some files; such as a javascript file I noticed recently.

TFTP on Windows is a CLI and takes some driving to achieve binary file transfers.

Is there a simple way to wrap all the required files in a .uf2 delivery file to ensure correct delivery of the payload that could be adversely affected by padding?

Guidance would be appreciated
Cheers Carl                                                        
Retirement is tough on Hobbies without a day job
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5960
Posted: 12:21am 15 Sep 2023
Copy link to clipboard 
Print this post

  Quote  XModem in MMEdit is padding transferred files to 128 byte boundaries when transferring in MMCC, which is a problem for some files; such as a javascript file I noticed recently.

TFTP on Windows is a CLI and takes some driving to achieve binary file transfers.

XMODEM pads the file whichever program you use to initiate the XMODEM transfer. That's XMODEM - not MMEdit.

If you have installed TFTP and connect to your webmite via Telnet/TCPIP instead of USB, MMEdit's file manager will use TFTP for the transfers instead of XMODEM.
No need to get your hands dirty at the command-line.
One day I might white my own TFTP client and incorporate it into MMEdit.

If you don't use MMEdit but do use Windows, create a batch file with this content, changing the IP address to suit
echo %1
echo %~nx1
tftp -i 10.1.0.232 PUT %1 %~nx1

pause

and place it on your desktop.
You can then drag and drop files onto the desktop icon and transfer to your webmite that way.

Jim
VK7JH
MMedit   MMBasic Help
 
carlschneider
Senior Member

Joined: 04/08/2023
Location: South Africa
Posts: 147
Posted: 01:24am 15 Sep 2023
Copy link to clipboard 
Print this post

Thanks Jim and noted.

Hopefully that will assist Fred when he does the update.
Cheers Carl                                                        
Retirement is tough on Hobbies without a day job
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3174
Posted: 06:52pm 15 Sep 2023
Copy link to clipboard 
Print this post

  carlschneider said  Is there a simple way to wrap all the required files in a .uf2 delivery file

You need to load all the files onto a Pico first (which is what you are trying to avoid) but for others who want to create a single uf2 file containing everything, this is how I do it:

You need picotools: https://github.com/raspberrypi/picotool.  I had to install a driver using Zadig https://zadig.akeo.ie/ (When it loads just click on InstallDriver even though Driver: will show NONE)

Creating an Image of the Pico Flash is easy (using Windows):
1. Load all the files onto a Pico and set any options
2. Plug the Pico in while holding down BOOTSEL switch.  Same as loading new firmware
3. Run a command window where pocotool.exe is located
4. Run this command: picotool save -a filename.uf2

Geoff
Geoff Graham - http://geoffg.net
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3708
Posted: 01:32pm 16 Sep 2023
Copy link to clipboard 
Print this post

Same command should work on Linux

(That command line is basically a Linux one on Windows.)

Linux normally has the required driver(s) already.

John
Edited 2023-09-16 23:33 by JohnS
 
carlschneider
Senior Member

Joined: 04/08/2023
Location: South Africa
Posts: 147
Posted: 12:38am 17 Sep 2023
Copy link to clipboard 
Print this post

Thanks Peter, much appreciated.

I note that all files, program memory, flash slots and options need to be setup before the uf2 is created. I’m guessing there are a whole lot of other things being copied to the uf2 that I have not even considered.

It really makes a binary level copy of everything that’s on the Pico and effectively wipes everything that was there before when it is loaded through the BOOTSEL route.

I was wondering if there is a way of embedding some files that could then be written by the bas program to the A: drive? Something like Define Font and Csubs that store data that can then be read and written to a file on the A: drive. That way it doesn’t have to be a uf2 file and the bas program creates its own running environment on first launch at the cost of some bloat.

Thanks for the comments John - I found a brew that loaded the Picotool on the MacBook and have successfully read the Pico contents and saved to a uf2 file.
Cheers Carl                                                        
Retirement is tough on Hobbies without a day job
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024