Tip: Open mini-rail as its own project in CLion.
The project is made up of several parts:
mini-rail/modules: a set of libraries containing the business logicmini-rail/embedded: a set of binaries containing code specific for the Picomini-rail/apps: a set of binaries containing the code for the host platformmini-rail/include: public header files of the modulesmini-rail/lib: third-party libraries (via git modules)
For an easy build, just execute build.sh. If you want to build the project
manually, read on.
There is also the Pico SDK which is required to build the embedded code. You
need to download the SDK by running git submodule update --init. Then set
the environment variable PICO_SDK_PATH to the path of the SDK
($(pwd)/rail/lib/pico-sdk) and CAN2040_LIB_PATH of the CAN library
($(pwd)/rail/lib/can2040).
If you want to test your code on your normal computer (and not flashing it to
the Pico), pass TARGET_ARCH=host to cmake:
cmake -D TARGET_ARCH=host -B mini-rail/build/host -S mini-rail
make -C mini-rail/hostAll libraries and binaries are compiled to mini-rail/build/host using your
computers' architecture. You can now execute a binary to test some stuff.
If you want to flash your code to the Pico, you need to build the embedded code
by passing TARGET_ARCH=pico to cmake:
cmake -D TARGET_ARCH=pico -B mini-rail/build/embedded -S mini-rail
make -C mini-rail/embeddedNow connect the Pico to your computer while pressing the bootsel button. A
drive should appear. Drag and drop the uf2 file to that drive to flash the
firmware.