Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Silabs] EFR32 common files modification, logging and some extra changes #23751

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
adding logs to places where it was missed for the build to pass
  • Loading branch information
chirag-silabs committed Nov 24, 2022
commit 86d3417e9f20c6115ef2d7d5374f24d3b03df40c
4 changes: 2 additions & 2 deletions examples/chef/efr32/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
extern "C" {
#endif

void efr32InitLog(void);
void silabsInitLog(void);

void efr32Log(const char * aFormat, ...);
#define EFR32_LOG(...) efr32Log(__VA_ARGS__);
#define SILABS_LOG(...) efr32Log(__VA_ARGS__);
void appError(int err);

#ifdef __cplusplus
Expand Down
6 changes: 3 additions & 3 deletions examples/chef/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ CHIP_ERROR AppTask::Init()
err = BaseApplication::Init(&gIdentify);
if (err != CHIP_NO_ERROR)
{
EFR32_LOG("BaseApplication::Init() failed");
SILABS_LOG("BaseApplication::Init() failed");
appError(err);
}

Expand All @@ -155,11 +155,11 @@ void AppTask::AppTaskMain(void * pvParameter)
CHIP_ERROR err = sAppTask.Init();
if (err != CHIP_NO_ERROR)
{
EFR32_LOG("AppTask.Init() failed");
SILABS_LOG("AppTask.Init() failed");
appError(err);
}

EFR32_LOG("App Task started");
SILABS_LOG("App Task started");

while (true)
{
Expand Down
12 changes: 6 additions & 6 deletions examples/chef/efr32/src/LightingManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ CHIP_ERROR LightingManager::Init()

if (sLightTimer == NULL)
{
EFR32_LOG("sLightTimer timer create failed");
SILABS_LOG("sLightTimer timer create failed");
return APP_ERROR_CREATE_TIMER_FAILED;
}

Expand Down Expand Up @@ -125,7 +125,7 @@ void LightingManager::StartTimer(uint32_t aTimeoutMs)
{
if (xTimerIsTimerActive(sLightTimer))
{
EFR32_LOG("app timer already started!");
SILABS_LOG("app timer already started!");
CancelTimer();
}

Expand All @@ -134,7 +134,7 @@ void LightingManager::StartTimer(uint32_t aTimeoutMs)
// cannot immediately be sent to the timer command queue.
if (xTimerChangePeriod(sLightTimer, (aTimeoutMs / portTICK_PERIOD_MS), 100) != pdPASS)
{
EFR32_LOG("sLightTimer timer start() failed");
SILABS_LOG("sLightTimer timer start() failed");
appError(APP_ERROR_START_TIMER_FAILED);
}
}
Expand All @@ -143,7 +143,7 @@ void LightingManager::CancelTimer(void)
{
if (xTimerStop(sLightTimer, 0) == pdFAIL)
{
EFR32_LOG("sLightTimer stop() failed");
SILABS_LOG("sLightTimer stop() failed");
appError(APP_ERROR_STOP_TIMER_FAILED);
}
}
Expand Down Expand Up @@ -183,7 +183,7 @@ void LightingManager::AutoTurnOffTimerEventHandler(AppEvent * aEvent)

light->mAutoTurnOffTimerArmed = false;

EFR32_LOG("Auto Turn Off has been triggered!");
SILABS_LOG("Auto Turn Off has been triggered!");

light->InitiateAction(actor, OFF_ACTION);
}
Expand Down Expand Up @@ -219,7 +219,7 @@ void LightingManager::ActuatorMovementTimerEventHandler(AppEvent * aEvent)

light->mAutoTurnOffTimerArmed = true;

EFR32_LOG("Auto Turn off enabled. Will be triggered in %u seconds", light->mAutoTurnOffDuration);
SILABS_LOG("Auto Turn off enabled. Will be triggered in %u seconds", light->mAutoTurnOffDuration);
}
}
}
6 changes: 3 additions & 3 deletions examples/chef/efr32/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@ int main(void)
#endif
chip::DeviceLayer::PlatformMgr().UnlockChipStack();

EFR32_LOG("Starting App Task");
SILABS_LOG("Starting App Task");
if (AppTask::GetAppTask().StartAppTask() != CHIP_NO_ERROR)
appError(CHIP_ERROR_INTERNAL);

