Skip to content

Commit

Permalink
Merge branch 'master' into TC-OPCREDS-3.3-isssue-356
Browse files Browse the repository at this point in the history
  • Loading branch information
raul-marquez-csa authored Oct 23, 2024
2 parents 2023b0e + 197f698 commit 7bc2e16
Show file tree
Hide file tree
Showing 59 changed files with 1,243 additions and 532 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/examples-efr32.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
if: github.actor != 'restyled-io[bot]'

container:
image: ghcr.io/project-chip/chip-build-efr32:84
image: ghcr.io/project-chip/chip-build-efr32:85
volumes:
- "/tmp/bloat_reports:/tmp/bloat_reports"
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
runs-on: ubuntu-latest

container:
image: ghcr.io/project-chip/chip-build-efr32:84
image: ghcr.io/project-chip/chip-build-efr32:85
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
[submodule "third_party/silabs/simplicity_sdk"]
path = third_party/silabs/simplicity_sdk
url = https://github.com/SiliconLabs/simplicity_sdk.git
branch = v2024.6.1-0
branch = v2024.6.2
platforms = silabs
[submodule "third_party/silabs/wiseconnect-wifi-bt-sdk"]
path = third_party/silabs/wiseconnect-wifi-bt-sdk
Expand Down
51 changes: 30 additions & 21 deletions docs/development_controllers/chip-tool/chip_tool_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,29 @@ the setup payload or performing discovery actions.

<hr>

## Source files
## Installation

You can find source files of the CHIP Tool in the `examples/chip-tool`
directory.

