Skip to content

Commit

Permalink
fix restyle
Browse files Browse the repository at this point in the history
  • Loading branch information
wy-hh committed Jan 2, 2023
1 parent aefb511 commit 763aa5a
Show file tree
Hide file tree
Showing 21 changed files with 213 additions and 271 deletions.
3 changes: 1 addition & 2 deletions build_overrides/bouffalolab_iot_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
# limitations under the License.

declare_args() {

bouffalolab_iot_sdk_build_root = "//third_party/bouffalolab/"

bouffalolab_sdk_root = "/opt/bouffalolab_sdk"
}
3 changes: 2 additions & 1 deletion config/bouffalolab/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@
# Options from standalone-chip.mk that differ from configure defaults. These
# options are used from examples/.

custom_toolchain = "//third_party/connectedhomeip/config/bouffalolab/toolchain:riscv_gcc"
custom_toolchain =
"//third_party/connectedhomeip/config/bouffalolab/toolchain:riscv_gcc"
3 changes: 1 addition & 2 deletions examples/build_overrides/bouffalolab_iot_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
# limitations under the License.

declare_args() {

bouffalolab_iot_sdk_build_root =
bouffalolab_iot_sdk_build_root =
"//third_party/connectedhomeip/third_party/bouffalolab"

bouffalolab_sdk_root = "/opt/bouffalolab_sdk"
Expand Down
10 changes: 4 additions & 6 deletions examples/lighting-app/bouffalolab/bl602/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import("//build_overrides/bouffalolab_iot_sdk.gni")
import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")

import("${bouffalolab_iot_sdk_build_root}/common/bouffalolab_executable.gni")
import("${bouffalolab_iot_sdk_build_root}/bl602/bl_iot_sdk.gni")
import("${bouffalolab_iot_sdk_build_root}/common/bouffalolab_executable.gni")
import("${build_root}/config/defaults.gni")
import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/platform/device.gni")
Expand Down Expand Up @@ -66,7 +66,7 @@ bl_iot_sdk("sdk") {
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}",
"OTA_PERIODIC_QUERY_TIMEOUT=${ota_periodic_query_timeout}",
"CHIP_UART_BAUDRATE=${baudrate}",
"SYS_AOS_LOOP_ENABLE"
"SYS_AOS_LOOP_ENABLE",
]