EFR32_LOG("Starting FreeRTOS scheduler");
SILABS_LOG("Starting FreeRTOS scheduler");
sl_system_kernel_start();

// Should never get here.
chip::Platform::MemoryShutdown();
EFR32_LOG("vTaskStartScheduler() failed");
SILABS_LOG("vTaskStartScheduler() failed");
appError(CHIP_ERROR_INTERNAL);
}

Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ CHIP_ERROR AppTask::Init()
err = RegisterLockEvents();
if (err != CHIP_NO_ERROR)
{
EFR32_LOG("RegisterLockEvents() failed");
SILABS_LOG("RegisterLockEvents() failed");
appError(err);
}
#endif // ENABLE_CHIP_SHELL
Expand Down
4 changes: 2 additions & 2 deletions examples/persistent-storage/efr32/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
extern "C" {
#endif

void efr32InitLog(void);
void silabsInitLog(void);

void efr32Log(const char * aFormat, ...);
#define EFR32_LOG(...) efr32Log(__VA_ARGS__);
#define SILABS_LOG(...) efr32Log(__VA_ARGS__);

#ifdef __cplusplus
}
Expand Down
12 changes: 6 additions & 6 deletions examples/persistent-storage/efr32/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void TestTask(void * pvParameter)
{
while (true)
{
EFR32_LOG("Running Tests:");
SILABS_LOG("Running Tests:");
chip::RunKvsTest();
vTaskDelay(60000); // Run every minute
}
Expand All @@ -51,16 +51,16 @@ int main(void)
init_efrPlatform();

chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().Init();
EFR32_LOG("==================================================");
EFR32_LOG("chip-efr32-persitent-storage-example starting");
EFR32_LOG("==================================================");
SILABS_LOG("==================================================");
SILABS_LOG("chip-efr32-persitent-storage-example starting");
SILABS_LOG("==================================================");

// Run tests
xTaskCreate(TestTask, "Test", 2048, NULL, 1, &sTestTaskHandle);
EFR32_LOG("Starting FreeRTOS scheduler");
SILABS_LOG("Starting FreeRTOS scheduler");
sl_system_kernel_start();

// Should never get here.
EFR32_LOG("vTaskStartScheduler() failed");
SILABS_LOG("vTaskStartScheduler() failed");
return -1;
}
2 changes: 1 addition & 1 deletion examples/pigweed-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ efr32_sdk("sdk") {
defines = [
"BOARD_ID=${silabs_board}",
"HAL_VCOM_ENABLE=1",
"EFR32_LOG_ENABLED=1",
"SILABS_LOG_ENABLED=1",
"PW_RPC_ENABLED",
]
}
Expand Down
4 changes: 2 additions & 2 deletions examples/pigweed-app/efr32/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
extern "C" {
#endif

void efr32InitLog(void);
void silabsInitLog(void);
void efr32Log(const char * aFormat, ...);
#define EFR32_LOG(...) efr32Log(__VA_ARGS__);
#define SILABS_LOG(...) efr32Log(__VA_ARGS__);
void appError(int err);

#ifdef __cplusplus
Expand Down
2 changes: 1 addition & 1 deletion examples/pigweed-app/efr32/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void RunRpcService(void *)
int main(void)
{
init_efrPlatform();
EFR32_LOG("***** CHIP EFR32 pigweed example *****\r\n");
SILABS_LOG("***** CHIP EFR32 pigweed example *****\r\n");

pw_sys_io_Init();
// Initialize LEDs
Expand Down
4 changes: 2 additions & 2 deletions examples/shell/efr32/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@
extern "C" {
#endif

void efr32InitLog(void);
void silabsInitLog(void);

void efr32Log(const char * aFormat, ...);
#define EFR32_LOG(...) efr32Log(__VA_ARGS__);
#define SILABS_LOG(...) efr32Log(__VA_ARGS__);
void appError(int err);

#ifdef __cplusplus
Expand Down
26 changes: 13 additions & 13 deletions examples/shell/efr32/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ using chip::Shell::Engine;

void appError(int err)
{
EFR32_LOG("!!!!!!!!!!!! App Critical Error: %d !!!!!!!!!!!", err);
SILABS_LOG("!!!!!!!!!!!! App Critical Error: %d !!!!!!!!!!!", err);
portDISABLE_INTERRUPTS();
while (true)
;
Expand Down Expand Up @@ -102,56 +102,56 @@ int main(void)
MemMonitoring::startHeapMonitoring();
#endif

EFR32_LOG("==================================================");
EFR32_LOG("chip-efr32-shell-example starting");
EFR32_LOG("==================================================");
SILABS_LOG("==================================================");
SILABS_LOG("chip-efr32-shell-example starting");
SILABS_LOG("==================================================");

EFR32_LOG("Init CHIP Stack");
SILABS_LOG("Init CHIP Stack");

// Init Chip memory management before the stack
chip::Platform::MemoryInit();

CHIP_ERROR ret = PlatformMgr().InitChipStack();
if (ret != CHIP_NO_ERROR)
{
EFR32_LOG("PlatformMgr().InitChipStack() failed");
SILABS_LOG("PlatformMgr().InitChipStack() failed");
appError(ret);
}
chip::DeviceLayer::ConnectivityMgr().SetBLEDeviceName("EFR32_SHELL");

EFR32_LOG("Starting Platform Manager Event Loop");
SILABS_LOG("Starting Platform Manager Event Loop");
ret = PlatformMgr().StartEventLoopTask();
if (ret != CHIP_NO_ERROR)
{
EFR32_LOG("PlatformMgr().StartEventLoopTask() failed");
SILABS_LOG("PlatformMgr().StartEventLoopTask() failed");
appError(ret);
}

#if CHIP_ENABLE_OPENTHREAD
EFR32_LOG("Initializing OpenThread stack");
SILABS_LOG("Initializing OpenThread stack");
ret = ThreadStackMgr().InitThreadStack();
if (ret != CHIP_NO_ERROR)
{
EFR32_LOG("ThreadStackMgr().InitThreadStack() failed");
SILABS_LOG("ThreadStackMgr().InitThreadStack() failed");
appError(ret);
}

ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router);
if (ret != CHIP_NO_ERROR)
{
EFR32_LOG("ConnectivityMgr().SetThreadDeviceType() failed");
SILABS_LOG("ConnectivityMgr().SetThreadDeviceType() failed");
appError(ret);
}
#endif // CHIP_ENABLE_OPENTHREAD

#if CHIP_ENABLE_OPENTHREAD
EFR32_LOG("Starting OpenThread task");
SILABS_LOG("Starting OpenThread task");

// Start OpenThread task
ret = ThreadStackMgrImpl().StartThreadTask();
if (ret != CHIP_NO_ERROR)
{
EFR32_LOG("ThreadStackMgr().StartThreadTask() failed");
SILABS_LOG("ThreadStackMgr().StartThreadTask() failed");
appError(ret);
}
#endif // CHIP_ENABLE_OPENTHREAD
Expand Down
2 changes: 1 addition & 1 deletion src/test_driver/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ efr32_sdk("sdk") {

defines = [
"BOARD_ID=${silabs_board}",
"EFR32_LOG_ENABLED=1",
"SILABS_LOG_ENABLED=1",
"PW_RPC_ENABLED",

# Thread is built but test driver do not have the NETWORK_COMMISSIONING cluster or zap config.
Expand Down
4 changes: 2 additions & 2 deletions src/test_driver/efr32/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
extern "C" {
#endif

void efr32InitLog(void);
void silabsInitLog(void);
void efr32Log(const char * aFormat, ...);
#define EFR32_LOG(...) efr32Log(__VA_ARGS__);
#define SILABS_LOG(...) efr32Log(__VA_ARGS__);
void appError(int err);

#ifdef __cplusplus
Expand Down
6 changes: 3 additions & 3 deletions src/test_driver/efr32/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,15 @@ int main(void)

chip::DeviceLayer::PlatformMgr().InitChipStack();

EFR32_LOG("***** CHIP EFR32 device tests *****\r\n");
SILABS_LOG("***** CHIP EFR32 device tests *****\r\n");

// Start RPC service which runs the tests.
sTestTaskHandle = xTaskCreateStatic(RunRpcService, "RPC_TEST_TASK", ArraySize(sTestTaskStack), nullptr, TEST_TASK_PRIORITY,
sTestTaskStack, &sTestTaskBuffer);
EFR32_LOG("Starting FreeRTOS scheduler");
SILABS_LOG("Starting FreeRTOS scheduler");
sl_system_kernel_start();

// Should never get here.
EFR32_LOG("vTaskStartScheduler() failed");
SILABS_LOG("vTaskStartScheduler() failed");
return -1;
}