renaming PYBFLASH mount point from PyBoard code

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: renaming PYBFLASH mount point from PyBoard code

Post by dhylands » Wed Oct 21, 2015 6:49 am

ok - preliminary support for multiple pyboards is now in rshell.

Currently, rshell will only initially connect to a single board at startup. You need to use the "connect serial port [baud]" command to connect to additional boards.

To determine the name, rshell executes the following on the board:

Code: Select all

    try:
        import board
        name = board.name
    except:
        name = 'pyboard'
    return repr(name)
so the simplest board.py file is just name = 'string'. If there are duplicate board names, the duplicate will be assigned a unique suffix (a dash followed by a number).

/flash will map to the first device. /board-name/flash will be the device named 'board-name' (whatever shows in the boards command).

Here's a sample session which shows the new commands (boards, connect, and repl with a board):

Code: Select all

2972 >rshell.py 
Welcome to rshell. Use Control-D to exit.
/home/dhylands> boards
moe @ /dev/ttyACM0
/home/dhylands> connect serial /dev/ttyACM1
/home/dhylands> boards
moe   @ /dev/ttyACM0
larry @ /dev/ttyACM1
/home/dhylands> cat /flash/board.py
name = 'moe'
/home/dhylands> cat /moe/flash/board.py
name = 'moe'
/home/dhylands> cat /larry/flash/board.py
name = 'larry'
/home/dhylands> repl moe
Entering REPL. Use Control-X to exit.

Micro Python v1.4.6-49-gfd38799-dirty on 2015-10-07; PYBv1.0 with STM32F405RG
Type "help()" for more information.
>>> 
>>> import board
>>> board.name
'moe'
>>> 
/home/dhylands> repl larry
Entering REPL. Use Control-X to exit.

MicroPython v1.4.6-91-g641f348-dirty on 2015-10-17; PYBv1.0 with STM32F405RG
Type "help()" for more information.
>>> 
>>> 
>>> import board
>>> board.name
'larry'
>>> 

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

Re: renaming PYBFLASH mount point from PyBoard code

Post by dhylands » Thu Oct 22, 2015 6:04 am

And I added autoscan.

So if you start rshell under linux, it will scan your connected USB devices and if they look like MicroPython boards, then it will connect to them.

Code: Select all

3004 >rshell.py 
Connecting to /dev/ttyACM0 ...
Connecting to /dev/ttyACM1 ...
Welcome to rshell. Use Control-D to exit.
/home/dhylands> boards
larry @ /dev/ttyACM0
moe   @ /dev/ttyACM1

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

Re: renaming PYBFLASH mount point from PyBoard code

Post by dhylands » Sat Oct 24, 2015 2:52 am

And now it will automatically dectect a micropython usb-serial connection, and disconnection.

And I made the serial handling more robust.

Post Reply