Skip to content

Commit

Permalink
Update pigweed to latest master (#36193)
Browse files Browse the repository at this point in the history
* Update pigweed to latest master

* Fix matter_yamltests_distribution path after pigweed update

* Regen configs

* Drop `extern "C"` from main functions

* Workaround for NuttX platform linking C++ main as C

* Update pigweed
  • Loading branch information
arkq authored Oct 23, 2024
1 parent a0d7b14 commit 42421c4
Show file tree
Hide file tree
Showing 25 changed files with 121 additions and 142 deletions.
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
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
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 42421c4

Please sign in to comment.