Skip to content

Commit 42421c4

Browse files
authored
Update pigweed to latest master (#36193)
* 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
1 parent a0d7b14 commit 42421c4

File tree

25 files changed

+121
-142
lines changed

25 files changed

+121
-142
lines changed

examples/all-clusters-app/nxp/common/main/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ uint8_t __attribute__((section(".heap"))) ucHeap[configTOTAL_HEAP_SIZE];
3232

3333
using namespace ::chip::DeviceLayer;
3434

35-
extern "C" int main(int argc, char * argv[])
35+
int main(int argc, char * argv[])
3636
{
3737
TaskHandle_t taskHandle;
3838

examples/contact-sensor-app/nxp/common/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ extern "C" void main_task(void const * argument)
3030
chip::NXP::App::GetAppTask().Start();
3131
}
3232
#else
33-
extern "C" int main(int argc, char * argv[])
33+
int main(int argc, char * argv[])
3434
{
3535
chip::DeviceLayer::PlatformMgrImpl().HardwareInit();
3636
chip::NXP::App::GetAppTask().Start();

examples/laundry-washer-app/nxp/common/main/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ uint8_t __attribute__((section(".heap"))) ucHeap[configTOTAL_HEAP_SIZE];
3232

3333
using namespace ::chip::DeviceLayer;
3434

35-
extern "C" int main(int argc, char * argv[])
35+
int main(int argc, char * argv[])
3636
{
3737
TaskHandle_t taskHandle;
3838

examples/light-switch-app/genio/src/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ void vStartTask(void * pvParameters)
251251
* Main Function
252252
****************************************************************************/
253253

254-
extern "C" int main(void)
254+
int main(void)
255255
{
256256
mbedtls_platform_set_calloc_free(CHIPPlatformMemoryCalloc, CHIPPlatformMemoryFree);
257257

examples/lighting-app-data-mode-no-unique-id/linux/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ void ApplicationShutdown()
9595
}
9696
}
9797

98-
extern "C" int main(int argc, char * argv[])
98+
int main(int argc, char * argv[])
9999
{
100100
if (ChipLinuxAppInit(argc, argv) != 0)
101101
{

examples/lighting-app/genio/src/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ void vStartTask(void * pvParameters)
251251
* Main Function
252252
****************************************************************************/
253253

254-
extern "C" int main(void)
254+
int main(void)
255255
{
256256
mbedtls_platform_set_calloc_free(CHIPPlatformMemoryCalloc, CHIPPlatformMemoryFree);
257257

examples/lighting-app/linux/main.cpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,14 @@ void ApplicationShutdown()
9595
}
9696
}
9797

98-
extern "C" int main(int argc, char * argv[])
98+
#ifdef __NuttX__
99+
// NuttX requires the main function to be defined with C-linkage. However, marking
100+
// the main as extern "C" is not strictly conformant with the C++ standard. Since
101+
// clang >= 20 such code triggers -Wmain warning.
102+
extern "C" {
103+
#endif
104+
105+
int main(int argc, char * argv[])
99106
{
100107
if (ChipLinuxAppInit(argc, argv) != 0)
101108
{
@@ -124,3 +131,7 @@ extern "C" int main(int argc, char * argv[])
124131

125132
return 0;
126133
}
134+
135+
#ifdef __NuttX__
136+
}
137+
#endif

examples/lighting-app/nxp/common/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ extern "C" void main_task(void const * argument)
3030
chip::NXP::App::GetAppTask().Start();
3131
}
3232
#else
33-
extern "C" int main(int argc, char * argv[])
33+
int main(int argc, char * argv[])
3434
{
3535
chip::DeviceLayer::PlatformMgrImpl().HardwareInit();
3636
chip::NXP::App::GetAppTask().Start();

examples/lock-app/genio/src/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ void vStartTask(void * pvParameters)
251251
* Main Function
252252
****************************************************************************/
253253

254-
extern "C" int main(void)
254+
int main(void)
255255
{
256256
mbedtls_platform_set_calloc_free(CHIPPlatformMemoryCalloc, CHIPPlatformMemoryFree);
257257

examples/lock-app/nxp/common/main/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ extern "C" void main_task(void const * argument)
3939
chip::NXP::App::GetAppTask().Start();
4040
}
4141
#else
42-
extern "C" int main(int argc, char * argv[])
42+
int main(int argc, char * argv[])
4343
{
4444
chip::DeviceLayer::PlatformMgrImpl().HardwareInit();
4545
chip::NXP::App::GetAppTask().Start();

examples/ota-requestor-app/genio/src/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ void vStartTask(void * pvParameters)
281281
* Main Function
282282
****************************************************************************/
283283

284-
extern "C" int main(void)
284+
int main(void)
285285
{
286286
mbedtls_platform_set_calloc_free(CHIPPlatformMemoryCalloc, CHIPPlatformMemoryFree);
287287

examples/platform/openiotsdk/app/openiotsdk_startup_gcc.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ alignas(8) static uint8_t malloc_mutex_obj[80];
5757

5858
// C runtime import: constructor initialization and main
5959
extern "C" void __libc_init_array(void);
60-
extern "C" int main(void);
60+
int main(void);
6161

6262
// IOT SDK serial declarations
6363
#define STDIN_FILENO 0

examples/shell/genio/src/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ void vStartTask(void * pvParameters)
161161
* Main Function
162162
****************************************************************************/
163163

164-
extern "C" int main(void)
164+
int main(void)
165165
{
166166
mbedtls_platform_set_calloc_free(CHIPPlatformMemoryCalloc, CHIPPlatformMemoryFree);
167167

examples/thermostat/genio/src/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ void vStartTask(void * pvParameters)
251251
* Main Function
252252
****************************************************************************/
253253

254-
extern "C" int main(void)
254+
int main(void)
255255
{
256256
mbedtls_platform_set_calloc_free(CHIPPlatformMemoryCalloc, CHIPPlatformMemoryFree);
257257

examples/thermostat/nxp/common/main/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ uint8_t __attribute__((section(".heap"))) ucHeap[configTOTAL_HEAP_SIZE];
3232

3333
using namespace ::chip::DeviceLayer;
3434

35-
extern "C" int main(int argc, char * argv[])
35+
int main(int argc, char * argv[])
3636
{
3737
TaskHandle_t taskHandle;
3838

scripts/BUILD.gn

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import("$dir_pw_build/python_dist.gni")
2020

2121
# This target creates a single Python package and wheel for yamltests. It will
2222
# merge all Python dependencies Matter. The output is located in:
23-
# out/obj/matter_yamltests_distribution/ <- source files here
24-
# out/obj/matter_yamltests_distribution._build_wheel/matter_yamltests-0.0.1-py3-none-any.whl
23+
# out/obj/scripts/matter_yamltests_distribution/ <- source files here
24+
# out/obj/scripts/matter_yamltests_distribution._build_wheel/matter_yamltests-0.0.1-py3-none-any.whl
2525
pw_python_distribution("matter_yamltests_distribution") {
2626
packages = [ "${chip_root}/scripts/py_matter_yamltests:matter_yamltests" ]
2727
generate_setup_cfg = {

scripts/build_python.sh

+5-23
Original file line numberDiff line numberDiff line change
@@ -175,22 +175,6 @@ tracing_options="matter_log_json_payload_hex=true matter_log_json_payload_decode
175175

176176
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\""
177177

178-
function ninja_target() {
179-
# Print the ninja target required to build a gn label.
180-
local GN_LABEL="$1"
181-
local NINJA_TARGET="$(gn ls "$OUTPUT_ROOT" --as=output "$GN_LABEL")"
182-
echo "$NINJA_TARGET"
183-
}
184-
185-
function wheel_output_dir() {
186-
# Print the wheel output directory for a pw_python_package or
187-
# pw_python_distribution. The label must end in "._build_wheel".
188-
local GN_LABEL="$1"
189-
local NINJA_TARGET="$(ninja_target "$GN_LABEL")"
190-
local WHEEL_DIR="$OUTPUT_ROOT"/"$(dirname "$NINJA_TARGET")/$(basename -s .stamp "$NINJA_TARGET")"
191-
echo "$WHEEL_DIR"
192-
}
193-
194178
# Compile Python wheels
195179
ninja -C "$OUTPUT_ROOT" python_wheels
196180

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

187+
if [ "$install_pytest_requirements" = "yes" ]; then
188+
# Add the matter_yamltests_distribution wheel
189+
WHEEL+=("$OUTPUT_ROOT"/obj/scripts/matter_yamltests_distribution._build_wheel/matter_yamltests-*.whl)
190+
fi
191+
203192
if [ -n "$extra_packages" ]; then
204193
WHEEL+=("$extra_packages")
205194
fi
@@ -221,14 +210,7 @@ if [ -n "$install_virtual_env" ]; then
221210
"$ENVIRONMENT_ROOT"/bin/python -m pip install --upgrade "${WHEEL[@]}"
222211

223212
if [ "$install_pytest_requirements" = "yes" ]; then
224-
YAMLTESTS_GN_LABEL="//scripts:matter_yamltests_distribution._build_wheel"
225-
# Add wheels from pw_python_package or pw_python_distribution templates.
226-
YAMLTEST_WHEEL=(
227-
"$(ls -tr "$(wheel_output_dir "$YAMLTESTS_GN_LABEL")"/*.whl | head -n 1)"
228-
)
229-
230213
echo_blue "Installing python test dependencies ..."
231-
"$ENVIRONMENT_ROOT"/bin/pip install --upgrade "${YAMLTEST_WHEEL[@]}"
232214
"$ENVIRONMENT_ROOT"/bin/pip install -r "$CHIP_ROOT/scripts/tests/requirements.txt"
233215
"$ENVIRONMENT_ROOT"/bin/pip install -r "$CHIP_ROOT/src/python_testing/requirements.txt"
234216
fi

0 commit comments

Comments
 (0)