You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+35-2Lines changed: 35 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@ npm install
37
37
npm run start:micropython
38
38
```
39
39
40
-
and enjoy the MicroPython REPL! Quit the REPL with Ctrl+X. A different UF2 image can be loaded by supplying the `--image` option:
40
+
and enjoy the MicroPython REPL! Quit the REPL with Ctrl+X. A different MicroPython UF2 image can be loaded by supplying the `--image` option:
41
41
42
42
```
43
43
npm run start:micropython -- --image=my_image.uf2
@@ -53,7 +53,7 @@ For using the MicroPython demo code in tests, the `--expect-text` can come handy
53
53
54
54
#### Filesystem support
55
55
56
-
With MicroPython – and probably also CircuitPython – you can use the filesystem on the Pico. This becomes useful as more than one script file is used in your code. Just put a [LittleFS](https://github.com/littlefs-project/littlefs) formatted filesystem image called `littlefs.img` into the rp2040js root directory, and your `main.py` will be automatically started from there.
56
+
With MicroPython, you can use the filesystem on the Pico. This becomes useful as more than one script file is used in your code. Just put a [LittleFS](https://github.com/littlefs-project/littlefs) formatted filesystem image called `littlefs.img` into the rp2040js root directory, and your `main.py` will be automatically started from there.
57
57
58
58
A simple way to create a suitable LittleFS image containing your script files is outlined in [create_littlefs_image.py](https://github.com/tomods/GrinderController/blob/358ad3e0f795d8cc0bdf4f21bb35f806871d433f/tools/create_littlefs_image.py).
59
59
So, using [littlefs-python](https://pypi.org/project/littlefs-python/), you can do the following:
@@ -74,6 +74,39 @@ Other ways of creating LittleFS images can be found [here](https://github.com/wo
74
74
75
75
Currently, the filesystem is not writeable, as the SSI peripheral required for flash writing is not implemented yet. If you're interested in hacking, see the discussion in https://github.com/wokwi/rp2040js/issues/88 for a workaround.
76
76
77
+
### CircuitPython code
78
+
79
+
To run the CircuitPython demo, you can follow the directions above for MicroPython, except download [adafruit-circuitpython-raspberry_pi_pico-en_US-8.0.2.uf2](https://adafruit-circuit-python.s3.amazonaws.com/bin/raspberry_pi_pico/en_US/adafruit-circuitpython-raspberry_pi_pico-en_US-8.0.2.uf2) instead of the MicroPython UF2 file. Place it in the rp2040js root directory, then run:
80
+
81
+
```
82
+
npm install
83
+
npm run start:circuitpython
84
+
```
85
+
86
+
and start the CircuitPython REPL! The rest of the experience is the same as the MicroPython demo (Ctrl+X to exit, using the `--image` and
87
+
`--gdb` options, etc).
88
+
89
+
#### Filesystem support
90
+
91
+
For CircuitPython, you can create a FAT12 filesystem in Linux using the `truncate` and `mkfs.vfat` utilities:
92
+
93
+
```shell
94
+
truncate fat12.img -s 1M # make the image file
95
+
mkfs.vfat -F12 -S512 fat12.img # create the FAT12 filesystem
96
+
```
97
+
98
+
You can then mount the filesystem image and add files to it:
99
+
100
+
```shell
101
+
mkdir fat12 # create the mounting folder if needed
102
+
sudo mount -o loop fat12.img fat12/ # mount the filesystem to the folder
103
+
sudo cp code.py fat12/ # copy code.py to the filesystem
104
+
sudo umount fat12/ # unmount the filesystem
105
+
```
106
+
107
+
While CircuitPython does not typically use a writeable filesystem, note that this functionality is unavailable (see MicroPython filesystem
0 commit comments