if (chip_enable_pw_rpc) {
Expand All @@ -86,7 +86,7 @@ bouffalolab_executable("lighting_app") {
"CHIP_UART_BAUDRATE=${baudrate}",
"BL602_ENABLE",
"START_ENTRY=bfl_main",
"SYS_AOS_LOOP_ENABLE"
"SYS_AOS_LOOP_ENABLE",
]

bl_plat_name = "bl602"
Expand Down Expand Up @@ -198,9 +198,7 @@ bouffalolab_executable("lighting_app") {
sources += [ "${examples_plat_common_dir}/plat/OTAConfig.cpp" ]
}

cflags_c = [
"-Wno-sign-compare",
]
cflags_c = [ "-Wno-sign-compare" ]
ldscript = "${examples_plat_dir}/ldscripts/flash_rom.ld"

ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,4 @@

#define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1

#define CHIP_SYSTEM_CRYPTO_HEADER_RESERVE_SIZE 128
#define CHIP_SYSTEM_CRYPTO_HEADER_RESERVE_SIZE 128
3 changes: 2 additions & 1 deletion examples/lighting-app/bouffalolab/common/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,8 @@ void AppTask::ChipEventHandler(const ChipDeviceEvent * event, intptr_t arg)
#if CHIP_DEVICE_CONFIG_ENABLE_WIFI
case DeviceEventType::kWiFiConnectivityChange:

ChipLogProgress(NotSpecified, "Wi-Fi state changed to %s.\r\n", ConnectivityMgr().IsWiFiStationConnected() ? "connected" : "disconnected");
ChipLogProgress(NotSpecified, "Wi-Fi state changed to %s.\r\n",
ConnectivityMgr().IsWiFiStationConnected() ? "connected" : "disconnected");

chip::app::DnssdServer::Instance().StartServer();
NetworkCommissioning::BLWiFiDriver::GetInstance().SaveConfiguration();
Expand Down
102 changes: 52 additions & 50 deletions examples/platform/bouffalolab/bl602/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,76 +115,78 @@
* See http://www.freertos.org/a00110.html.
*----------------------------------------------------------*/

#define configSUPPORT_STATIC_ALLOCATION 1
#define configSUPPORT_STATIC_ALLOCATION 1

#define configCLINT_BASE_ADDRESS CLINT_CTRL_ADDR
#define configCLIC_TIMER_ENABLE_ADDRESS (0x02800407)
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 1
#define configUSE_TICK_HOOK 0
#define configCLINT_BASE_ADDRESS CLINT_CTRL_ADDR
#define configCLIC_TIMER_ENABLE_ADDRESS (0x02800407)
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 1
#define configUSE_TICK_HOOK 0
#ifndef configUSE_TICKLESS_IDLE
//Maybe Compile flags is passed by command line
#define configUSE_TICKLESS_IDLE 1
// Maybe Compile flags is passed by command line
#define configUSE_TICKLESS_IDLE 1
#endif
#define configCPU_CLOCK_HZ ( 10 * 1000 * 1000 ) /*QEMU*/
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
#define configMAX_PRIORITIES ( 32 )
#define configCPU_CLOCK_HZ (10 * 1000 * 1000) /*QEMU*/
#define configTICK_RATE_HZ ((TickType_t) 1000)
#define configMAX_PRIORITIES (32)
/* Creating idle task */
/* -1 -> prvInitialiseNewTask: (subtract 1 to get top of stack) pxTopOfStack = &( pxNewTCB->pxStack[ ulStackDepth - ( uint32_t ) 1 ] ); */
/* -1 -> prvInitialiseNewTask: (subtract 1 in case not matching 8 bytes alignment) pxTopOfStack = ( StackType_t * ) ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) ); */
/* -1 -> prvInitialiseNewTask: (subtract 1 to get top of stack) pxTopOfStack = &( pxNewTCB->pxStack[ ulStackDepth - ( uint32_t ) 1
* ] ); */
/* -1 -> prvInitialiseNewTask: (subtract 1 in case not matching 8 bytes alignment) pxTopOfStack = ( StackType_t * ) ( ( (
* portPOINTER_SIZE_TYPE ) pxTopOfStack ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) ); */
/* Running idle task */
/* -12 -> prvIdleTask: addi sp, sp, -48 */
/* -16 -> prvIdleTask.xTaskResumeAll: addi sp, sp, -64 */
/* Here comes an interrupt after prvIdleTask.xTaskResumeAll.vTaskExitCritical */
/* -30 -> freertos_risc_v_trap_handler: addi sp, sp, -portCONTEXT_SIZE */
/* -34 -> portasmSAVE_ADDITIONAL_REGISTERS: addi sp, sp, -(portasmADDITIONAL_CONTEXT_SIZE * portWORD_SIZE) */
/* Checking for stack overflow */
/* 4 -> taskCHECK_FOR_STACK_OVERFLOW: if( ( pulStack[ 0 ] != ulCheckValue ) || ( pulStack[ 1 ] != ulCheckValue ) || ( pulStack[ 2 ] != ulCheckValue ) || ( pulStack[ 3 ] != ulCheckValue ) ) */
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 114 ) /* SIZE-1-1-12-16-30-34>=4 */
#define configTOTAL_HEAP_SIZE ( ( size_t ) 14100 )
#define configMAX_TASK_NAME_LEN ( 16 )
#define configUSE_TRACE_FACILITY 1
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
#define configUSE_MUTEXES 1
#define configQUEUE_REGISTRY_SIZE 8
#define configCHECK_FOR_STACK_OVERFLOW 2
#define configUSE_RECURSIVE_MUTEXES 1
#define configUSE_MALLOC_FAILED_HOOK 1
#define configUSE_APPLICATION_TASK_TAG 0
#define configUSE_COUNTING_SEMAPHORES 1
#define configGENERATE_RUN_TIME_STATS 0
/* 4 -> taskCHECK_FOR_STACK_OVERFLOW: if( ( pulStack[ 0 ] != ulCheckValue ) || ( pulStack[ 1 ] != ulCheckValue ) || ( pulStack[ 2
* ] != ulCheckValue ) || ( pulStack[ 3 ] != ulCheckValue ) ) */
#define configMINIMAL_STACK_SIZE ((unsigned short) 114) /* SIZE-1-1-12-16-30-34>=4 */
#define configTOTAL_HEAP_SIZE ((size_t) 14100)
#define configMAX_TASK_NAME_LEN (16)
#define configUSE_TRACE_FACILITY 1
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
#define configUSE_MUTEXES 1
#define configQUEUE_REGISTRY_SIZE 8
#define configCHECK_FOR_STACK_OVERFLOW 2
#define configUSE_RECURSIVE_MUTEXES 1
#define configUSE_MALLOC_FAILED_HOOK 1
#define configUSE_APPLICATION_TASK_TAG 0
#define configUSE_COUNTING_SEMAPHORES 1
#define configGENERATE_RUN_TIME_STATS 0
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1

/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES (2)

