Skip to content

Commit

Permalink
Rework efr32 build script, add some info for SED build in the example…
Browse files Browse the repository at this point in the history
…s readme & restyle
  • Loading branch information
jmartinez-silabs committed Jan 24, 2022
1 parent 9dd2eb5 commit edaa4bd
Show file tree
Hide file tree
Showing 14 changed files with 235 additions and 99 deletions.
2 changes: 1 addition & 1 deletion examples/lighting-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ declare_args() {

# Enable Sleepy end device
sleepy_device = false

# Wifi related stuff - they are overriden by gn -args="use_wf200=true"
use_wf200 = false
use_rs911x = false
Expand Down
21 changes: 19 additions & 2 deletions examples/lighting-app/efr32/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Silicon Labs platform.
$ cd ~/connectedhomeip
$ rm -rf ./out/

OR use GN/Ninja directly
OR use GN/Ninja directly

$ cd ~/connectedhomeip/examples/lighting-app/efr32
$ git submodule update --init
Expand All @@ -99,7 +99,19 @@ OR use GN/Ninja directly
$ cd ~/connectedhomeip/examples/lighting-app/efr32
$ rm -rf out/

* Build the example with pigweed RCP use GN/Ninja Directly
* Build the example as Sleepy End Device (SED)

$ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32/ ./out/lighting-app_SED BRD4161A --sed

or use gn as previously mentioned but adding the following arguments:

$ gn gen out/debug '--args=efr32_board="BRD4161A" sleepy_device=true chip_openthread_ftd=false'

* Build the example with pigweed RCP

$ ./scripts/examples/gn_efr32_example.sh examples/lighting-app/efr32/ out/lighting_app_rpc BRD4161A 'import("//with_pw_rpc.gni")'

or use GN/Ninja Directly

$ cd ~/connectedhomeip/examples/lighting-app/efr32
$ git submodule update --init
Expand All @@ -110,6 +122,11 @@ OR use GN/Ninja directly

[Running Pigweed RPC console](#running-pigweed-rpc-console)

For more build options, help is provided when running the build script without
arguments

./scripts/examples/gn_efr32_example.sh

<a name="flashing"></a>

## Flashing the Application
Expand Down
3 changes: 1 addition & 2 deletions examples/lighting-app/efr32/include/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,12 @@ extern "C" {
* See http://www.freertos.org/a00110.html.
*----------------------------------------------------------*/


/* Energy saving modes. */
#if defined(SL_CATALOG_POWER_MANAGER_PRESENT)
#define configUSE_TICKLESS_IDLE 1
#else
#define configUSE_TICKLESS_IDLE 0
#endif //SL_CATALOG_POWER_MANAGER_PRESENT
#endif // SL_CATALOG_POWER_MANAGER_PRESENT

#define configTICK_RATE_HZ (1000)
/* Definition used by Keil to replace default system clock source. */
Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ declare_args() {

# Monitor & log memory usage at runtime.
enable_heap_monitoring = false

# Enable Sleepy end device
sleepy_device = false

Expand Down
31 changes: 30 additions & 1 deletion examples/lock-app/efr32/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Silicon Labs platform.
$ cd ~/connectedhomeip
$ rm -rf ./out/

OR use GN/Ninja directly
OR use GN/Ninja directly

$ cd ~/connectedhomeip/examples/lock-app/efr32
$ git submodule update --init
Expand All @@ -98,6 +98,35 @@ OR use GN/Ninja directly
$ cd ~/connectedhomeip/examples/lock-app/efr32
$ rm -rf out/


* Build the example as Sleepy End Device (SED)

$ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32/ ./out/lighting-app_SED BRD4161A --sed

or use gn as previously mentioned but adding the following arguments:

$ gn gen out/debug '--args=efr32_board="BRD4161A" sleepy_device=true chip_openthread_ftd=false'

* Build the example with pigweed RCP

$ ./scripts/examples/gn_efr32_example.sh examples/lock-app/efr32/ out/lock_app_rpc BRD4161A 'import("//with_pw_rpc.gni")'

or use GN/Ninja Directly

$ cd ~/connectedhomeip/examples/lock-app/efr32
$ git submodule update --init
$ source third_party/connectedhomeip/scripts/activate.sh
$ export EFR32_BOARD=BRD4161A
$ gn gen out/debug --args='import("//with_pw_rpc.gni")'
$ ninja -C out/debug

[Running Pigweed RPC console](#running-pigweed-rpc-console)

For more build options, help is provided when running the build script without
arguments

./scripts/examples/gn_efr32_example.sh

<a name="flashing"></a>

## Flashing the Application
Expand Down
3 changes: 1 addition & 2 deletions examples/lock-app/efr32/include/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,12 @@ extern "C" {
* See http://www.freertos.org/a00110.html.
*----------------------------------------------------------*/


/* Energy saving modes. */
#if defined(SL_CATALOG_POWER_MANAGER_PRESENT)
#define configUSE_TICKLESS_IDLE 1
#else
#define configUSE_TICKLESS_IDLE 0
#endif //SL_CATALOG_POWER_MANAGER_PRESENT
#endif // SL_CATALOG_POWER_MANAGER_PRESENT

#define configTICK_RATE_HZ (1000)
/* Definition used by Keil to replace default system clock source. */
Expand Down
15 changes: 15 additions & 0 deletions examples/platform/efr32/uart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ extern "C" {
#include <stddef.h>
#include <string.h>

#if defined(SL_CATALOG_POWER_MANAGER_PRESENT)
#include "sl_power_manager.h"
#endif

#if !defined(MIN)
#define MIN(A, B) ((A) < (B) ? (A) : (B))
#endif
Expand Down Expand Up @@ -245,13 +249,24 @@ int16_t uartConsoleWrite(const char * Buf, uint16_t BufLength)
return UART_CONSOLE_ERR;
}

#if defined(SL_CATALOG_POWER_MANAGER_PRESENT)
sl_power_manager_add_em_requirement(SL_POWER_MANAGER_EM1);
#endif

// Use of ForceTransmit here. Transmit with DMA was causing errors with PW_RPC
// TODO Use DMA and find/fix what causes the issue with PW
if (UARTDRV_ForceTransmit(sl_uartdrv_usart_vcom_handle, (uint8_t *) Buf, BufLength) == ECODE_EMDRV_UARTDRV_OK)
{
#if defined(SL_CATALOG_POWER_MANAGER_PRESENT)
sl_power_manager_remove_em_requirement(SL_POWER_MANAGER_EM1);
#endif
return BufLength;
}

#if defined(SL_CATALOG_POWER_MANAGER_PRESENT)
sl_power_manager_remove_em_requirement(SL_POWER_MANAGER_EM1);
#endif

return UART_CONSOLE_ERR;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/window-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ declare_args() {

# Enable Sleepy end device
sleepy_device = false

# Wifi related stuff - they are overriden by gn -args="use_wf200=true"
use_wf200 = false
use_rs911x = false
Expand Down
21 changes: 19 additions & 2 deletions examples/window-app/efr32/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Silicon Labs platform.
$ cd ~/connectedhomeip
$ rm -rf ./out/

OR use GN/Ninja directly
OR use GN/Ninja directly

$ cd ~/connectedhomeip/examples/window-app/efr32
$ git submodule update --init
Expand All @@ -103,7 +103,19 @@ OR use GN/Ninja directly
$ cd ~/connectedhomeip/examples/window-app/efr32
$ rm -rf out/

* Build the example with pigweed RCP use GN/Ninja Directly
* Build the example as Sleepy End Device (SED)

$ ./scripts/examples/gn_efr32_example.sh ./examples/window-app/efr32/ ./out/window-app_SED BRD4161A --sed

or use gn as previously mentioned but adding the following arguments:

$ gn gen out/debug '--args=efr32_board="BRD4161A" sleepy_device=true chip_openthread_ftd=false'

* Build the example with pigweed RCP

$ ./scripts/examples/gn_efr32_example.sh examples/window-app/efr32/ out/window_app_rpc BRD4161A 'import("//with_pw_rpc.gni")'

or use GN/Ninja Directly

$ cd ~/connectedhomeip/examples/window-app/efr32
$ git submodule update --init
Expand All @@ -114,6 +126,11 @@ OR use GN/Ninja directly

[Running Pigweed RPC console](#running-pigweed-rpc-console)

For more build options, help is provided when running the build script without
arguments

./scripts/examples/gn_efr32_example.sh

<a name="flashing"></a>

## Flashing the Application
Expand Down
3 changes: 1 addition & 2 deletions examples/window-app/efr32/include/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,12 @@ extern "C" {
* See http://www.freertos.org/a00110.html.
*----------------------------------------------------------*/


/* Energy saving modes. */
#if defined(SL_CATALOG_POWER_MANAGER_PRESENT)
#define configUSE_TICKLESS_IDLE 1
#else
#define configUSE_TICKLESS_IDLE 0
#endif //SL_CATALOG_POWER_MANAGER_PRESENT
#endif // SL_CATALOG_POWER_MANAGER_PRESENT

#define configTICK_RATE_HZ (1000)
/* Definition used by Keil to replace default system clock source. */
Expand Down
Loading

0 comments on commit edaa4bd

Please sign in to comment.