Skip to content

Minimal APP Example*

Tip

1. Overview*

The minimal OVP App example demonstrates the minimal implementation of the OVP application framework. It prints a "hello world!" log each time a microphone data event is received.

2. Features*

  • Demonstrates the standard callbacks of the OVP_APP framework (app_init, app_event_response, app_task_loop)
  • Responds to the Audio-in recording complete event (EVENT_AUDIO_IN_RECORD_DONE) and outputs a log
  • Serves as a reference starting point for new App development

3. Directory Structure*

app/hello_world/
├── app.c               # Main program
├── app.mk               # Build configuration
├── app.name             # Kconfig option
└── Kconfig              # Sub-configuration (empty)
File Purpose
app.c Defines the OVP_APP structure, implements standard callbacks, and calls OVP_REGISTER_APP() for registration
app.mk Builds app.c, controlled by CONFIG_APP_HELLO_WORLD
app.name Defines the CONFIG_APP_HELLO_WORLD option, displayed as "Hello World" in menuconfig
Kconfig Empty framework; this App has no additional configuration options

4. Configuration*

This App has no additional Kconfig sub-configuration or macro definitions. Simply select "Hello World" in menuconfig.

To adjust the log level, modify the LOG_LVL macro in app.c:

#define LOG_LVL 3   // 0: No logs, 1: ERROR, 2: WARN, 3: INFO, 4: DEBUG

5. Working Principle*

5.1 Initialization Flow*

app_init() only prints a log and performs no other initialization operations.

5.2 Event Handling*

app_event_response() is the event-driven entry point. This App only responds to the Audio-in recording complete event:

Event Trigger Condition Handling Logic
EVENT_AUDIO_IN_RECORD_DONE Audio-in recording complete (approximately 40ms with default configuration) Prints "hello world!"

The event trigger interval is determined by the PCM frame length in each context, which is approximately 40ms with the default configuration.

5.3 Main Loop*

app_task_loop() is an empty implementation; this App does not require tasks to be executed in the main loop.

6. Usage*

6.1 Build*

# Use the hello_world configuration
cp configs/example/app/8006_hello_world_app.config .config
make defconfig
make clean; make

Or manually select via menuconfig:

make menuconfig
# OVP Application Settings → Applications Selection → Hello World

6.2 Flash and Run*

cd tools/bootx/
./flash_nor.sh 0 -r 1000000

7. Expected Output*

The serial port (921600 baud rate) outputs the following logs:

[APP_HELLO_WORLD] hello world!
[APP_HELLO_WORLD] hello world!
...

With the default configuration, approximately 25 lines are output per second.

8. Notes*

  1. OVP_APP structure is mandatory: Every App must define the OVP_APP structure and call the OVP_REGISTER_APP() macro for registration; otherwise, the framework cannot locate the App
  2. Fixed callback signatures: The callback function signatures must match those defined in ovp_app.h. Even unused callbacks must be provided with empty implementations
  3. Event-driven model: The main logic of the App should be placed in app_event_response() rather than polled in app_task_loop()
  4. Log TAG: The LOG_TAG macro defines the log prefix. It is recommended to use the [APP_XXX] format to distinguish between different Apps
  5. Suspend/Resume not implemented: The current SDK does not support the suspend feature. Keep app_suspend() and app_resume() as empty implementations