Start from the template
Goal: A new app of your own, built into the firmware and open on the board, and in the simulator from its launcher.
You need: Start here done, including the first flash (board revision set in 2. Build the firmware). No GitHub account is needed to create an app; publishing it needs gh auth login.
When to choose it: for an empty app that carries your own id and names from the first command. To start from working code instead, copy the cookbook example closest to your idea: Make an example your own. New to CrossPad apps? Do Hello screen first: it runs in the simulator and explains every line.
Run every command from the project root (~/CrossPad, Windows C:\CrossPad\firmware) with ESP-IDF loaded as in 2. Build the firmware. Used the one-line installer? Use crosspad-idf in place of idf.py.
-
Generate the app from the template
The command copies the app template into
components/crosspad-my-app, as a folder with its own git repository. Make the id of lowercase letters, digits and dashes, starting with a letter; the C++ class and the app’s name become the id in CamelCase, hereMyApp.Terminal window idf.py app-new --app my-app --name "My App" --category musicYou should see:
… file(s) generatedgit repository initialisedplaced at components/crosspad-my-app (no remote)my-app ready at components/crosspad-my-appNext: idf.py -B build_v2 -DSDKCONFIG=sdkconfig.v2 fullclean && idf.py -B build_v2 -DSDKCONFIG=sdkconfig.v2 buildIf not: idf.py app-new stops with an error. If
idf.pydoes not knowapp-new: idf.py says app-list is not known. -
Write the app
Edit the sources in
components/crosspad-my-app/src/. The template already registers the app at the end ofMyAppApp.cppwithREGISTER_APP_PL; keep that line insrc/, because the build only looks for registrations there.You should see:
MyAppApp.cppandMyAppPadLogic.cppincomponents/crosspad-my-app/src/, and a line startingREGISTER_APP_PL(MyApp,near the end ofMyAppApp.cpp.If not: a new app does not show up
-
Rebuild from a clean build folder
The build finds new apps only when it configures from scratch, so clean the build folder first.
Terminal window idf.py -B build_v2 fullcleanidf.py -B build_v2 -DSDKCONFIG=sdkconfig.v2 buildTerminal window idf.py -B build_v2 fullcleanidf.py -B build_v2 "-DSDKCONFIG=sdkconfig.v2" buildYou should see: the three app lines shown under Check it worked while CMake configures, and
Project build complete. To flash, run:at the end.If not: build stops before Project build complete. If the build completes but
MyAppis not in the app list: a new app does not show up. -
Flash the firmware over USB
Answer the board’s prompts as in 3. Flash the board: Allow, then Update, then leave the board alone for 10 seconds.
Terminal window python3 tools/ota_flash.pyTerminal window python tools\ota_flash.pyYou should see:
OTA complete! (…s, … KB/s)Device restarting...Running slot: trialIf not: OTA flash cannot find the board, or OTA times out waiting for confirmation.
-
Flash the app icon
App icons live in the assets partition, which you send separately from the firmware.
Terminal window python3 tools/fs_transfer.py assetsTerminal window python tools\fs_transfer.py assetsYou should see:
Device ready. Streaming (nothing is erased until the CRC matches)...Assets written and verified. The device is restarting.If not: OTA flash cannot find the board. If it says
Error: no assets.bin for this board, run step 3 again. -
Open the app
Hit pad 1 on the MODE map to open the Sampler. Then, with the board on USB, start the app with the crosspad-hil command-line tool, from the venv you made in 1. Set up the toolchain. Used the one-line installer? Skip the first line:
crosspad-hilalready works.Terminal window . ~/CrossPad/.venv/bin/activatecrosspad-hil app start MyAppTerminal window C:\CrossPad\firmware\.venv\Scripts\Activate.ps1crosspad-hil app start MyAppThe command needs the board in MIDI + Serial mode. If the board is in another mode, run
crosspad-hil usb-mode set default, press Allow on the board, and start the app again. From another app, open yours withmode_overlay_open_app("MyApp").You should see:
running=MyAppin the terminal, and on the board the template’s screen: ◀ Back and My App at the top, a tank with fish, + Fish, - Fish and Feed, and a speed slider. ◀ Back or a short press of the power button closes it.
Check it worked
Section titled “Check it worked”The build output from step 3 lists your app (somewhere inside each list, not at the end):
App component requires: ...;crosspad-my-app;...Generated app_registry_init.cpp with N apps: ...;MyApp;...Assets: staged 1 assets from component 'crosspad-my-app'After the flash, the board knows the app as MyApp (crosspad-hil app list lists it): the class name, not the name in the manifest. In the simulator, the launcher has a tile labelled MyApp with the template’s icon.
Make the app do something. Build an app maps each kind of app (instrument, MIDI controller, sequencer, an app with a UI) to the recipe that shows it, and every recipe in the cookbook is a small complete app you can copy from: start with Hello screen, and read How an app works before your app does more than draw a screen. When it is ready for others, publish it.