1 2 3# Combo Solution – ASR Chip Porting Case 4 5The IoT combo solution (Wi-Fi+BLE) is developed based on the OpenHarmony LiteOS-M kernel. This document exemplifies how to port code of the DEV.WIFI.A development board powered by the ASR582X chip. 6 7## Compilation and Porting 8 9### Directory Planning 10 11In the directory structure of this solution, the board vendor code is decoupled from the SoC vendor code. 12 13``` 14device 15├── board --- Board vendor directory 16│ └── lango --- Board vendor: Lango 17│ └── dev_wifi_a --- Board name: DEV.WIFI.A 18└── soc --- SoC vendor directory 19 └── asrmicro --- SoC vendor: ASR 20 └── asr582x --- SoC series: ASR582X 21``` 22 23The planned product demo directory is as follows: 24 25``` 26vendor 27└── asrmicro --- Vendor of the product demo. 28 ├── wifi_demo --- Product demo name. 29 └── xts_demo --- Product name. 30``` 31 32### Product Definition 33 34The following uses `vendor/asrmicro/wifi_demo` as an example to describe the kernel, board, and subsystem used by the product. The kernel, board model, and board vendor need to be planned in advance, which are involved in the precompilation instruction (`hb set`). The information entered here corresponds to the planned directory. Example: 35 36``` 37{ 38 "product_name": "wifi_demo", --- Product name. 39 "type": "mini", --- System type: mini. 40 "version": "3.0", --- System version: 3.0 41 "device_company": "lango", --- Board vendor: Lango. 42 "board": "dev_wifi_a", --- Board name: dev_wifi_a. 43 "kernel_type": "liteos_m", --- Kernel type: liteos_m. 44 "kernel_version": "3.0.0", --- Kernel version: 3.0.0. 45 "subsystems": [] --- Subsystem. 46} 47``` 48**device_company** and **board** are used to associate the **//device/board/<device_company>/<board> directory**. 49 50### Board Configuration 51 52In this example, the `device/board/lango/dev_wifi_a` directory is used. Place the **config.gni** file in the **liteos_m** directory. This configuration file is used to describe the board information, including the CPU, toolchain, kernel, and compile flags. Sample code: 53 54``` 55# Kernel type 56kernel_type = "liteos_m" 57 58# Kernel version 59kernel_version = "3.0.0" 60 61# Board CPU Type 62board_cpu = "cortex-m4" 63 64# Toolchain. Here, arm-none-eabi is used. 65board_toolchain = "arm-none-eabi" 66 67# Toolchain path. You can use the system path by entering "", or a custom path. 68board_toolchain_path = rebase_path("//device/soc/asrmicro/gcc/gcc-arm-none-eabi/Linux64/bin") 69 70# Board-specific compilation parameters 71board_cflags = [] 72 73# Board-specific link parameters 74board_ld_flags = [] 75 76# Board-specific header file 77board_include_dirs = [] 78``` 79 80### Precompiling 81 82After the product directory, product definition, and board settings are correctly configured, run the precompilation command `hb set` in the project root directory. Then you can find the related product in the displayed list. 83 84![ohos_config.json](figures/asr582x_ohos_config.png) 85 86After selecting a product, press **Enter**. The `ohos_config.json` file is automatically generated in the root directory. Information about the product to be compiled is listed here. 87 88 89## Kernel Porting 90 91### Kconfig Adaptation 92 93During the compilation of `//kernel/liteos_m`, you need to use the `Kconfig` file for indexing in the corresponding board and SoC directory. 94 95`Kconfig` in the board directory, for example, `//device/board/lango`: 96``` 97├── dev_wifi_a --- dev_wifi_a board configuration 98│ ├── Kconfig.liteos_m.board --- Board configuration options 99│ ├── Kconfig.liteos_m.defconfig.board --- Default configuration of the board 100│ └── liteos_m 101│ └── config.gni --- Board configuration file 102├── Kconfig.liteos_m.boards --- Boards configuration of the board vendor 103└── Kconfig.liteos_m.defconfig.boards --- Default boards configuration of the board vendor 104``` 105 106In `dev_wifi_a/Kconfig.liteos_m.board`, **BOARD_DEV_WIFI_A** can be selected only when **SOC_ASR5822S** is selected. 107 108``` 109config BOARD_DEV_WIFI_A 110 bool "select board DEV_WIFI_A" 111 depends on SOC_ASR5822S 112``` 113 114`Kconfig` in the SoC directory, for example, `//device/soc/asrmicro`: 115 116``` 117├── asr582x --- ASR582X series 118│ ├── Kconfig.liteos_m.defconfig.asr5822s --- Default configuration of the ASR5822S chip 119│ ├── Kconfig.liteos_m.defconfig.series --- Default configuration of the ASR582X series 120│ ├── Kconfig.liteos_m.series --- Configuration of the ASR582X series 121│ └── Kconfig.liteos_m.soc --- ASR582X chip configuration 122├── Kconfig.liteos_m.defconfig --- SoC default configuration 123├── Kconfig.liteos_m.series --- Series configuration 124└── Kconfig.liteos_m.soc --- SoC configuration 125``` 126 127In **asr582x/Kconfig.liteos_m.series**: 128 129``` 130config SOC_SERIES_ASR582X 131 bool "ASR582X Series" 132 select ARM 133 select SOC_COMPANY_ASRMICRO --- Select SOC_COMPANY_ASRMICRO. 134 select CPU_CORTEX_M4 135 help 136 Enable support for ASR582X series 137``` 138 139**SOC_ASR5822S** can be selected in **asr582x/Kconfig.liteos_m.soc** only when **SOC_SERIES_ASR582X** is selected. 140 141``` 142choice 143 prompt "ASR582X series SoC" 144 depends on SOC_SERIES_ASR582X 145 146config SOC_ASR5822S --- Select SOC_ASR5822S. 147 bool "SoC ASR5822S" 148 149endchoice 150``` 151 152To compile the board BOARD_DEV_WIFI_A, you need to select **SOC_COMPANY_ASRMICRO**, **SOC_SERIES_ASR582X**, and **SOC_ASR5822S**. You can do so by running `make menuconfig` in `kernel/liteos_m`. 153 154![asr5822s_select.json](figures/asr5822s_select.png) 155 156The configurations are saved in `//vendor/asrmicro/wifi_demo/kernel_configs/debug.config` by default. You can directly modify the configurations in **debug.config**. 157 158``` 159LOSCFG_BOARD_DEV_WIFI_A=y 160LOSCFG_SOC_COMPANY_ASRMICRO=y 161LOSCFG_SOC_SERIES_ASR582X=y 162LOSCFG_SOC_ASR5822S=y 163``` 164 165### Modular Compilation 166 167The compilation of `Board` and `SoC` adopts the modular compilation method, starting from `kernel/liteos_m/BUILD.gn` and increasing by level. The adaptation process of this solution is as follows: 168 1691. Create the **BUILD.gn** file in `//device/board/lango` and add the following content to the file: 170 171 ``` 172 if (ohos_kernel_type == "liteos_m") { 173 import("//kernel/liteos_m/liteos.gni") 174 module_name = get_path_info(rebase_path("."), "name") 175 module_group(module_name) { 176 modules = [ 177 "dev_wifi_a", --- Board module 178 "hcs", --- Module corresponding to the hcs file 179 ] 180 } 181 } 182 ``` 183 184 In the preceding **BUILD.gn** file, **dev_wifi_a** and **hcs** are the module names organized by directory level. 185 1862. In `//device/soc/asrmicro`, use the same method to create the **BUILD.gn** file and add the following content to the file: 187 188 ``` 189 if (ohos_kernel_type == "liteos_m") { 190 import("//kernel/liteos_m/liteos.gni") 191 module_name = get_path_info(rebase_path("."), "name") 192 module_group(module_name) { 193 modules = [ 194 "asr582x", 195 ] 196 } 197 } 198 ``` 199 2003. In the `//device/soc/asrmicro` module at each level, add the **BUILD.gn** file and compile the module. The following uses `//device/soc/asrmicro/asr582x/liteos_m/sdk/startup/BUILD.gn` as an example: 201 202 ``` 203 import("//kernel/liteos_m/liteos.gni") 204 205 config("public") { 206 include_dirs = [ "." ] --- Common header file 207 } 208 209 kernel_module("asr_startup") { --- Module for compilation 210 sources = [ --- Source file for compilation 211 "startup.c", 212 "board.c", 213 "startup_cm4.S", 214 ] 215 216 include_dirs = [ --- Header files used in the include 217 "...", 218 ] 219 } 220 ``` 221 2224. To organize links and some compilation options, the following parameters are set in **config("public")** in `//device/soc/asrmicro/asr582x/liteos_m/sdk/config/BUILD.gn`: 223 224 ``` 225 config("public") { 226 include_dirs = [] --- Common header file 227 ldflags = [] --- Link parameters, including the ld file 228 libs = [] --- Link library 229 defines = [] --- Definition 230 ``` 231 232 ![](../public_sys-resources/icon-note.gif) **NOTE** 233 It is recommended that common parameter options and header files not be repeatedly filled in all components. 234 2355. To organize some product applications, this solution adds **list** to the **config.json** file of the vendor. The following uses `//vendor/asrmicro/wifi_demo/config.json` as an example to describe how to add **list** to the **config.json** file: 236 ``` 237 "tests_list": [ --- demo list 238 { 239 "enable": "true", --- list switch 240 "test_modules": [ 241 "example", --- OS basic demo 242 "wifi_test" --- Wi-Fi demo 243 ] 244 } 245 ] 246 ``` 247 248 The demo is managed as a module. To enable or disable a demo, add or delete items in **tests_list**.**tests_list** can be directly read in GN. You need to add the following content to `//device/board/lango/dev_wifi_a/liteos_m/config.gni`: 249 250 ``` 251 product_conf = read_file("${product_path}/config.json", "json") 252 product_name = product_conf.product_name 253 tests_list = product_conf.tests_list 254 ``` 255 256 After reading the **list**, you can add related component libraries to the corresponding link options. Add the following content to `//device/soc/asrmicro/asr582x/liteos_m/sdk/config/BUILD.gn`: 257 258 ``` 259 foreach(test_item, tests_list) { 260 test_enable = test_item.enable 261 if(test_enable == "true") 262 { 263 foreach(test_module, test_item.test_modules) { 264 ldflags += [ "-l${test_module}" ] 265 } 266 } 267 } 268 ``` 269 270### C Library Adaptation 271 272To ensure that the entire system does not distinguish the user mode and kernel mode, the upper-layer components and kernel share the same musl-based C library. This solution uses the musl C library. For details about the third-party library, see `//third_party/musl/porting/liteos_m/kernel/BUILD.gn`. 273 274In addition, the kernel modifies and adapts the code for malloc. For details about the adaptation file, see `//kernel/liteos_m/kal/libc/musl/porting/src/malloc.c`. 275 276In this solution, printf-related APIs are implemented using open-source code. For details about the adaptation file, see `//device/soc/asrmicro/asr582x/liteos_m/sdk/drivers/platform/system/printf-stdarg.c`. 277 278The **wrap** links of the printf-related APIs need to be added to the `//device/board/lango/dev_wifi_a/liteos_m/config.gni` file so that these APIs can be invoked. 279 280``` 281board_ld_flags += [ 282 "-Wl,--wrap=printf", 283 "-Wl,--wrap=sprintf", 284 "-Wl,--wrap=snprintf", 285 "-Wl,--wrap=vprintf", 286 "-Wl,--wrap=vsprintf", 287 "-Wl,--wrap=vsnprintf", 288] 289``` 290### Shell Adaptation 291 292To facilitate debugging, this solution integrates the shell component of the kernel. You can select **Enable Shell** in **Debug** of **make menuconfig** or enter **LOSCFG_SHELL=y** in the `//vendor/asrmicro/wifi_demo/kernel_configs/debug.config` file. 293The shell component needs to be initialized. For details, see `device/soc/asrmicro/asr582x/liteos_m/sdk/startup/board.c`. 294 295``` 296ret = LosShellInit(); 297if (ret != LOS_OK) { 298 printf("LosShellInit failed! ERROR: 0x%x\n", ret); 299} 300ret = OsShellInit(); 301if (ret != LOS_OK) { 302 printf("OsShellInit failed! ERROR: 0x%x\n", ret); 303} 304``` 305 306After initialization, each shell command needs to be registered, for example, `vendor/asrmicro/wifi_demo/tests/wifi/wifi_app.c`: 307 308``` 309osCmdReg(CMD_TYPE_STD, "wifi_open", 0, (CMD_CBK_FUNC)ap_conn_func); --- Connect to the AP. Input parameters can be carried. 310osCmdReg(CMD_TYPE_EX, "wifi_close", 0, (CMD_CBK_FUNC)ap_close_func); --- Disconnect from the AP. 311``` 312 313### Kernel Boot Adaptation 314 315After the board enters the **main** function, it is initialized. After that, interrupts are registered, and then the kernel is initialized and scheduled. 316For details about interrupt registration, see `//device/soc/asrmicro/asr582x/liteos_m/sdk/startup/board.c`. 317 318``` 319ArchHwiCreate(UART1_IRQn,configLIBRARY_NORMAL_INTERRUPT_PRIORITY,0,UART1_IRQHandler,0); --- UART interrupt 320ArchHwiCreate(GPIO_IRQn,configLIBRARY_NORMAL_INTERRUPT_PRIORITY,0,GPIO_IRQHandler,0); --- GPIO interrupt 321``` 322 323The following is an example of kernel initialization: 324``` 325osStatus_t ret = osKernelInitialize(); --- Kernel initialization 326 327if(ret == osOK) 328{ 329 threadId = osThreadNew((osThreadFunc_t)sys_init,NULL,&g_main_task); --- Create the init thread. 330 331 if(threadId!=NULL) 332 { 333 osKernelStart(); --- Thread scheduling 334 } 335} 336``` 337 338In `sys_init`, you need to initialize the OpenHarmony system components. 339 340``` 341... 342DeviceManagerStart(); --- Initialize HDF. 343 344OHOS_SystemInit(); --- Initialize OpenHarmony system components. 345.... 346``` 347 348### HDF Framework Adaptation 349 350HDF provides a set of unified APIs for applications to access hardware, simplifying application development. To add the HDF component, you need to add it to `//vendor/asrmicro/wifi_demo/kernel_configs/debug.config`: 351 352``` 353LOSCFG_DRIVERS_HDF=y 354LOSCFG_DRIVERS_HDF_PLATFORM=y 355``` 356 357In addition, you need to add the hardware configuration description file of the corresponding development board to `board`. The file is stored in `//device/board/lango/hcs`. This example takes the GPIO and UART as an example. The porting process is as follows: 358 359#### GPIO Adaptation 360 3611. The chip driver adaptation file is stored in the `//drivers/hdf_core/adapter/platform` directory. Add the `gpio_asr.c` file to the `gpio` directory, and add the compilation conditions of the new driver file to `BUILD.gn`. 362 363 ``` 364 if (defined(LOSCFG_SOC_COMPANY_ASRMICRO)) { 365 sources += [ "gpio_asr.c" ] 366 } 367 ``` 368 3692. The driver description file in `gpio_asr.c` is as follows: 370 371 ``` 372 struct HdfDriverEntry g_GpioDriverEntry = { 373 .moduleVersion = 1, 374 .moduleName = "ASR_GPIO_MODULE_HDF", 375 .Init = GpioDriverInit, 376 .Release = GpioDriverRelease, 377 }; 378 HDF_INIT(g_GpioDriverEntry); 379 ``` 380 3813. Add the GPIO hardware description file `gpio.hcs` to `//device/board/lango/hcs`. The mapped GPIO0 controls the programmable LED on the board. GPIO1 corresponds to the user key. The HCS content is as follows: 382 383 ``` 384 root { 385 platform { 386 gpio_config { 387 match_attr = "gpio_config"; 388 pin = [0, 1]; 389 // led3: GPIO9 390 // user key: GPIO7 391 realPin = [9, 7]; 392 config = [5, 1]; 393 pinNum = 2; 394 } 395 } 396 } 397 ``` 398 3994. The configuration information of `gpio.hcs` is loaded in GpioDriverInit, and the corresponding GPIO pins are initialized. The application layer needs only the following simple code to control LED indicators and read key information: 400 401 ``` 402 int32_t GpioKeyIrqFunc(uint16_t gpio, void *data) 403 { 404 printf("user key %d pressed\n", gpio); 405 } 406 GpioSetIrq(1, OSAL_IRQF_TRIGGER_FALLING, GpioKeyIrqFunc, NULL); 407 408 GpioWrite(0, 0); 409 lega_rtos_delay_milliseconds(1000); 410 GpioWrite(0, 1); 411 ``` 412 413#### UART Adaptation 414 4151. The chip driver adaptation file is stored in the `//drivers/adapter/platform` directory. Add the `uart_asr.c` and `uart_asr.h` files to the `uart` directory, and add the compilation conditions of the new driver file to `BUILD.gn`. 416 417 ``` 418 if (defined(LOSCFG_SOC_COMPANY_ASRMICRO)) { 419 sources += [ "uart_asr.c" ] 420 } 421 ``` 422 4232. The driver description file in `uart_asr.c` is as follows: 424 425 ``` 426 struct HdfDriverEntry g_hdfUartDevice = { 427 .moduleVersion = 1, 428 .moduleName = "HDF_PLATFORM_UART", 429 .Bind = HdfUartDeviceBind, 430 .Init = HdfUartDeviceInit, 431 .Release = HdfUartDeviceRelease, 432 }; 433 434 HDF_INIT(g_hdfUartDevice); 435 ``` 436 4373. Add the GPIO hardware description file `uart.hcs` to `//device/board/lango/hcs`. The HCS content is as follows: 438 439 ``` 440 controller_uart0 :: uart_controller { 441 match_attr = "asr582x_uart_0"; 442 port = 0; /* UART_ID_0 */ 443 444 pin_tx_pin = 0; /* IO_PIN_10 */ 445 pin_tx_mux = 25; /* IO_MUX_2 */ 446 447 pin_rx_pin = 1; /* IO_PIN_11 */ 448 pin_rx_mux = 25; /* IO_MUX_2 */ 449 tx_rx = 3; /* TX_RX MODE */ 450 } 451 ``` 452 4534. The configuration information of `gpio.hcs` is loaded in `HdfUartDeviceInit`, and the corresponding serial port pins are initialized. The code for testing the serial port at the application layer is as follows: 454 455 ``` 456 DevHandle uart_handle = UartOpen(0); 457 UartSetBaud(uart_handle, 115200); 458 ... 459 attr.dataBits = UART_ATTR_DATABIT_8; 460 attr.parity = UART_ATTR_PARITY_NONE; 461 attr.stopBits = UART_ATTR_STOPBIT_1; 462 ret = UartSetAttribute(uart_handle, &attr); 463 ret = UartWrite(uart_handle, send_data, strlen(send_data)); 464 ret = UartRead(uart_handle, recv_data, sizeof(recv_data) - 1); 465 ... 466 ``` 467 468## OpenHarmony Component Porting 469 470The compilation option entry of the subsystem is in the `config.json` file of the corresponding product. The following uses `//vendor/asrmicro/wifi_demo/config.json` as an example. 471 472### LWIP component 473 474The source code of the lwIP component is stored in `//third_party/lwip`. The kernel in OpenHarmony is customized in `//kernel/liteos_m/components/net/lwip-2.1`, including the redefinition of some interfaces and structures. 475 476In this example, the path for setting lwip in the `config.json` file is as follows: 477 478 ``` 479 "subsystem": "kernel", 480 "components": [ 481 { 482 "component": "liteos_m", 483 "features": [ 484 "ohos_kernel_liteos_m_lwip_path = \"//device/soc/asrmicro/asr582x/liteos_m/components/net/lwip-2.1\"" 485 ] 486 } 487 ] 488 ``` 489 490Enable lwIP compilation in the `kernel_config/debug.config` file. 491 492``` 493LOSCFG_NET_LWIP=y 494``` 495 496### Security Component 497 498For the security component, enable the corresponding options in `config.json`. In this example, mbedtls (`//third_party/mbedtls`) in the third-party library is used as the encryption module. The options are as follows: 499 500``` 501"subsystem": "security", 502"components": [ 503 { "component": "huks", "features": 504 [ 505 ... 506 "ohos_security_huks_mbedtls_porting_path = \"//device/soc/asrmicro/asr582x/liteos_m/components/mbedtls\"" 507 ] 508 } 509] 510``` 511 512In the preceding directory, you need to configure mbedtls. For details, see `config/config_liteos_m.h`. Note that if the RNG capability of mbedtls is used (for example, the dsoftbus component is used in `//foundation/communication/dsoftbus/adapter/common/mbedtls/softbus_adapter_crypto.c`), the entropy source for generating random numbers must be specified. In this example, the hardware random number capability of the ASR582X is used. You need to enable the following macro: 513 514``` 515#define MBEDTLS_ENTROPY_HARDWARE_ALT 516``` 517 518After this macro is enabled, the `entropy_hardware_alt` interface needs to be implemented. For details, see `library/entropy_hardware_alt.c`. 519 520### wifi_lite Component 521 522The options of the wifi_lite component are as follows: 523 524``` 525"subsystem": "communication", 526"components": [ 527 { "component": "wifi_lite", "features":[] } 528 ] 529``` 530 531Wi-Fi-related functions are implemented in `//device/soc/asrmicro/asr582x/liteos_m/sdk/hal/src/wifi_adapter.c`. 532 533This example also provides a demo that uses the `wifi_lite` interfaces. For details, see `//vendor/asrmicro/wifi_demo/tests/wifi/wifi_app.c`. The following two connection test commands are provided: 534 535Table 1 ASR Wi-Fi connection commands 536 537| Command | Parameter | Description | 538|------------|--------|--------| 539| wifi_open | sta [SSID] [KEY] | Connection routing command, for example, `wifi_open sta ASR_AP test123456`.| 540| wifi_close | N/A | Command for disconnecting a connection. | 541 542### XTS component 543 544To adapt the XTS component, for example, `//vendor/asrmicro/xts_demo/config.json`, add the following component options: 545 546``` 547"subsystem": "xts", 548"components": [ 549 { "component": "xts_acts", "features": 550 [ 551 "enable_ohos_test_xts_acts_use_thirdparty_lwip = true" 552 ] 553 }, 554 { "component": "xts_tools", "features":[] } 555] 556``` 557 558The XTS function is also organized using `list`. You can add or delete modules in the `config.json` file by referring to [Modular Compilation]. 559 560``` 561"xts_list": [ 562 { 563 "enable": "true", 564 "xts_modules": [ 565 "ActsKvStoreTest", 566 "ActsDfxFuncTest", 567 "ActsHieventLiteTest", 568 "ActsSamgrTest", 569 "ActsParameterTest", 570 "ActsWifiServiceTest", 571 "ActsWifiIotTest", 572 "ActsBootstrapTest" 573 ] 574 } 575], 576``` 577 578### dsoftbus component 579 580The dsoftbus component provides the discovery, connection, networking, and transmission capabilities between devices. This solution uses the DSoftBus capability between Wi-Fi devices as an example. 581 582Dependent components: lwIP, security, and wifi_lite. 583 584Prerequisites: The device is connected to a router, and all networking devices are in the same LAN. 585 586The options of the dsoftbus component are as follows: 587 588``` 589"subsystem": "communication", 590"components": [ 591 { "component": "dsoftbus", "features":[] } 592 ] 593``` 594 595The dsoftbus test demo is provided in `//vendor/asrmicro/wifi_demo`. To enable this function, modify `//vendor/asrmicro/wifi_demo/tests/BUILD.gn`. 596 597``` 598declare_args() { 599 asr_dsoftbus_test = true --- Enable dsoftbus demo compilation. 600} 601``` 602 603Add the dsoftbus_test module to the `//vendor/asrmicro/wifi_demo/config.json` file. 604 605``` 606"tests_list": [ 607 { 608 "enable": "true", 609 "test_modules": [ 610 "wifi_test", 611 "dsoftbus_test" --- Enable the dsoftbus_test module. 612 ] 613 } 614] 615``` 616 617For details about the startup interface of the dsoftbus component, see `//vendor/asrmicro/wifi_demo/tests/dsoftbus/dsoftbus_app.c`. 618 619``` 620InitSoftBusServer(); 621``` 622 623At least 80 KB RAM needs to be reserved for the running of the DSoftBus component. If the resources are insufficient, other parts such as the lwIP component can be tailored. 624`//kernel_liteos_m/blob/master/components/net/lwip-2.1/porting/include/lwip/lwipopts.h`: 625 626``` 627#define TCPIP_THREAD_STACKSIZE 0x2000 --- Reduce the size of the TCP/IP task stack. 628``` 629 630The `-fPIC` compilation option is added to the `communication_dsoftbus` repository. In this way, the compiler generates position-independent code and uses relative addresses. However, the LiteOS-M core uses a static library, which is not recommended. 631You are advised to manually comment out the `-fPIC` compilation option in the following files: 632`//foundation/communication/dsoftbus/core/common/BUILD.gn` 633`//foundation/communication/dsoftbus/core/frame/BUILD.gn` 634`//foundation/communication/dsoftbus/sdk/BUILD.gn` 635`//foundation/communication/dsoftbus/components/nstackx_mini/nstackx_ctrl/BUILD.gn` 636 637The DSoftBus networking requires device authentication. In the R&D phase, you can skip the authentication and focus on the networking and transmission capabilities. You need to replace the `HandleReceiveDeviceId` function in the `//foundation/communication/dsoftbus/core/authentication/src/auth_manager.c` file with the following implementation: 638 639``` 640void HandleReceiveDeviceId(AuthManager *auth, uint8_t *data) 641{ 642 uint8_t tempKey[SESSION_KEY_LENGTH] = {0}; 643 if (auth == NULL || data == NULL) { 644 SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "invalid parameter"); 645 return; 646 } 647 if (AuthUnpackDeviceInfo(auth, data) != SOFTBUS_OK) { 648 SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "AuthUnpackDeviceInfo failed"); 649 AuthHandleFail(auth, SOFTBUS_AUTH_UNPACK_DEVID_FAILED); 650 return; 651 } 652 if (auth->side == SERVER_SIDE_FLAG) { 653 if (EventInLooper(auth->authId) != SOFTBUS_OK) { 654 SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "auth EventInLooper failed"); 655 AuthHandleFail(auth, SOFTBUS_MALLOC_ERR); 656 return; 657 } 658 if (AuthSyncDeviceUuid(auth) != SOFTBUS_OK) { 659 AuthHandleFail(auth, SOFTBUS_AUTH_SYNC_DEVID_FAILED); 660 } 661 (void)memset_s(tempKey, SESSION_KEY_LENGTH, 1, SESSION_KEY_LENGTH); 662 AuthOnSessionKeyReturned(auth->authId, tempKey, SESSION_KEY_LENGTH); 663 return; 664 } 665 //VerifyDeviceDevLvl(auth); --- Comment out the authentication process. 666 (void)memset_s(tempKey, SESSION_KEY_LENGTH, 1, SESSION_KEY_LENGTH); 667 AuthOnSessionKeyReturned(auth->authId, tempKey, SESSION_KEY_LENGTH); 668} 669``` 670 671After correct configuration, compilation, and burning, the device uses the wifi_open command to connect to the router. After the connection is successful, the device automatically performs networking. 672 673 674The adaptation process of other components is similar to that of other vendors. 675