How to Run Example Programs#
This document details how to enable, compile, and run example programs in the K230 RTOS SDK, and configure them to start automatically on boot.
Enabling Example Programs#
Enabling Build Examples#
The current SDK has refactored the example configuration, and the unified entry is:
RT-Smart UserSpace Examples Configuration
It is recommended to configure in the following order:
First enable the master switch:
RT-Smart UserSpace Examples Configuration
You need to disable
CanMV Components ConfigurationThen enable sub-switches by category (select as needed):
Enable 3rd-party examples Enable build peripheral examples Enable MPP examples Enable build ai examples Enable build integrated examples
If a certain category is enabled (for example,
Enable MPP examples), continue to enter that submenu to check specific samples (such assample_venc,sample_vdec, etc.).
Notes:
The old paths
RT-Smart Configuration > Enable build Rtsmart examplesandMPP Configuration > Enable build MPP samplesare no longer the main example entries.The example master switch depends on
!SDK_ENABLE_CANMV; if you use the CanMV solution, you need to switch to the RTOS path according to the build guide before this menu will appear.
Compile Example Programs#
Full Build (Recommended)#
Run the make command in the root directory to compile all enabled examples and package them into the image in one step:
make
Individual Build (Debug Scenarios)#
If you need to compile a specific example individually, navigate to the corresponding directory and run the build:
cd src/rtsmart/examples/integrated_poc # Example path
make clean && make # Clean and rebuild
Notes:
The ELF file generated by individual compilation needs to be manually copied to the development board (see Step 3.2).
Make sure the corresponding category and specific sample have been enabled in
RT-Smart UserSpace Examples Configurationbefore compiling.
Running Example Programs#
Automatic Deployment via Image#
If you use make for the overall compilation, RT-Smart examples will be packaged by default into the /sdcard/app/examples/ directory of the image. After logging into the development board via serial port, you can directly execute:
cd /sdcard/app/examples
# Run example (example)
./integrated_poc/smart_ipc.elf
Manually Deploying Individually Compiled Examples#
Copy the generated ELF file (such as
integrated_poc.elf) to the development board via a card reader or mtp:Run via serial port terminal:
/sdcard/app/examples/integrated_poc.elf
Serial Port Connection Tips:
Use
PuTTYorMinicomto connect to the development board’s serial port (baud rate is115200).The serial port device name is usually
/dev/ttyUSB0on Linux, andCOMxon Windows.
Configure Boot Auto-Start Example#
Set Startup Command#
In
make menuconfig, navigate to:RT-Smart Configuration > Startup command
Startup commandis the runtime command string. It is recommended to enter the absolute path of the example program (e.g./sdcard/app/examples/integrated_poc/smart_ipc.elf).If
Fast Boot Configuration > Fast boot file pathis configured, an absolute path can be used, or the${SDK_*}variables exported bytools/mkenv.mk(e.g.${SDK_BUILD_IMAGES_DIR}) can be used. At the same time, the auto-start command also needs to be modified, replacing the elf path with/bin/preload.
Verify Auto-Start#
After restarting the development board, the example program will run automatically. You can check the logs or peripheral indicators to confirm whether it is effective.
Frequently Asked Questions#
Examples not appearing in
/sdcard/app/examplesdirectoryCheck whether the
RT-Smart UserSpace Examples Configurationmain switch has been enabled.Check whether the corresponding category (e.g., MPP/AI/Integrated) and specific samples have been selected.
Re-run
makeand ensure there are no compilation errors.
No serial port output
Confirm that the serial cable is properly connected.
Check whether the baud rate matches the terminal configuration.
By following the steps above, you can quickly master the complete operation workflow of the K230 RTOS SDK example programs.
