Introduction
There are two kinds of examples in the SDK of RTL8721Dx:
application examples
peripheral examples
This chapter illustrates the contents of examples and how to build example source code. The path and description of SDK examples are listed in following table.
Items |
Path |
Description |
---|---|---|
Application example |
{SDK}\component\example |
xml, ssl, … |
Peripheral example |
{SDK}\component\example\peripheral |
ADC, UART, I2C, SPI, Timer, … |
Application Example
In each folder of application example, there are C source files, header files and README.txt
.
You should check for detailed configurations of the example according to README.txt
.
Note
The application examples are shared by all Realtek SoC, so you need to refer to README.txt
for detailed information of RTL8721Dx.
The application examples normally run on KM4. The entry function of application example is app_example()
in main.c
under {SDK}\amebadplus_gcc_project\project_km4\src
.
Each application example has its own app_example()
, and app_example()
in main.c
will be replaced automatically when the application example is built.
// default main
int main(void)
{
...
app_example();
...
/* enable schedule, start kernel */
vTaskStartSchedule();
}
To run application example, you only need to:
Check software and hardware settings in
README.txt
of the example.Add compile options
EXAMPLE={examplefolder name}
when building the project, and replace{example folder name}
with the specific folder name of this example.
For example, if you want to build xml example to start an xml example thread, you need to set the macro in SDK according to README.txt
in {SDK}\component\example\xml
, then enter make EXAMPLE=xml
for KM4 on MSYS2 MinGW 64-bit (Windows) or terminal (Linux).

Building XML application example
Peripheral Example
The peripheral examples are demos of peripherals. Most examples consist of raw and mbed folders, you can choose raw or mbed demos as you like.
Items |
Path |
Description |
---|---|---|
mbed |
{SDK}\component\example\peripheral\{peripheral}\mbed |
mbed APIs are used. |
raw |
{SDK}\component\example\peripheral\{peripheral}\raw |
Low-level driver APIs are used. |
Each example folder has main.c
and README.txt
. There are example descriptions, required components, HW connection and expected behavior in README.txt
.
The peripheral examples normally run on KM4. To run peripheral examples, you only need to:
Check software and hardware settings in
README.txt
of the example.Replace the original
main.c
under{SDK}\amebadplus_gcc_project\project_km4\src
withmain.c
in the example directory.(Optional) Copy other header files that are depicted in
README.txt
to{SDK}\amebadplus_gcc_project\project_km4\src
if needed.Re-build the project by command
make
.