### Application Example Entry Point Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/ssl_server/readme.txt Select the SSL server example to compile within the app_example function. ```c void app_example(void) { example_ssl_server(); //example_ssl_server_mebdtls_dtls(); } ``` -------------------------------- ### Disable wifi connection in main.c setup() Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/project/realtek_amebapro2_v0_example/src/fast_inf_example/readme.txt Comment out the wifi connection code in setup() to disable wifi, as the example uses wlan tcp resume. ```C void setup(void) { #if 0 #if ENABLE_FAST_CONNECT wifi_fast_connect_enable(1); #else wifi_fast_connect_enable(0); #endif wlan_network(); #endif ... } ``` -------------------------------- ### Compile HTTPD example with GCC Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/httpd/readme.txt Use the make command to compile the httpd example. ```bash make all EXAMPLE=httpd ``` -------------------------------- ### Compile HTTP Client Example Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/http_client/readme.txt Use this command to compile the http_client example using GCC. ```bash make all EXAMPLE=http_client ``` -------------------------------- ### Compile wlan_scenario example with make Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/wlan_scenario/readme.txt GCC command to compile the wlan_scenario example. Use 'make all EXAMPLE=wlan_scenario'. ```bash make all EXAMPLE=wlan_scenario ``` -------------------------------- ### Build USB DFU OTA Example Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/usb_dfu_ota/readme.txt Use CMake to configure the project for the USB DFU OTA example. ```bash cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DEXAMPLE=usb_dfu_ota ``` -------------------------------- ### Configure and Build media_uvcd Example Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/media_uvcd/readme.txt Use this CMake command to configure the project for the media_uvcd example using the provided toolchain file. ```bash cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DEXAMPLE=media_uvcd ``` -------------------------------- ### Configure lwIP Example Application Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/lwip/lwip_v2.2.0/CMakeLists.txt Sets the lwIP directory and definitions, then adds the appropriate example application subdirectory based on the host operating system. ```cmake # Example lwIP application set(LWIP_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set (LWIP_DEFINITIONS LWIP_DEBUG=1) if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") add_subdirectory(${LWIP_DIR}/contrib/ports/win32/example_app) elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") add_subdirectory(${LWIP_DIR}/contrib/ports/unix/example_app) else() message(WARNING "Host ${CMAKE_SYSTEM_NAME} is not supported to build example_app") endif() ``` -------------------------------- ### Build and Flash USB MSC Example Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/usbh_msc_new/readme.txt Commands to build and flash the USB MSC host example project using CMake. ```bash cd project/realtek_amebapro2_v0_example/GCC-RELEASE mkdir build cd build cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake \ -Dusb_stack=new -DEXAMPLE=usbh_msc_new cmake --build . --target flash ``` -------------------------------- ### Build and flash command Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/wifi_roaming_plus/readme.txt Use this command to build and flash the example. ```bash cmake --build . --target flash ``` -------------------------------- ### Configure Platform-Specific Example Applications Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/lwip/lwip_v2.2.1/CMakeLists.txt Adds the appropriate example application subdirectory based on the host operating system. ```cmake if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") add_subdirectory(${LWIP_DIR}/contrib/ports/win32/example_app) elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") add_subdirectory(${LWIP_DIR}/contrib/ports/unix/example_app) else() message(WARNING "Host ${CMAKE_SYSTEM_NAME} is not supported to build example_app") endif() ``` -------------------------------- ### Compile MQTT Example with GCC Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/mqtt/readme.txt Use the provided make command to compile the MQTT example project. ```bash make all EXAMPLE=mqtt ``` -------------------------------- ### Compile Multicast Example with GCC Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/mcast/readme.txt Use the make command to compile the multicast example. ```bash make all EXAMPLE=mcast ``` -------------------------------- ### Compile HTTPC Example Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/httpc/readme.txt Use the make command to compile the HTTPC example for GCC. ```bash make all EXAMPLE=httpc ``` -------------------------------- ### Build project with CMake Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/project/realtek_amebapro2_v0_example/src/mmfv2_video_example/readme.txt Commands to configure and build the project with the video example enabled. ```bash cd project/realtek_amebapro2_v0_example/GCC-RELEASE mkdir build cd build cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DVIDEO_EXAMPLE=on cmake --build . --target flash ``` -------------------------------- ### Enable CONFIG_EXAMPLE_CJSON in platform_opts.h Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/cJSON/readme.txt Define the configuration macro to enable the cJSON example. ```c /* For cJSON example */ #define CONFIG_EXAMPLE_CJSON 1 ``` -------------------------------- ### Compile Broadcast Example with GCC Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/bcast/readme.txt Use the make command to compile the broadcast example. ```bash make all EXAMPLE=bcast ``` -------------------------------- ### Add example_cJSON to example_entry.c Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/cJSON/readme.txt Include the header and call the example function within the project entry point. ```c #if defined(CONFIG_EXAMPLE_CJSON) && CONFIG_EXAMPLE_CJSON #include #endif void example_entry(void) { #if defined(CONFIG_EXAMPLE_CJSON) && CONFIG_EXAMPLE_CJSON example_cJSON(); #endif } ``` -------------------------------- ### Expected KVS WebRTC startup log Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/kvs_webrtc_mmf/readme.md If everything works fine, you should see this log output. It shows the WiFi connection, KVS example start, WebRTC initialization, signaling client state changes, and successful connection. ```text ... wifi connected wifi connected === KVS Example Start === [KVS WebRTC module]: webrtc branch name = webrtc-on-freertos-wss-0323-R [KVS WebRTC module]: webrtc commit hash = c5f1ee6763ede84a1b33e75665dbfdc9b1e69237 [KVS WebRTC module]: waiting get epoch timer vfs_mutex init fatfs register sd mount Register disk driver to Fatfs. FATFS Register: disk driver 0 SD_Init 0 part_count = 0 [WebRTC] Starting initializing the app with channel(webrtc_iot_thing) Difference between current time and iot expiration is 3599 Iot credential expiration time 1649404892 The number of threads: (1/1) AUDIO_OPUS The intialization of the media source is completed successfully The initialization of WebRTC is completed successfully Creating Signaling Client Sync The number of threads: (2/2) The thread of handling msg is up Signaling client state changed to 1 - 'New' Signaling client state changed to 2 - 'Get Security Credentials' Difference between current time and iot expiration is 3600 Iot credential expiration time 1649404894 Signaling client state changed to 3 - 'Describe Channel' Skip the call of describing the channel Signaling client state changed to 5 - 'Get Channel Endpoint' Skip the call of getting the endpoint Signaling client state changed to 6 - 'Get ICE Server Configuration' The expiration of ice config: 16494015659528950, ttl: 300 Signaling client state changed to 7 - 'Ready' Signaling client created successfully Signaling Client Connect Sync Signaling client state changed to 8 - 'Connecting' The number of threads: (3/3) Wss client is up Signaling client state changed to 9 - 'Connected' The bootup time of webrtc is 5367 ms wss ping ==> <== wss pong ... ``` -------------------------------- ### Build and Flash USB UVC Example Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/usbd_uvc_new/readme.txt Commands to build and flash the usbd_uvc_new example to the AmebaPro2 hardware using CMake. ```bash cd project/realtek_amebapro2_v0_example/GCC-RELEASE mkdir build cd build cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake \ -Dusb_stack=new -DEXAMPLE=usbd_uvc_new cmake --build . --target flash ``` -------------------------------- ### Compile Nonblocking Connect Example Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/nonblock_connect/readme.txt Use the make command with the EXAMPLE flag to compile the nonblocking connect project for GCC. ```bash make all EXAMPLE=nonblock_connect ``` -------------------------------- ### Build EAP Example for RTL8735B Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/eap/readme.txt Use CMake to build the EAP example and flash it to the target device. ```bash cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DEXAMPLE=eap cmake --build . --target flash ``` -------------------------------- ### Build commands for AmebaPro2 Helix MP3 example Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/audio_helix_mp3/README.txt Commands to build the Helix MP3 example for AmebaPro2. Create a build directory, then run cmake with the appropriate toolchain and example name, and finally build the flash target. ```bash mkdir build ``` ```bash TZ version: cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DEXAMPLE=audio_helix_mp3 -DBUILD_TZ=on NTZ version:cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DEXAMPLE=audio_helix_mp3 -DBUILD_TZ=off ``` ```bash cmake --build . --target flash ``` -------------------------------- ### Enable CONFIG_EXAMPLE_OTA_HTTP in platform_opts.h Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/ota_http/readme.txt Enable the OTA HTTP example feature by defining the configuration macro in the platform options header. ```c /* For http ota update example */ #define CONFIG_EXAMPLE_OTA_HTTP 1 ``` -------------------------------- ### Add example_ota_http to example_entry.c Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/ota_http/readme.txt Register the OTA HTTP example function in the application entry point. ```c #if CONFIG_EXAMPLE_OTA_HTTP #include #endif void example_entry(void) { #if CONFIG_EXAMPLE_OTA_HTTP example_ota_http(); #endif } ``` -------------------------------- ### Build the project Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/kvs_producer_mmf/readme.md Commands to build the AmebaPro2 image with the kvs_producer_mmf example. ```bash cd project/realtek_amebapro2_v0_example/GCC-RELEASE mkdir build cd build cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DEXAMPLE=kvs_producer_mmf cmake --build . --target flash ``` -------------------------------- ### Add cJSON example source to GCC Makefile Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/cJSON/readme.txt Add the cJSON example source file to the example Makefile for GCC projects. ```makefile CSRC += $(DIR)/cJSON/example_cJSON.c ``` -------------------------------- ### Build FATFS Example for AmebaPro2 Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/fatfs/readme.TXT Use the cmake command to build the FATFS example for the AmebaPro2 platform. ```bash -DEXAMPLE=fatfs ``` -------------------------------- ### Configure video parameters in example_kvs_webrtc_mmf.c Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/kvs_webrtc_mmf/readme.md Set the video resolution, frame rate, GOP, and bitrate in the example source file. ```c ... #define V1_RESOLUTION VIDEO_HD #define V1_FPS 30 #define V1_GOP 30 #define V1_BPS 1024*1024 ``` -------------------------------- ### Compile SNTP Showtime Example Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/sntp_showtime/readme.txt Use the provided make command to compile the sntp_showtime example for GCC. ```bash make all EXAMPLE=sntp_showtime ``` -------------------------------- ### Build the Project Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/kvs_webrtc_v2_mmf/readme.md Commands to build the project image with the KVS WebRTC v2 MMF example. ```bash cd project/realtek_amebapro2_v0_example/GCC-RELEASE mkdir build cd build cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DEXAMPLE=kvs_webrtc_v2_mmf cmake --build . --target flash -j4 ``` -------------------------------- ### Build Configuration for media_video_to_storage Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/media_video_to_storage/readme.txt Use this CMake command to configure the project for the media_video_to_storage example. ```bash cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DEXAMPLE=media_video_to_storage ``` -------------------------------- ### Example call to add a web service Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/lwip/lwip_v2.1.2/doc/mdns.txt Example call to publish a web server on port 80. It publishes myweb._http._tcp.local and points to .local:80. ```c mdns_resp_add_service(netif, "myweb", "_http" DNSSD_PROTO_TCP, 80, 3600, srv_txt, NULL); ``` -------------------------------- ### Enable Helix MP3 example in platform_opts.h Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/audio_helix_mp3/README.txt Enables the Helix MP3 example on other platforms by setting CONFIG_EXAMPLE_AUDIO_HELIX_MP3 to 1 in platform_opts.h. ```c #define CONFIG_EXAMPLE_AUDIO_HELIX_MP3 1 ``` -------------------------------- ### Build and Flash Commands Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/usbd_hid_new/readme.txt Commands to build and flash the USB HID mouse example project on AmebaPro2. ```bash cd project/realtek_amebapro2_v0_example/GCC-RELEASE mkdir build cd build cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake \ -Dusb_stack=new -DEXAMPLE=usbd_hid_new cmake --build . --target flash ``` -------------------------------- ### Build and Flash USBH_UVC Example Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/usbh_uvc_new/readme.txt Commands to build and flash the default RGB mode application for the AmebaPro2. ```bash cd project/realtek_amebapro2_v0_example/GCC-RELEASE mkdir build cd build cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake \ -Dusb_stack=new -DEXAMPLE=usbh_uvc_new cmake --build . --target flash ``` -------------------------------- ### Build SQLite demo with CMake Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/sqlite/readme.txt Commands to navigate to the build directory, configure the project with the SQLite example enabled, and compile the firmware. ```bash cd project/realtek_amebapro2_v0_example/GCC-RELEASE mkdir build cd build cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DEXAMPLE=sqlite make flash -j4 ``` -------------------------------- ### Build Fmp4 demo Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/media_fmp4/readme.txt Commands to build the fmp4 example project using CMake. ```bash cd project/realtek_amebapro2_v0_example/GCC-RELEASE mkdir build cd build cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DEXAMPLE=media_fmp4 make flash -j4 ``` -------------------------------- ### Comment out wifi_fast_connect_enable(1) in wlan_initialize() Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/wifi_roaming_plus/readme.txt Required setup step: comment out this line in wlan_initialize() to enable fast connection for roaming. ```c wifi_fast_connect_enable(1); ``` -------------------------------- ### Build SDK for Media WebSocket Viewer Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/media_websocket_viewer/readme.txt Use CMake and make to build the SDK with the media_websocket_viewer example enabled. ```bash cmake ../ -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DEXAMPLE=media_websocket_viewer make -j4 flash ``` -------------------------------- ### Build and flash usbd_msc_new in SD card mode Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/usbd_msc_new/readme.txt Builds the example with the new USB stack and SD card backend. Requires an SD card connected to the DEV board. Run from project/realtek_amebapro2_v0_example/GCC-RELEASE. ```shell cd project/realtek_amebapro2_v0_example/GCC-RELEASE mkdir build cd build cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake \ -Dusb_stack=new -DEXAMPLE=usbd_msc_new cmake --build . --target flash ``` -------------------------------- ### Add Broadcast Example to GCC Makefile Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/bcast/readme.txt Include the broadcast example source file in the GCC project Makefile. ```makefile CSRC += $(DIR)/bcast/example_bcast.c ``` -------------------------------- ### Build and Flash Commands Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/usbh_uvc_new/README.md Commands to configure and build the usbh_uvc_new example using the GCC toolchain. ```bash cd project/realtek_amebapro2_v0_example/GCC-RELEASE/build cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DEXAMPLE=usbh_uvc_new cmake --build . --target flash ``` -------------------------------- ### Initiate PPP server listener Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/lwip/lwip_v2.1.2/doc/ppp.txt Configures server-side IP settings, authentication, and starts the listener for incoming connections. ```c ip4_addr_t addr; IP4_ADDR(&addr, 192,168,0,1); ppp_set_ipcp_ouraddr(ppp, &addr); IP4_ADDR(&addr, 192,168,0,2); ppp_set_ipcp_hisaddr(ppp, &addr); IP4_ADDR(&addr, 192,168,10,20); ppp_set_ipcp_dnsaddr(ppp, 0, &addr); IP4_ADDR(&addr, 192,168,10,21); ppp_set_ipcp_dnsaddr(ppp, 1, &addr); ppp_set_auth(ppp, PPPAUTHTYPE_ANY, "login", "password"); ppp_set_auth_required(ppp, 1); ppp_set_silent(pppos, 1); ppp_listen(ppp); ``` -------------------------------- ### MOUSE Console Command Examples Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/usbd_composite_msc_hid_new/readme.txt Examples of the MOUSE command used to control the HID mouse interface after USB enumeration. ```text MOUSE=0,0,0,50,0,0 (move cursor right 50 pixels) MOUSE=1,0,0,0,0,0 (left button press) MOUSE=0,0,0,0,0,0 (release all buttons) ``` -------------------------------- ### Build and flash commands for usbh_composite_cdc_acm_ecm_new Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/usbh_composite_cdc_acm_ecm_new/readme.txt Commands to build and flash the example using CMake with the new USB stack and the example name. Run from the GCC-RELEASE directory. ```shell cd project/realtek_amebapro2_v0_example/GCC-RELEASE mkdir build cd build cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake \ -Dusb_stack=new -DEXAMPLE=usbh_composite_cdc_acm_ecm_new cmake --build . --target flash ``` -------------------------------- ### Start TCP client for testing Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/socket_tcp_trx/readme.txt Use the iperf command to connect to the TCP server and initiate bidirectional transmission. ```bash iperf -c -d -i 1 ``` -------------------------------- ### Enable Helix AAC example in platform_opts.h Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/audio_helix_aac/README.txt Enable the Helix AAC example configuration for platforms other than AmebaPro2. ```c #define CONFIG_EXAMPLE_AUDIO_HELIX_AAC 1 ``` -------------------------------- ### Compile TCP Keepalive Example Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/tcp_keepalive/readme.txt Use the provided make command to compile the TCP keepalive example for GCC. ```bash make all EXAMPLE=tcp_keepalive ``` -------------------------------- ### Build AmebaPro2 with CMake Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/ota_http/readme.txt Configure the build system for AmebaPro2 to include the OTA HTTP example. ```bash cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DEXAMPLE=ota_http ``` -------------------------------- ### MQTT Client Storage Allocation Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/lwip/lwip_v2.2.1/doc/mqtt_client.txt Examples for allocating MQTT client storage using either static or dynamic methods. ```c Static allocation: mqtt_client_t static_client; example_do_connect(&static_client); Dynamic allocation: mqtt_client_t *client = mqtt_client_new(); if(client != NULL) { example_do_connect(&client); } ``` -------------------------------- ### Build and flash usbd_msc_new in RAM disk mode Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/usbd_msc_new/readme.txt Builds the example with the new USB stack and RAM disk backend by adding -DUSBD_MSC_SD_MODE=OFF. No SD card is required; useful for quick functional verification. ```shell cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake \ -Dusb_stack=new -DEXAMPLE=usbd_msc_new -DUSBD_MSC_SD_MODE=OFF cmake --build . --target flash ``` -------------------------------- ### Select TCP transmission example in app_example Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/socket_tcp_trx/readme.txt Modify the app_example function to choose between the two available TCP transmission implementations. ```c void app_example(void) { example_socket_tcp_trx_1(); //example_socket_tcp_trx_2(); } ``` -------------------------------- ### MOUSE Console Command Examples Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/usbd_hid_new/readme.txt Examples of the MOUSE command used to control cursor movement and button states via the serial console. ```text MOUSE=0,0,0,50,0,0 (move cursor right 50 pixels) MOUSE=1,0,0,0,0,0 (left button press) MOUSE=0,0,0,0,0,0 (release all buttons) MOUSE=0,0,0,0,0,5 (scroll wheel up) ``` -------------------------------- ### Configure WiFi connection via UART commands Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/kvs_webrtc_mmf/readme.md While running the example, configure WiFi connection using these commands in the UART terminal. ATW0 sets the SSID, ATW1 sets the password, and ATWC initiates the connection. ```text ATW0= : Set the WiFi AP to be connected ATW1= : Set the WiFi AP password ATWC : Initiate the connection ``` -------------------------------- ### Define Flash Application Base Address Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/fatfs/readme.TXT Example of defining the starting address for the FATFS region on flash memory. ```c #define FLASH_APP_BASE 0x180000 ``` ```c #define FLASH_APP_BASE (0x200000 - 0xA9000) ``` -------------------------------- ### usbh_uvc_stream_on Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/usbh_uvc_new/README.md Starts isochronous video streaming. ```APIDOC ## usbh_uvc_stream_on ### Description Starts isochronous video streaming. ### Method Function Call ### Signature `int usbh_uvc_stream_on(void)` ### Parameters None ### Returns - **int** - Status code indicating success or failure. ``` -------------------------------- ### Generate Makefiles with CMake Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/nn_file_tester/readme.txt Run the cmake command to generate build files for the nn_file_tester example. ```bash cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DEXAMPLE=nn_file_tester ``` -------------------------------- ### Build command for media_mp4_demuxer Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/media_mp4_demuxer/readme.txt Use this CMake command to configure the build for the media_mp4_demuxer example with the provided toolchain file. ```bash cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DEXAMPLE=media_mp4_demuxer ``` -------------------------------- ### Build and Flash USB CDC ECM Host Example Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/usbh_cdc_ecm_new/readme.txt Commands to build and flash the USB CDC ECM host application on the AmebaPro2 development board. ```bash cd project/realtek_amebapro2_v0_example/GCC-RELEASE mkdir build cd build cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake \ -Dusb_stack=new -DEXAMPLE=usbh_cdc_ecm_new cmake --build . --target flash ``` -------------------------------- ### Build KVS WebRTC MMF example with cmake Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/kvs_webrtc_mmf/readme.md Run these commands to build the image with the -DEXAMPLE=kvs_webrtc_mmf option. The commands create a build directory, configure with cmake, and build the flash target. ```bash cd project/realtek_amebapro2_v0_example/GCC-RELEASE mkdir build cd build cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DEXAMPLE=kvs_webrtc_mmf cmake --build . --target flash ``` -------------------------------- ### CMake Build Command for RTL8735B Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/ssl_server/readme.txt Command to configure the build system for the SSL server example on RTL8735B. ```bash cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DEXAMPLE=ssl_server ``` -------------------------------- ### Establish MQTT connection with mqtt_client_connect Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/lwip/lwip_v2.2.0/doc/mqtt_client.txt Defines example_do_connect() which sets up a client info structure, sets the client identifier, and calls mqtt_client_connect(). If the call fails immediately, the error code is printed. Connection can be probed with mqtt_client_is_connected(). ```c void example_do_connect(mqtt_client_t *client) { struct mqtt_connect_client_info_t ci; err_t err; /* Setup an empty client info structure */ memset(&ci, 0, sizeof(ci)); /* Minimal amount of information required is client identifier, so set it here */ ci.client_id = "lwip_test"; /* Initiate client and connect to server, if this fails immediately an error code is returned otherwise mqtt_connection_cb will be called with connection result after attempting to establish a connection with the server. For now MQTT version 3.1.1 is always used */ err = mqtt_client_connect(client, ip_addr, MQTT_PORT, mqtt_connection_cb, 0, &ci); /* For now just print the result code if something goes wrong */ if(err != ERR_OK) { printf("mqtt_connect return %d\n", err); } } ``` -------------------------------- ### Expected KVS producer log output Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/kvs_producer_mmf/readme.md Example log output indicating successful initialization and media streaming to KVS. ```text ... Interface 0 IP address : xxx.xxx.xxx.xxx WIFI initialized ... [H264] init encoder [ISP] init ISP ... PUT MEDIA endpoint: s-xxxxxxxx.kinesisvideo.us-east-1.amazonaws.com Try to put media Info: 100-continue Info: Fragment buffering, timecode:1620367399995 Info: Fragment received, timecode:1620367399995 Info: Fragment buffering, timecode:1620367401795 Info: Fragment persisted, timecode:1620367399995 Info: Fragment received, timecode:1620367401795 Info: Fragment buffering, timecode:1620367403595 ... ``` -------------------------------- ### Expected Serial Output Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/usbh_uvc_new/README.md Example of the serial console output when the UVC demo is running and saving images to the SD card. ```text [UVC] USB host uvc demo started... UVC init USB physical connected UVC attach Set UVC parameters UVC para: 320*240@15fps UVC stream on Create image file: 0:/img0.yuy2 Write 153600 bytes Create image file: 0:/img1.yuy2 Write 153600 bytes ... Reached 200 images, stopping capture ``` -------------------------------- ### Correct UVC Streaming Loop Implementation Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/usbh_uvc_new/README.md Demonstrates the proper sequence for initializing, starting the stream once, continuously capturing frames, and performing cleanup. ```c // Initialise usbh_uvc_init(&uvc_cb); usbh_uvc_set_param(&uvc_ctx); // Stream ON once (NOT per-frame) usbh_uvc_stream_on(); rtw_mdelay_os(500); // allow camera to warm up // Continuous capture while (connected) { uvc_frame *frame = usbh_uvc_get_frame(); if (frame == NULL) { rtw_mdelay_os(100); continue; } process(frame); usbh_uvc_put_frame(frame); } // Cleanup usbh_uvc_stream_off(); usbh_uvc_deinit(); ``` -------------------------------- ### Initialize and Configure mDNS on a Network Interface Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/lwip/lwip_v2.2.0/doc/mdns.txt Functions to initialize the mDNS responder and add a network interface to start responding to queries. ```c mdns_resp_init(); mdns_resp_add_netif(struct netif *netif, const char *hostname); ``` -------------------------------- ### Build AmebaPro2 Amazon FreeRTOS with GCC Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/amazon_freertos/AmebaPro2_Amazon_FreeRTOS_Getting_Started_Guide_v1.3.pdf Commands to build the image with the amazon_freertos example. Run from the GCC-RELEASE directory. After a successful build, the image file flash_ntz.bin is located in the build/ directory. ```bash cd project/realtek_amebapro2_v0_example/GCC-RELEASE mkdir build cd build cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DEXAMPLE=amazon_freertos cmake --build. --target flash -j4 ``` -------------------------------- ### Build project steps Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/project/realtek_amebapro2_v0_example/GCC-RELEASE/Readme.md Standard sequence of commands to build the project from the target directory. ```bash mkdir build ``` ```bash cd build ``` ```bash cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../../toolchain.cmake -DBUILD_FPGA=ON -DBUILD_PXP=OFF ``` ```bash cmake --build . ``` -------------------------------- ### Select NN Tester in example_nn_file_tester.c Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/nn_file_tester/readme.txt Uncomment the specific initialization function for the desired NN tester in example_nn_file_tester.c. ```c // object detection nn tester mmf2_example_vipnn_objectdet_test_init(); // face detection nn tester //mmf2_example_vipnn_facedet_test_init(); // face recognition nn tester //mmf2_example_vipnn_facerecog_test_init(); ``` -------------------------------- ### TXT callback example for MDNS service Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/lwip/lwip_v2.1.2/doc/mdns.txt Example callback method for adding TXT items to an MDNS service reply. The callback calls mdns_resp_add_service_txtitem() to add strings. Each item can be max 63 bytes, and total max length is 255 bytes. ```c static void srv_txt(struct mdns_service *service, void *txt_userdata) { res = mdns_resp_add_service_txtitem(service, "path=/", 6); LWIP_ERROR("mdns add service txt failed\n", (res == ERR_OK), return); } ``` -------------------------------- ### Initiate PPP client connection Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/lwip/lwip_v2.1.2/doc/ppp.txt Configures basic client settings and initiates the PPP negotiation process. ```c ppp_set_default(ppp); ppp_set_usepeerdns(ppp, 1); ppp_set_auth(ppp, PPPAUTHTYPE_ANY, "login", "password"); u16_t holdoff = 0; ppp_connect(ppp, holdoff); ``` -------------------------------- ### Compile command for RTL8735B Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/wifi_roaming_plus/readme.txt Use this cmake command to compile the example for RTL8735B. ```bash cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DEXAMPLE=wifi_roaming_plus ``` -------------------------------- ### AmebaD Makefile Configuration Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/media_framework/readme.txt Required Makefile modifications for MMF audio examples and libraries. ```makefile @make -C media all ``` ```makefile # MMF AUDIO EXAMPLE CSRC += $(DIR)/media_framework/example_media_framework.c CSRC += $(DIR)/media_framework/mmf2_example_audioloop_init.c CSRC += $(DIR)/media_framework/mmf2_example_pcmu_array_rtsp_init.c CSRC += $(DIR)/media_framework/mmf2_example_aac_array_rtsp_init.c CSRC += $(DIR)/media_framework/mmf2_example_a_init.c CSRC += $(DIR)/media_framework/mmf2_example_rtp_aad_init.c CSRC += $(DIR)/media_framework/mmf2_example_2way_audio_init.c CSRC += $(DIR)/media_framework/mmf2_example_aacloop_init.c CSRC += $(DIR)/media_framework/mmf2_example_g711loop_init.c ``` ```makefile # MMF LIBRARY LINK_APP_LIB += $(ROOTDIR)/lib/application/lib_rtsp.a LINK_APP_LIB += $(ROOTDIR)/lib/application/lib_g711.a LINK_APP_LIB += $(ROOTDIR)/lib/application/lib_speex.a LINK_APP_LIB += $(ROOTDIR)/lib/application/lib_haac.a LINK_APP_LIB += $(ROOTDIR)/lib/application/lib_faac.a LINK_APP_LIB += $(ROOTDIR)/lib/application/lib_cmsis_dsp.a ``` ```makefile # MMF LIBRARY @make -C make/audio/g711 all @make -C make/audio/faac all @make -C make/audio/haac all @make -C make/audio/speex all @make -C make/network/rtsp all @make -C make/cmsis-dsp all ``` -------------------------------- ### Build Project using CMD.exe Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/project/realtek_amebapro2_v0_example/GCC-RELEASE/Readme.md Standard sequence of commands to initialize and build the project on Windows. ```bash mkdir build cd build cmake .. -G"Ninja" -DCMAKE_TOOLCHAIN_FILE=../../toolchain.cmake -DBUILD_FPGA=ON -DBUILD_PXP=OFF cmake --build . ``` -------------------------------- ### MOUSE Command Execution Result Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/usbd_hid_new/readme.txt Example output on the serial console after executing a MOUSE command. ```text MOUSE=0,0,0,50,0,0 [HID-I] MOUSE: buttons=f8 x=50 y=0 wheel=0, ret=0 (ret=0: success) ``` -------------------------------- ### Configure 12M Sensor and FCS Bootup in sensor.h Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/project/realtek_amebapro2_v0_example/scenario/ai_glass/Readme.md Modify the sensor ID array, set the active sensor, define the manual IQ path, and enable FCS bootup. ```c static const unsigned char sen_id[SENSOR_MAX] = { SENSOR_DUMMY, SENSOR_IMX681, SENSOR_IMX681_12M, SENSOR_IMX681_12M_SEQ, }; #define USE_SENSOR SENSOR_IMX681 static const char manual_iq[SENSOR_MAX][64] = { "iq", "iq_imx681", "iq_imx681_12m", "iq_imx681_12m_seq", }; #define ENABLE_FCS 1 ``` -------------------------------- ### Configure aws_demo_config.h Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/amazon_freertos/readme.md Enable the desired AWS IoT demo by uncommenting the corresponding macro in aws_demo_config.h. ```c //#define CONFIG_CORE_HTTP_MUTUAL_AUTH_DEMO_ENABLED #define CONFIG_CORE_MQTT_MUTUAL_AUTH_DEMO_ENABLED //#define CONFIG_DEVICE_SHADOW_DEMO_ENABLED //#define CONFIG_JOBS_DEMO_ENABLED ``` -------------------------------- ### Add Network Interface for mDNS Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/lwip/lwip_v2.2.1/doc/mdns.txt Start responding to mDNS requests on a specific network interface. ```c mdns_resp_add_netif(struct netif *netif, const char *hostname) ``` -------------------------------- ### Build and Flash for SD Card Mode Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/usbd_composite_msc_hid_new/readme.txt Commands to build and flash the project using the default SD card mode. ```bash cd project/realtek_amebapro2_v0_example/GCC-RELEASE mkdir build cd build cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake \ -Dusb_stack=new -DEXAMPLE=usbd_composite_msc_hid_new cmake --build . --target flash ``` -------------------------------- ### Register an mDNS Service Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/lwip/lwip_v2.2.0/doc/mdns.txt Example call to register a web server service on an mDNS-enabled network interface. ```c mdns_resp_add_service(netif, "myweb", "_http" DNSSD_PROTO_TCP, 80, srv_txt, NULL); ``` -------------------------------- ### CMake Project Initialization and Configuration Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/project/realtek_amebapro2_v0_example/GCC-RELEASE/application/CMakeLists.txt Initializes the CMake project, sets root paths, and includes necessary configuration and application files. ```cmake cmake_minimum_required(VERSION 3.6) project(app_tz) # root of realtek_amebapro2_v0_example set (prj_root "${CMAKE_CURRENT_SOURCE_DIR}/../..") # root of SDK set (sdk_root "${CMAKE_CURRENT_SOURCE_DIR}/../../../..") set(app_ntz application.ntz) message(STATUS "Build libraries ${BUILD_LIB}") message(STATUS "Build FPGA ${BUILD_FPGA}") message(STATUS "Build PXP ${BUILD_PXP}") include(../config.cmake) include(../sensor_iq.cmake) if(BUILD_TZ) include(./application_s.cmake) endif() include(./application.cmake) ``` -------------------------------- ### Build and Flash for SD Card Mode Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/usbd_composite_cdc_acm_msc_new/readme.txt Commands to build and flash the project for the default SD card mode. ```bash cd project/realtek_amebapro2_v0_example/GCC-RELEASE mkdir build cd build cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake \ -Dusb_stack=new -DEXAMPLE=usbd_composite_cdc_acm_msc_new cmake --build . --target flash ``` -------------------------------- ### Configure AmebaD PSRAM Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/media_framework/readme.txt Example configuration for PSRAM settings in rtl8721dhp_intfcfg.c required for AAC and AAD modules. ```c PSRAMCFG_TypeDef psram_dev_config = { .psram_dev_enable = TRUE, //enable psram .psram_dev_cal_enable = FALSE, //enable psram calibration function .psram_dev_retention = FALSE, //enable psram retention .psram_heap_start_address = 0x02020000, // MMF example using AAC module require more than 0x10008 bytes bss section. .psram_heap_size = 0x400000-0x20000, // Therefore, heap size for MMF example should be 0x400000-0x20000 }; ``` -------------------------------- ### Expected Execution Log Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/kvs_webrtc_v2_mmf/readme.md The expected log output when the KVS WebRTC v2 example is running correctly. ```text ... [INFO][kvs_webrtc_: kvs_webrtc_v2_main_thread: 140] [KVS WebRTC v2 module]: === KVS WebRTC V2 Start === [INFO][MasterTask: Master_Task: 171] Start Master_Task. [INFO][kvs_webrtc_: kvs_webrtc_v2_main_thread: 142] [KVS WebRTC v2 module]: kvs_webrtc_master_entry called, master task created [video_init] uvcd iq is null, use default. [video_init] uvcd SNR is null, use default. IQ:FW size (76042) sensor:date 2024/9/12 version:RTL8735B_VOE_1.5.7.0 sensor:FW size (3996) sensor timestamp: 2024/09/12 iq timestamp: 0000/00/00 00:00:00 voe_heap malloc 0x708936e0, size 11124480 ISP:1 ENC:1 H265:1 NN:1 hal_voe_ready 0x0 0xbf1208 voe :RTL8735B_VOE_1.6.9.0 sensor:RTL8735B_VOE_1.5.7.0 hal :RTL8735B_VOE_1.6.9.0 load time sensor:52us iq:966us itcm:0us dtcm:0us ddr:0us ddr2:0us rc_version RC_v1 [video_pre_init_procedure] START hal_voe_send2voe too long 50816 cmd 0x00000206 p1 0x00000000 p2 0x00000000 set ASP print off [INFO][MasterTask: platform_init: 172] waiting get epoch timer [INFO][MasterTask: AppMediaSourcePort_Init: 34] [WebRTC Port] AppMediaSourcePort_Init called. Hardware is ready. [INFO][SigControll: DescribeSignalingChannel: 642] Describing Signaling Channel. [INFO][SigControll: tlsHandshake: 593] (Network connection 0x704b9778) TLS handshake successful. [INFO][SigControll: GetSignalingChannelEndpoints: 745] Getting Signaling Channel Endpoints. [Driver]: TSFValue = 75274143411, tsf = 0, shift_set= 0x8000, bcn int = 100 ``` -------------------------------- ### Initialize CMake Project and Paths Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/project/realtek_amebapro2_v0_example/GCC-RELEASE/CMakeLists.txt Sets the minimum required CMake version, project name, and defines root paths for the project and SDK. ```cmake cmake_minimum_required(VERSION 3.6) project(flash_bin) # root of realtek_amebapro2_v0_example set (prj_root "${CMAKE_CURRENT_SOURCE_DIR}/..") # root of SDK set (sdk_root "${CMAKE_CURRENT_SOURCE_DIR}/../../..") include(./config.cmake) ``` -------------------------------- ### Updating Filename Extensions for UVC Formats Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/usbh_uvc_new/README.md Example of updating the filename extension in uvc_fatfs_thread() when changing the video format. ```c snprintf(filename, sizeof(filename), "img%d.jpg", ...); // MJPEG snprintf(filename, sizeof(filename), "img%d.yuy2", ...); // YUY2 ``` -------------------------------- ### Build for RAM Model Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/project/realtek_amebapro2_v0_example/GCC-RELEASE/Readme.md Commands to configure and build the project specifically for FPGA or PXP simulation. ```bash mkdir build && cd build cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../../toolchain.cmake cmake --build . ``` -------------------------------- ### Static Memory Allocation for MQTT Client Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/lwip/lwip_v2.1.2/doc/mqtt_client.txt Demonstrates how to allocate memory for an MQTT client statically. ```c mqtt_client_t static_client; example_do_connect(&static_client); ``` -------------------------------- ### Configure HTTP/HTTPS mode in example_httpd.c Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/httpd/readme.txt Modify the USE_HTTPS macro in example_httpd.c to toggle between HTTP and HTTPS modes. ```c #define USE_HTTPS 0 //for HTTP #define USE_HTTPS 1 //for HTTPS ``` -------------------------------- ### Build the project using CMake Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/project/realtek_amebapro2_v0_example/src/nn_post_process_pc_dev_tool/readme.txt Commands to create a build directory, configure the project with CMake, and compile the executable. ```bash mkdir build && cd build cmake .. -G"Unix Makefiles" make -j4 ``` -------------------------------- ### Custom Port Configuration Error Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/os/freertos/freertos_v202604.00/Source/CMakeLists.txt Error message and example structure for defining a custom FreeRTOS port when A_CUSTOM_PORT is selected. ```cmake message(FATAL_ERROR " FREERTOS_PORT is set to A_CUSTOM_PORT. Please specify the custom port target with all necessary files. For example:\n" " Assuming a directory of:\n" " FreeRTOSCustomPort/\n" " CMakeLists.txt\n" " port.c\n" " portmacro.h\n" " Where FreeRTOSCustomPort/CMakeLists.txt is a modified version of:\n" " add_library(freertos_kernel_port OBJECT)\n" " target_sources(freertos_kernel_port\n" " PRIVATE\n" " port.c\n" " portmacro.h)\n" " add_library(freertos_kernel_port_headers INTERFACE)\n" " target_include_directories(freertos_kernel_port_headers INTERFACE \n" " .)\n" " target_link_libraries(freertos_kernel_port\n" " PRIVATE\n" " freertos_kernel_port_headers\n" " freertos_kernel_include") ``` -------------------------------- ### Execute DFU Update Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/usb_dfu_ota/readme.txt Use dfu-util to flash the ota.bin file to the device. ```bash dfu-util.exe -d 1d6b:0202 -a 0 -D ota.bin ``` -------------------------------- ### Example TXT Record Callback Function Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/lwip/lwip_v2.2.0/doc/mdns.txt A callback function used to add TXT records to an mDNS service response. ```c static void srv_txt(struct mdns_service *service, void *txt_userdata) { res = mdns_resp_add_service_txtitem(service, "path=/", 6); LWIP_ERROR("mdns add service txt failed\n", (res == ERR_OK), return); } ``` -------------------------------- ### Build and Flash for RAM Disk Mode Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/usbd_composite_msc_hid_new/readme.txt Commands to build and flash the project using the RAM disk backend instead of an SD card. ```bash cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake \ -Dusb_stack=new -DEXAMPLE=usbd_composite_msc_hid_new \ -DUSBD_MSC_SD_MODE=OFF cmake --build . --target flash ``` -------------------------------- ### Dynamic Memory Allocation for MQTT Client Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/lwip/lwip_v2.1.2/doc/mqtt_client.txt Demonstrates how to allocate memory for an MQTT client dynamically using mqtt_client_new(). ```c mqtt_client_t *client = mqtt_client_new(); if(client != NULL) { example_do_connect(&client); } ``` -------------------------------- ### Configure server port Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/socket_tcp_trx/readme.txt Define the listening port for the TCP server by modifying the SERVER_PORT macro in the example source files. ```c #define SERVER_PORT 5001 ``` -------------------------------- ### Navigate to source directory Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/example/amazon_freertos/readme.md Change the current working directory to the project source folder. ```bash cd project/realtek_amebapro2_v0_example/src ``` -------------------------------- ### Create a PPPoE interface Source: https://github.com/ameba-aiot/ameba-rtos-pro2/blob/main/component/lwip/lwip_v2.1.2/doc/ppp.txt Initializes a new PPPoE session using an existing Ethernet interface. ```c #include "netif/ppp/pppoe.h" ppp = pppoe_create(&ppp_netif, ðif, service_name, concentrator_name, status_cb, ctx_cb); ```