> **Note:** The CHIP Tool caches the configuration state in the
> `/tmp/chip_tool_config.ini` file. Deleting this and other `.ini` files in the
> `/tmp` directory can sometimes resolve issues related to stale configuration.
On Linux distributions
[running snapd](https://snapcraft.io/docs/installing-snapd), such as Ubuntu, the
CHIP Tool can be installed using the
[chip-tool snap](https://snapcraft.io/chip-tool). To do this, run:

> **Note:** To make the configuration persistent (since `/tmp` directory might
> be flushed at each reboot) you can change the directory where CHIP Tool caches
> its configuration by using the option `--storage-directory`
```
sudo snap install chip-tool
```

<hr>
## Building from source

## Building and running the CHIP Tool
The source files of the CHIP Tool are available in the `examples/chip-tool`
directory.

Before you can use the CHIP Tool, you must compile it from source on Linux
(amd64/aarch64) or macOS. If you want to run it on Raspberry Pi, it must use a
64-bit OS.
The source can be compiled on Linux (amd64/aarch64) or macOS. If you want to run
it on Raspberry Pi, you must use a 64-bit OS.

> **Note:** To ensure compatibility, always build the CHIP Tool and the Matter
> device from the same revision of the `connectedhomeip` repository.
### Building the CHIP Tool

To build and run the CHIP Tool:
To build the CHIP Tool:

1. Install all required packages for Matter and prepare the source code and the
build system. Read the [Building Matter](../../guides/BUILDING.md) guide for
Expand All @@ -50,10 +46,16 @@ To build and run the CHIP Tool:
In this command, `BUILD_PATH` specifies where the target binaries are to be
placed.

### Running the CHIP Tool
## Running the CHIP Tool

If you installed the CHIP Tool as a snap, the command to run it would be:

```
$ chip-tool
```

To check if the CHIP Tool runs correctly, execute the following command from the
`BUILD_PATH` directory:
If you compiled the CHIP Tool from source, it can be executed with the following
command from the `BUILD_PATH` directory:

```
$ ./chip-tool
Expand All @@ -68,6 +70,13 @@ more complex command by appending it with sub-commands. Examples of specific
commands and their use cases are described in the
[Supported commands and options](#supported-commands-and-options) section.

> **Note:** The CHIP Tool caches the configuration state in the
> `/tmp/chip_tool_config.ini` file. Deleting this and other `.ini` files in the
> `/tmp` directory can sometimes resolve issues related to stale configuration.
> To make the configuration persistent you can change the directory where CHIP
> Tool caches its configuration by using the command line option
> `--storage-directory`
<hr>

## CHIP Tool modes
Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-app/nxp/common/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ uint8_t __attribute__((section(".heap"))) ucHeap[configTOTAL_HEAP_SIZE];

using namespace ::chip::DeviceLayer;

extern "C" int main(int argc, char * argv[])
int main(int argc, char * argv[])
{
TaskHandle_t taskHandle;

Expand Down
2 changes: 1 addition & 1 deletion examples/contact-sensor-app/nxp/common/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ extern "C" void main_task(void const * argument)
chip::NXP::App::GetAppTask().Start();
}
#else
extern "C" int main(int argc, char * argv[])
int main(int argc, char * argv[])
{
chip::DeviceLayer::PlatformMgrImpl().HardwareInit();
chip::NXP::App::GetAppTask().Start();
Expand Down
2 changes: 1 addition & 1 deletion examples/laundry-washer-app/nxp/common/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ uint8_t __attribute__((section(".heap"))) ucHeap[configTOTAL_HEAP_SIZE];

using namespace ::chip::DeviceLayer;

extern "C" int main(int argc, char * argv[])
int main(int argc, char * argv[])
{
TaskHandle_t taskHandle;

Expand Down
2 changes: 1 addition & 1 deletion examples/light-switch-app/genio/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ void vStartTask(void * pvParameters)
* Main Function
****************************************************************************/

extern "C" int main(void)
int main(void)
{
mbedtls_platform_set_calloc_free(CHIPPlatformMemoryCalloc, CHIPPlatformMemoryFree);

Expand Down
4 changes: 2 additions & 2 deletions examples/light-switch-app/nrfconnect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ same Matter network.
To perform the unicast binding process, complete the following steps:

1. Build the CHIP Tool according to the steps from the
[CHIP Tool user guide](../../../docs/development_controllers/chip-tool/chip_tool_guide.md#building-and-running-the-chip-tool).
[CHIP Tool user guide](../../../docs/development_controllers/chip-tool/chip_tool_guide.md#building-from-source).
2. Go to the CHIP Tool build directory.
3. Add an ACL to the development kit that is programmed with the
[Lighting Application Example](../../lighting-app/nrfconnect/README.md) by
Expand Down Expand Up @@ -690,7 +690,7 @@ same Matter network.
To perform the unicast binding process, complete the following steps:

1. Build the CHIP Tool according to the steps from the
[CHIP Tool user guide](../../../docs/development_controllers/chip-tool/chip_tool_guide.md#building-and-running-the-chip-tool).
[CHIP Tool user guide](../../../docs/development_controllers/chip-tool/chip_tool_guide.md#building-from-source).
2. Go to the CHIP Tool build directory.

3. Add the light switch device to the multicast group by running the following
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void ApplicationShutdown()
}
}

extern "C" int main(int argc, char * argv[])
int main(int argc, char * argv[])
{
if (ChipLinuxAppInit(argc, argv) != 0)
{
Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/genio/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ void vStartTask(void * pvParameters)
* Main Function
****************************************************************************/

extern "C" int main(void)
int main(void)
{
mbedtls_platform_set_calloc_free(CHIPPlatformMemoryCalloc, CHIPPlatformMemoryFree);

Expand Down
13 changes: 12 additions & 1 deletion examples/lighting-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,14 @@ void ApplicationShutdown()
}
}

extern "C" int main(int argc, char * argv[])
#ifdef __NuttX__
// NuttX requires the main function to be defined with C-linkage. However, marking
// the main as extern "C" is not strictly conformant with the C++ standard. Since
// clang >= 20 such code triggers -Wmain warning.
extern "C" {
#endif

int main(int argc, char * argv[])
{
if (ChipLinuxAppInit(argc, argv) != 0)
{
Expand Down Expand Up @@ -124,3 +131,7 @@ extern "C" int main(int argc, char * argv[])

return 0;
}

#ifdef __NuttX__
}
#endif
2 changes: 1 addition & 1 deletion examples/lighting-app/nxp/common/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ extern "C" void main_task(void const * argument)
chip::NXP::App::GetAppTask().Start();
}
#else
extern "C" int main(int argc, char * argv[])
int main(int argc, char * argv[])
{
chip::DeviceLayer::PlatformMgrImpl().HardwareInit();
chip::NXP::App::GetAppTask().Start();
Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/genio/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ void vStartTask(void * pvParameters)
* Main Function
****************************************************************************/

extern "C" int main(void)
int main(void)
{
mbedtls_platform_set_calloc_free(CHIPPlatformMemoryCalloc, CHIPPlatformMemoryFree);

Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/nxp/common/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ extern "C" void main_task(void const * argument)
chip::NXP::App::GetAppTask().Start();
}
#else
extern "C" int main(int argc, char * argv[])
int main(int argc, char * argv[])
{
chip::DeviceLayer::PlatformMgrImpl().HardwareInit();
chip::NXP::App::GetAppTask().Start();
Expand Down
2 changes: 1 addition & 1 deletion examples/ota-requestor-app/genio/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ void vStartTask(void * pvParameters)
* Main Function
****************************************************************************/

extern "C" int main(void)
int main(void)
{
mbedtls_platform_set_calloc_free(CHIPPlatformMemoryCalloc, CHIPPlatformMemoryFree);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ alignas(8) static uint8_t malloc_mutex_obj[80];

// C runtime import: constructor initialization and main
extern "C" void __libc_init_array(void);
extern "C" int main(void);
int main(void);

// IOT SDK serial declarations
#define STDIN_FILENO 0
Expand Down
2 changes: 1 addition & 1 deletion examples/shell/genio/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ void vStartTask(void * pvParameters)
* Main Function
****************************************************************************/

extern "C" int main(void)
int main(void)
{
mbedtls_platform_set_calloc_free(CHIPPlatformMemoryCalloc, CHIPPlatformMemoryFree);

Expand Down
2 changes: 1 addition & 1 deletion examples/thermostat/genio/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ void vStartTask(void * pvParameters)
* Main Function
****************************************************************************/

extern "C" int main(void)
int main(void)
{
mbedtls_platform_set_calloc_free(CHIPPlatformMemoryCalloc, CHIPPlatformMemoryFree);

Expand Down
2 changes: 1 addition & 1 deletion examples/thermostat/nxp/common/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ uint8_t __attribute__((section(".heap"))) ucHeap[configTOTAL_HEAP_SIZE];

using namespace ::chip::DeviceLayer;

extern "C" int main(int argc, char * argv[])
int main(int argc, char * argv[])
{
TaskHandle_t taskHandle;

Expand Down
14 changes: 7 additions & 7 deletions integrations/cloudbuild/smoke-test.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
steps:
- name: "ghcr.io/project-chip/chip-build-vscode:84"
- name: "ghcr.io/project-chip/chip-build-vscode:85"
entrypoint: "bash"
args:
- "-c"
- |
git config --global --add safe.directory "*"
python scripts/checkout_submodules.py --shallow --recursive --platform esp32 nrfconnect silabs linux android
id: Submodules
- name: "ghcr.io/project-chip/chip-build-vscode:84"
- name: "ghcr.io/project-chip/chip-build-vscode:85"
# NOTE: silabs boostrap is NOT done with the rest as it requests a conflicting
# jinja2 version (asks for 3.1.3 when constraints.txt asks for 3.0.3)
env:
Expand All @@ -24,7 +24,7 @@ steps:
path: /pwenv
timeout: 900s

- name: "ghcr.io/project-chip/chip-build-vscode:84"
- name: "ghcr.io/project-chip/chip-build-vscode:85"
id: ESP32
env:
- PW_ENVIRONMENT_ROOT=/pwenv
Expand All @@ -45,7 +45,7 @@ steps:
volumes:
- name: pwenv
path: /pwenv
- name: "ghcr.io/project-chip/chip-build-vscode:84"
- name: "ghcr.io/project-chip/chip-build-vscode:85"
id: NRFConnect
env:
- PW_ENVIRONMENT_ROOT=/pwenv
Expand All @@ -66,7 +66,7 @@ steps:
- name: pwenv
path: /pwenv

- name: "ghcr.io/project-chip/chip-build-vscode:84"
- name: "ghcr.io/project-chip/chip-build-vscode:85"
id: EFR32
env:
- PW_ENVIRONMENT_ROOT=/pwenv
Expand All @@ -88,7 +88,7 @@ steps:
- name: pwenv
path: /pwenv

- name: "ghcr.io/project-chip/chip-build-vscode:84"
- name: "ghcr.io/project-chip/chip-build-vscode:85"
id: Linux
env:
- PW_ENVIRONMENT_ROOT=/pwenv
Expand Down Expand Up @@ -141,7 +141,7 @@ steps:
- name: pwenv
path: /pwenv

- name: "ghcr.io/project-chip/chip-build-vscode:84"
- name: "ghcr.io/project-chip/chip-build-vscode:85"
id: Android
env:
- PW_ENVIRONMENT_ROOT=/pwenv
Expand Down
4 changes: 2 additions & 2 deletions scripts/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import("$dir_pw_build/python_dist.gni")

# This target creates a single Python package and wheel for yamltests. It will
# merge all Python dependencies Matter. The output is located in:
# out/obj/matter_yamltests_distribution/ <- source files here
# out/obj/matter_yamltests_distribution._build_wheel/matter_yamltests-0.0.1-py3-none-any.whl
# out/obj/scripts/matter_yamltests_distribution/ <- source files here
# out/obj/scripts/matter_yamltests_distribution._build_wheel/matter_yamltests-0.0.1-py3-none-any.whl
pw_python_distribution("matter_yamltests_distribution") {
packages = [ "${chip_root}/scripts/py_matter_yamltests:matter_yamltests" ]
generate_setup_cfg = {
Expand Down
28 changes: 5 additions & 23 deletions scripts/build_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -175,22 +175,6 @@ tracing_options="matter_log_json_payload_hex=true matter_log_json_payload_decode

gn --root="$CHIP_ROOT" gen "$OUTPUT_ROOT" --args="$tracing_options chip_detail_logging=$chip_detail_logging chip_project_config_include_dirs=[\"//config/python\"] $chip_mdns_arg $chip_case_retry_arg $pregen_dir_arg chip_config_network_layer_ble=$enable_ble chip_enable_ble=$enable_ble chip_crypto=\"boringssl\""

function ninja_target() {
# Print the ninja target required to build a gn label.
local GN_LABEL="$1"
local NINJA_TARGET="$(gn ls "$OUTPUT_ROOT" --as=output "$GN_LABEL")"
echo "$NINJA_TARGET"
}

function wheel_output_dir() {
# Print the wheel output directory for a pw_python_package or
# pw_python_distribution. The label must end in "._build_wheel".
local GN_LABEL="$1"
local NINJA_TARGET="$(ninja_target "$GN_LABEL")"
local WHEEL_DIR="$OUTPUT_ROOT"/"$(dirname "$NINJA_TARGET")/$(basename -s .stamp "$NINJA_TARGET")"
echo "$WHEEL_DIR"
}

# Compile Python wheels
ninja -C "$OUTPUT_ROOT" python_wheels

Expand All @@ -200,6 +184,11 @@ WHEEL=("$OUTPUT_ROOT"/controller/python/chip*.whl)
# Add the matter_testing_infrastructure wheel
WHEEL+=("$OUTPUT_ROOT"/python/obj/src/python_testing/matter_testing_infrastructure/chip-testing._build_wheel/chip_testing-*.whl)

if [ "$install_pytest_requirements" = "yes" ]; then
# Add the matter_yamltests_distribution wheel
WHEEL+=("$OUTPUT_ROOT"/obj/scripts/matter_yamltests_distribution._build_wheel/matter_yamltests-*.whl)
fi

if [ -n "$extra_packages" ]; then
WHEEL+=("$extra_packages")
fi
Expand All @@ -221,14 +210,7 @@ if [ -n "$install_virtual_env" ]; then
"$ENVIRONMENT_ROOT"/bin/python -m pip install --upgrade "${WHEEL[@]}"

if [ "$install_pytest_requirements" = "yes" ]; then
YAMLTESTS_GN_LABEL="//scripts:matter_yamltests_distribution._build_wheel"
# Add wheels from pw_python_package or pw_python_distribution templates.
YAMLTEST_WHEEL=(
"$(ls -tr "$(wheel_output_dir "$YAMLTESTS_GN_LABEL")"/*.whl | head -n 1)"
)

echo_blue "Installing python test dependencies ..."
"$ENVIRONMENT_ROOT"/bin/pip install --upgrade "${YAMLTEST_WHEEL[@]}"
"$ENVIRONMENT_ROOT"/bin/pip install -r "$CHIP_ROOT/scripts/tests/requirements.txt"
"$ENVIRONMENT_ROOT"/bin/pip install -r "$CHIP_ROOT/src/python_testing/requirements.txt"
fi
Expand Down
Loading

0 comments on commit 7bc2e16

Please sign in to comment.