Developping on pyboard

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
fma
Posts: 164
Joined: Wed Jan 01, 2014 5:38 pm
Location: France

Developping on pyboard

Post by fma » Wed Jun 11, 2014 4:09 pm

Hi!

I wanted to know: what is the best way to develop on pyboard? I mean, how do you edit your code, send it to pyboard, run it, correct it, re-test...?

Any advice welcome.
Frédéric

User avatar
Markus Gritsch
Posts: 41
Joined: Fri May 16, 2014 9:04 pm

Re: Developping on pyboard

Post by Markus Gritsch » Fri Jun 13, 2014 10:26 am

I don't know if there is a "best" way, but I edit the code in my Editor of choice, save it to the virtual file system on the pyboard, press Ctrl+D in the micro-python serial terminal to soft-reset the board, press Ctrl+C to interrupt the running code and loop back to the editing step :)

I would be quite happy, if this actually would work all the time, but far too often the board locks up after pressing Ctrl+C and the only way to continue is a hard reset. This then makes it a lot more inconvenient, because I have to close the serial connection before pressing the reset button and re-open it after the hard-reset. It gets even worse when I forget to close the serial connection before pressing reset, because then the COM port is not available since it was held by the terminal, and I have to close the terminal and perform another hard-reset. Really annoying.

This type of hard fault is documentet here: http://micropython.org/doc/general But I wonder if it is ok that it happens from time to time when interrupting a running program, or if this is a bug...

fma
Posts: 164
Joined: Wed Jan 01, 2014 5:38 pm
Location: France

Re: Developping on pyboard

Post by fma » Fri Jun 13, 2014 10:31 am

So, you don't need to umount the virtual file system when doing a soft-reboot (Ctrl-D)? Changes are not lost?

Are such amovible devices mounted with sync option, under linux?
Frédéric

User avatar
Markus Gritsch
Posts: 41
Joined: Fri May 16, 2014 9:04 pm

Re: Developping on pyboard

Post by Markus Gritsch » Fri Jun 13, 2014 10:40 am

I use Windows 7 and there the virtual file system is shown as a removable disk in the explorer. I have no idea, how it behaves under Linux. Anyway, you could just try it and see for yourself, if changes to the file you make in your editor have any effect when immediately soft-resetting the board.

randomhuman
Posts: 19
Joined: Mon Jun 09, 2014 1:54 pm

Re: Developping on pyboard

Post by randomhuman » Fri Jun 13, 2014 1:52 pm

The same process works fine on Linux, and the filesystem remains mounted throughout. You only need to umount if you're doing a hard-reset.

fma
Posts: 164
Joined: Wed Jan 01, 2014 5:38 pm
Location: France

Re: Developping on pyboard

Post by fma » Fri Jun 13, 2014 2:08 pm

Ok, thanks :)
Frédéric

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Developping on pyboard

Post by dhylands » Fri Jun 13, 2014 3:59 pm

fma wrote:So, you don't need to umount the virtual file system when doing a soft-reboot (Ctrl-D)? Changes are not lost?

Are such amovible devices mounted with sync option, under linux?
So FAT file systems (under both Windows 7 and linux) tend to get written to fairly quickly and not keep alot of cached data around.

For large files, its pretty easy to interrupt things while cached data is still unwritten, but for small files, you'd have to be pretty quick.

Obviously, the safest way is to eject on the host OS, but you can probably get away without it if there a couple of seconds between writing the file and reseting uPy.

Under linux, I see:

Code: Select all

/dev/sdc1 on /media/dhylands/4421-0002 type vfat (rw,nosuid,nodev,uid=35029,gid=1001,shortname=mixed,dmask=0077,utf8=1,showexec,flush,uhelper=udisks2)
The "flush" option (from man mount) says:
If set, the filesystem will try to flush to disk more early than normal. Not set by default.

Post Reply