Skip to content

Commit

Permalink
remove lwip dependency from bl702 thread application
Browse files Browse the repository at this point in the history
  • Loading branch information
wy-hh committed Oct 26, 2023
1 parent 4ea73f3 commit 8bbe447
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 9 deletions.
2 changes: 2 additions & 0 deletions scripts/build/builders/bouffalolab.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ def __init__(self,
self.argsOpt.append(f'chip_inet_config_enable_ipv4={str(enable_ethernet or enable_wifi).lower()}')

if enable_thread:
self.argsOpt.append(f'chip_system_config_use_open_thread_inet_endpoints=true')
self.argsOpt.append(f'chip_with_lwip=false')
self.argsOpt.append(f'openthread_project_core_config_file="{bouffalo_chip}-openthread-core-bl-config.h"')
if not use_matter_openthread:
self.argsOpt.append(
Expand Down
3 changes: 3 additions & 0 deletions src/platform/bouffalolab/BL702/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,7 @@ static_library("BL702") {

deps += [ "${chip_root}/src/credentials:credentials_header" ]
public_deps = [ "${chip_root}/src/platform:platform_base" ]

public_configs =
[ "${chip_root}/src/lib/address_resolve:default_address_resolve_config" ]
}
5 changes: 5 additions & 0 deletions src/platform/bouffalolab/BL702/PlatformManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
#include <platform/bouffalolab/common/DiagnosticDataProviderImpl.h>
#include <platform/internal/GenericPlatformManagerImpl_FreeRTOS.ipp>

#if CHIP_SYSTEM_CONFIG_USE_LWIP
#include <lwip/tcpip.h>
#endif

#if CHIP_DEVICE_CONFIG_ENABLE_WIFI
#include <platform/bouffalolab/BL702/wifi_mgmr_portable.h>
#endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI
Expand Down Expand Up @@ -62,8 +65,10 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void)
CHIP_ERROR err;
TaskHandle_t backup_eventLoopTask;

#if CHIP_SYSTEM_CONFIG_USE_LWIP
// Initialize LwIP.
tcpip_init(NULL, NULL);
#endif

#if CHIP_DEVICE_CONFIG_ENABLE_THREAD
otRadio_opt_t opt;
Expand Down
10 changes: 5 additions & 5 deletions src/platform/bouffalolab/BL702/ThreadStackManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@

#include <platform/internal/CHIPDeviceLayerInternal.h>

#include <platform/FreeRTOS/GenericThreadStackManagerImpl_FreeRTOS.hpp>
#include <platform/OpenThread/GenericThreadStackManagerImpl_OpenThread_LwIP.cpp>

#include <platform/OpenThread/OpenThreadUtils.h>
#include <platform/ThreadStackManager.h>

#include <openthread/platform/entropy.h>
#include <platform/FreeRTOS/GenericThreadStackManagerImpl_FreeRTOS.hpp>
#include <platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp>

#include <lib/support/CHIPPlatformMemory.h>

#include <openthread/platform/entropy.h>

#include <mbedtls/platform.h>

#include <openthread_port.h>
Expand All @@ -51,7 +51,7 @@ CHIP_ERROR ThreadStackManagerImpl::InitThreadStack(otInstance * otInst)
// Initialize the generic implementation base classes.
err = GenericThreadStackManagerImpl_FreeRTOS<ThreadStackManagerImpl>::DoInit();
SuccessOrExit(err);
err = GenericThreadStackManagerImpl_OpenThread_LwIP<ThreadStackManagerImpl>::DoInit(otInstanceInitSingle());
err = GenericThreadStackManagerImpl_OpenThread<ThreadStackManagerImpl>::DoInit(otInst);
SuccessOrExit(err);

mbedtls_platform_set_calloc_free(pvPortCalloc, vPortFree);
Expand Down
2 changes: 2 additions & 0 deletions src/platform/bouffalolab/BL702L/ThreadStackManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ CHIP_ERROR ThreadStackManagerImpl::InitThreadStack(otInstance * otInst)
err = GenericThreadStackManagerImpl_OpenThread<ThreadStackManagerImpl>::DoInit(otInst);
SuccessOrExit(err);

mbedtls_platform_set_calloc_free(pvPortCalloc, vPortFree);

exit:
return err;
}
Expand Down
4 changes: 0 additions & 4 deletions src/platform/bouffalolab/BL702L/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ riscv_platform_config = "${bouffalolab_iot_sdk_build_root}/common/rsicv.gni"

mbedtls_target = "${bouffalolab_iot_sdk_build_root}/bl702l:bl_iot_sdk"

chip_system_config_use_open_thread_inet_endpoints = true

chip_with_lwip = false

chip_inet_config_enable_tcp_endpoint = false

chip_build_tests = false
Expand Down
5 changes: 5 additions & 0 deletions src/system/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ if (chip_device_platform == "cc13x2_26x2") {
import("//build_overrides/mt793x_sdk.gni")
} else if (chip_device_platform == "stm32") {
import("//build_overrides/stm32_sdk.gni")
} else if (chip_device_platform == "bl702") {
import("//build_overrides/bouffalolab_iot_sdk.gni")
} else if (chip_device_platform == "bl702l") {
import("//build_overrides/bouffalolab_iot_sdk.gni")
}
Expand Down Expand Up @@ -194,6 +196,9 @@ source_set("system_config_header") {
if (chip_device_platform == "stm32") {
public_deps += [ "${stm32_sdk_build_root}:stm32_sdk" ]
}
if (chip_device_platform == "bl702") {
public_deps += [ "${bouffalolab_iot_sdk_build_root}/bl702:bl_iot_sdk" ]
}
if (chip_device_platform == "bl702l") {
public_deps += [ "${bouffalolab_iot_sdk_build_root}/bl702l:bl_iot_sdk" ]
}
Expand Down

0 comments on commit 8bbe447

Please sign in to comment.