/* Software timer definitions. */
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
#define configTIMER_QUEUE_LENGTH 4
#define configTIMER_TASK_STACK_DEPTH ( 400 )
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES - 1)
#define configTIMER_QUEUE_LENGTH 4
#define configTIMER_TASK_STACK_DEPTH (400)

/* Task priorities. Allow these to be overridden. */
#ifndef uartPRIMARY_PRIORITY
#define uartPRIMARY_PRIORITY ( configMAX_PRIORITIES - 3 )
#define uartPRIMARY_PRIORITY (configMAX_PRIORITIES - 3)
#endif


/* Optional functions - most linkers will remove unused functions anyway. */
#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskCleanUpResources 1
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#define INCLUDE_eTaskGetState 1
#define INCLUDE_xTimerPendFunctionCall 1
#define INCLUDE_xTimerPendFunctionCall 1
#define INCLUDE_uxTaskGetStackHighWaterMark 1
#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskCleanUpResources 1
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#define INCLUDE_eTaskGetState 1
#define INCLUDE_xTimerPendFunctionCall 1
#define INCLUDE_xTimerPendFunctionCall 1
#define INCLUDE_uxTaskGetStackHighWaterMark 1

/* Overwrite some of the stack sizes allocated to various test and demo tasks.
Like all task stack sizes, the value is the number of words, not bytes. */
Expand All @@ -204,10 +206,10 @@ extern void vAssertCalled(void);
if ((x) == 0) \
vAssertCalled()

#if ( configUSE_TICKLESS_IDLE != 0 )
#if (configUSE_TICKLESS_IDLE != 0)
#include "portmacro.h"
extern void vApplicationSleep(TickType_t xExpectedIdleTime);
#define portSUPPRESS_TICKS_AND_SLEEP(xExpectedIdleTime) vApplicationSleep(xExpectedIdleTime)
#define portSUPPRESS_TICKS_AND_SLEEP(xExpectedIdleTime) vApplicationSleep(xExpectedIdleTime)
#endif

