The standard CircuitPython boot sequence and logic applies when you are running Fruit Jam OS. This dictates what CircuitPython will do when it first boots up. By default with a standard single reset or normal boot up, CircuitPython will first run the boot.py file, if it exists, and following that run the code.py file that we are familiar with.
Fruit Jam OS changes the default flow a little bit by inserting boot_animation.py between boot.py and code.py, as well as offering a mechanism to skip the boot animation and launcher. The diagram below outlines the startup behavior of Fruit Jam OS.
Launching Other Python Files
A technique that foundational to how Fruit Jam OS works is launching different CircuitPython code files on a reload. The boot animation, launcher, and editor all make use of this technique. The way this works in CircuitPython is by using supervisor.set_next_code_file(). This function accepts a string with a filename of a CircuitPython code file to launch and a handful of optional arguments to vary its behavior. See the documentation for full details.
After you call supervisor.set_next_code_file(), the next time CircuitPython starts up, it will run the specified file instead of code.py. Fruit Jam OS calls this function and then calls supervisor.reload() immediately afterward to force CircuitPython to reload and run the file specified before. Here is an example of a typical usage from the end of the boot animation:
supervisor.set_next_code_file("code.py")
supervisor.reload()
As noted, Fruit Jam OS adds a bit of extra logic on top of the standard boot sequence. During a standard boot into Fruit Jam OS there are 3 stages within the boot process:
- boot.py - The boot.py file included with Fruit Jam OS first checks for arguments passed to it using the adafruit_argv_file module. There are a few possible arguments that will affect how it behaves and what happens next. They're detailed below in the boot arguments section. During a standard boot up, there will be no arguments and the boot sequence will move on to the next stage, launching boot_animation.py.
- boot_animation.py - This file displays the cheerful and iconic Fruit Jam boot animation on the screen, and plays the lovely jingle over the connected speakers or headphones. See the Startup Screens guide for more details about the boot animation and a deeper dive into the code. Once the animation is complete, code.py will be launched.
- code.py - In Fruit Jam OS, code.py contains the launcher program. It shows the apps that are loaded on your device split into pages of 6 at a time. You can navigate them with either USB keyboard or mouse and select an app in order to launch it.
boot.py Arguments
The Fruit Jam OS boot.py script checks for arguments that were passed to it via the adafruit_argv_file module. The adafruit_argv_file API is similar to sys.argv in CPython. Arguments are accessed as a list containing 0 or more values. Since it's a list, arguments are indexed starting at 0. The possible arguments that the Fruit Jam OS boot.py file will look for and use are:
-
0: storagereadonlyboolean flag. Setting toFalsemeans mount to mount the flash filesystems as writable to CircuitPython.Truemeans mount read-only to CircuitPython. The built-in Editor app uses this argument when the user requests that the drive be mounted as writable. -
1:next_code_fileA string containing the name of a CircuitPython code file to launch instead of the default boot_animation.py. This can be used to skip the boot animation and launch directly into a different app. The built-in Editor app uses it to launch directly back to itself after rebooting to have the flash mounted as writable. -
2-N: All remaining arguments will get passed to the next code file that is launched. This is also used by the Editor in order to specify which file it should open up after having the storage remounted.
Page last edited August 22, 2025
Text editor powered by tinymce.