#endif
10 changes: 5 additions & 5 deletions src/platform/bouffalolab/BL602/BL602Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ CHIP_ERROR BL602Config::Init()
CHIP_ERROR BL602Config::ReadConfigValue(Key key, bool & val)
{
CHIP_ERROR err = CHIP_NO_ERROR;
size_t valLen = 0;
size_t valLen = 0;

ef_get_env_blob(key.name, &val, 1, &valLen);
if (0 == valLen)
Expand All @@ -95,7 +95,7 @@ CHIP_ERROR BL602Config::ReadConfigValue(Key key, bool & val)
CHIP_ERROR BL602Config::ReadConfigValue(Key key, uint32_t & val)
{
CHIP_ERROR err = CHIP_NO_ERROR;
size_t valLen = 0;
size_t valLen = 0;

ef_get_env_blob(key.name, &val, sizeof(val), &valLen);
if (0 == valLen)
Expand All @@ -109,7 +109,7 @@ CHIP_ERROR BL602Config::ReadConfigValue(Key key, uint32_t & val)
CHIP_ERROR BL602Config::ReadConfigValue(Key key, uint64_t & val)
{
CHIP_ERROR err = CHIP_NO_ERROR;
size_t valLen = 0;
size_t valLen = 0;

ef_get_env_blob(key.name, &val, sizeof(val), &valLen);
if (0 == valLen)
Expand All @@ -122,7 +122,7 @@ CHIP_ERROR BL602Config::ReadConfigValue(Key key, uint64_t & val)

CHIP_ERROR BL602Config::ReadConfigValueStr(Key key, char * buf, size_t bufSize, size_t & outLen)
{
CHIP_ERROR err = CHIP_NO_ERROR;
CHIP_ERROR err = CHIP_NO_ERROR;

outLen = 0;
ef_get_env_blob(key.name, buf, bufSize, &outLen);
Expand All @@ -136,7 +136,7 @@ CHIP_ERROR BL602Config::ReadConfigValueStr(Key key, char * buf, size_t bufSize,

CHIP_ERROR BL602Config::ReadConfigValueBin(Key key, uint8_t * buf, size_t bufSize, size_t & outLen)
{
CHIP_ERROR err = CHIP_NO_ERROR;
CHIP_ERROR err = CHIP_NO_ERROR;

ef_get_env_blob(key.name, buf, bufSize, &outLen);
if (0 == outLen)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
#include <platform/internal/GenericConfigurationManagerImpl.ipp>

extern "C" {
#include <hal_sys.h>
#include <bl_efuse.h>
#include <easyflash.h>
#include <hal_sys.h>
}

namespace chip {
Expand Down
6 changes: 3 additions & 3 deletions src/platform/bouffalolab/BL602/DiagnosticDataProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
#include <lwip/tcpip.h>

extern "C" {
#include <bl_sys.h>
#include <bl60x_fw_api.h>
#include <bl_efuse.h>
#include <bl60x_wifi_driver/bl_main.h>
#include <bl60x_wifi_driver/wifi_mgmr.h>
#include <bl_efuse.h>
#include <bl_sys.h>
#include <wifi_mgmr_ext.h>
}

Expand Down Expand Up @@ -248,7 +248,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiBssId(ByteSpan & BssId)

CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiSecurityType(uint8_t & securityType)
{
//int authmode;
// int authmode;

// authmode = mgmr_get_security_type();
// securityType = MapAuthModeToSecurityType(authmode);
Expand Down
4 changes: 2 additions & 2 deletions src/platform/bouffalolab/BL602/KeyValueStoreManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Get(const char * key, void * value, size_t
size_t outlen = 0;
BL602Config::Key ckey = { key };

err = BL602Config::ReadConfigValueBin(ckey, (uint8_t *)value, value_size, outlen);
err = BL602Config::ReadConfigValueBin(ckey, (uint8_t *) value, value_size, outlen);
if (CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND == err)
{
err = CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND;
Expand All @@ -69,7 +69,7 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Put(const char * key, const void * value,
CHIP_ERROR err = CHIP_NO_ERROR;
BL602Config::Key ckey = { key };

err = BL602Config::WriteConfigValueBin(ckey, (uint8_t *)value, value_size);
err = BL602Config::WriteConfigValueBin(ckey, (uint8_t *) value, value_size);
if (CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND == err)
{
err = CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND;
Expand Down
6 changes: 3 additions & 3 deletions src/platform/bouffalolab/BL602/NetworkCommissioningDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
*/

#include <aos/yloop.h>
#include <bl60x_wifi_driver/wifi_mgmr.h>
#include <bl60x_wifi_driver/wifi_mgmr_api.h>
#include <hal_wifi.h>
#include <lib/support/CodeUtils.h>
#include <lib/support/SafeInt.h>
#include <lwip/tcpip.h>
#include <platform/CHIPDeviceLayer.h>
#include <platform/bouffalolab/BL602/NetworkCommissioningDriver.h>
#include <lwip/tcpip.h>
#include <bl60x_wifi_driver/wifi_mgmr.h>
#include <bl60x_wifi_driver/wifi_mgmr_api.h>
#include <wifi_mgmr_ext.h>
#include <wifi_mgmr_portable.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
*/

#pragma once
#include <platform/NetworkCommissioning.h>
#include <bl60x_wifi_driver/wifi_mgmr.h>
#include <platform/NetworkCommissioning.h>

namespace chip {
namespace DeviceLayer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
#include <hal_wifi.h>
#include <lib/support/CodeUtils.h>
#include <lib/support/SafeInt.h>
#include <lwip/tcpip.h>
#include <platform/CHIPDeviceLayer.h>
#include <platform/bouffalolab/BL602/NetworkCommissioningDriver.h>
#include <lwip/tcpip.h>
#include <wifi_mgmr_ext.h>

#include <limits>
Expand Down
6 changes: 3 additions & 3 deletions src/platform/bouffalolab/BL602/PlatformManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
#include <platform/bouffalolab/BL602/NetworkCommissioningDriver.h>
#include <platform/internal/GenericPlatformManagerImpl_FreeRTOS.ipp>

#include <utils_log.h>
#include <lwip/tcpip.h>
#include <utils_log.h>

#include <aos/kernel.h>
#include <bl60x_fw_api.h>
Expand Down Expand Up @@ -165,7 +165,7 @@ static void WifiStaConnected(void)
chip::to_underlying(chip::app::Clusters::WiFiNetworkDiagnostics::WiFiConnectionStatus::kConnected));
}
}
typedef void (*aos_event_cb)(input_event_t *event, void *private_data);
typedef void (*aos_event_cb)(input_event_t * event, void * private_data);

void OnWiFiPlatformEvent(input_event_t * event, void * private_data)
{
Expand Down Expand Up @@ -220,7 +220,7 @@ void OnWiFiPlatformEvent(input_event_t * event, void * private_data)

CHIP_ERROR PlatformManagerImpl::_InitChipStack(void)
{
CHIP_ERROR err = CHIP_NO_ERROR;
CHIP_ERROR err = CHIP_NO_ERROR;
static uint8_t stack_wifi_init = 0;
TaskHandle_t backup_eventLoopTask;

Expand Down
Loading

0 comments on commit 763aa5a

Please sign in to comment.