Skip to content

Commit 20fcb76

Browse files
medinandresandy31415andreilitvin
authored
Add support for linux 32bit builds (project-chip#71867)
* Add support for linux 32bit builds * Added necessary entries in targets.py and host.py to allow linux ARM builds. * Updated a few *.cpp files to use standard printing format to pass compilation. * Address review feedback related to formatting types * Fix unit test * Recreate targets file again... --------- Co-authored-by: Andrei Litvin <andy314@gmail.com> Co-authored-by: Andrei Litvin <andreilitvin@google.com>
1 parent cee6c49 commit 20fcb76

5 files changed

Lines changed: 19 additions & 6 deletions

File tree

scripts/build/build/targets.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ def BuildHostTarget():
118118
if cross_compile:
119119
board_parts.append(TargetPart(
120120
'arm64', board=HostBoard.ARM64).OnlyIfRe('-(clang|nodeps)'))
121+
board_parts.append(TargetPart(
122+
'arm', board=HostBoard.ARM).OnlyIfRe('-(clang|nodeps)'))
121123

122124
target.AppendFixedTargets(board_parts)
123125

scripts/build/builders/host.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ class HostBoard(Enum):
365365

366366
# cross-compile support
367367
ARM64 = auto()
368+
ARM = auto()
368369

369370
# for test support
370371
FAKE = auto()
@@ -385,6 +386,8 @@ def BoardName(self):
385386
return arch
386387
if self == HostBoard.ARM64:
387388
return 'arm64'
389+
if self == HostBoard.ARM:
390+
return 'arm'
388391
if self == HostBoard.FAKE:
389392
return 'fake'
390393
raise Exception('Unknown host board type: %r' % self)
@@ -614,13 +617,13 @@ def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE,
614617

615618
self.extra_gn_options.append('chip_system_config_use_openthread_inet_endpoints=true')
616619

617-
if self.board == HostBoard.ARM64:
620+
if self.board in (HostBoard.ARM64, HostBoard.ARM):
618621
if not use_clang:
619622
raise Exception("Cross compile only supported using clang")
620623

621624
if app == HostApp.CERT_TOOL:
622625
# Certification only built for openssl
623-
if self.board == HostBoard.ARM64 and crypto_library == HostCryptoLibrary.MBEDTLS:
626+
if self.board in (HostBoard.ARM64, HostBoard.ARM) and crypto_library == HostCryptoLibrary.MBEDTLS:
624627
raise Exception("MbedTLS not supported for cross compiling cert tool")
625628
self.build_command = 'src/tools/chip-cert'
626629
elif app == HostApp.ADDRESS_RESOLVE:
@@ -660,6 +663,11 @@ def GnBuildArgs(self):
660663
'target_cpu="arm64"',
661664
'sysroot="%s"' % self.SysRootPath('SYSROOT_AARCH64')
662665
])
666+
case HostBoard.ARM:
667+
args.extend([
668+
'target_cpu="arm"',
669+
'sysroot="%s"' % self.SysRootPath('SYSROOT_ARMHF'),
670+
])
663671
case HostBoard.FAKE:
664672
args.extend([
665673
'custom_toolchain="//build/toolchain/fake:fake_x64_gcc"',
@@ -683,6 +691,9 @@ def GnBuildEnv(self):
683691
if self.board == HostBoard.ARM64:
684692
self.build_env['PKG_CONFIG_PATH'] = os.path.join(
685693
self.SysRootPath('SYSROOT_AARCH64'), 'lib/aarch64-linux-gnu/pkgconfig')
694+
if self.board == HostBoard.ARM:
695+
self.build_env['PKG_CONFIG_PATH'] = os.path.join(
696+
self.SysRootPath('SYSROOT_ARMHF'), 'lib/arm-linux-gnueabihf/pkgconfig')
686697
if self.app == HostApp.TESTS and self.use_coverage and self.use_clang and self.fuzzing_type == HostFuzzingType.NONE:
687698
# Every test is expected to have a distinct build ID, so `%m` will be
688699
# distinct.

scripts/build/testdata/all_targets_linux_x64.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ efr32-{brd2601b,brd2605a,brd2703a,brd2704b,brd2708a,brd2911a,brd4186a,brd4186c,b
99
esp32-{c3devkit,devkitc,m5stack,p4functionev,qemu}-{all-clusters,all-clusters-minimal,all-devices,all-devices-chime,all-devices-contact-sensor,all-devices-dimmable-light,all-devices-occupancy-sensor,all-devices-on-off-light,all-devices-soil-sensor,all-devices-speaker,all-devices-temperature-sensor,all-devices-water-leak-detector,bridge,energy-gateway,evse,light,lock,ota-provider,ota-requestor,shell,temperature-measurement,tests,water-heater}[-ipv6only][-rpc][-tracing]
1010
genio-lighting-app
1111
linux-fake-tests[-asan][-boringssl][-clang][-coverage][-dmalloc][-libfuzzer][-mbedtls][-ossfuzz][-pw-fuzztest][-tsan][-ubsan]
12-
linux-{arm64,x64}-{address-resolve-tool,air-purifier,air-quality-sensor,all-clusters,all-clusters-minimal,all-devices,all-devices-chime,all-devices-contact-sensor,all-devices-dimmable-light,all-devices-occupancy-sensor,all-devices-on-off-light,all-devices-soil-sensor,all-devices-speaker,all-devices-temperature-sensor,all-devices-water-leak-detector,bridge,camera,camera-controller,chip-cert,chip-tool,closure,contact-sensor,dishwasher,energy-gateway,evse,fabric-admin,fabric-bridge,fabric-sync,java-matter-controller,jf-admin-app,jf-control-app,kotlin-matter-controller,light,light-data-model-no-unique-id,lit-icd,lock,microwave-oven,minmdns,network-manager,ota-provider,ota-requestor,python-bindings,refrigerator,rpc-console,rvc,shell,simulated-app1,simulated-app2,terms-and-conditions,tests,thermostat,tv-app,tv-casting-app,water-heater,water-leak-detector}[-asan][-boringssl][-chip-casting-simplified][-clang][-coverage][-disable-dnssd-tests][-dmalloc][-enable-dnssd-tests][-endpoint-unique-id][-evse-test-event][-googletest][-ipv6only][-libfuzzer][-libnl][-mbedtls][-minmdns-verbose][-nfc-commission][-nlfaultinject][-no-ble][-no-groupcast][-no-interactive][-no-shell][-no-thread][-no-wifi][-no-wifipaf][-nodeps][-openthread-endpoint][-ossfuzz][-platform-mdns][-pw-fuzztest][-rpc][-same-event-loop][-terms-and-conditions][-test][-tsan][-ubsan][-unified][-webrtc][-with-ui]
12+
linux-{arm,arm64,x64}-{address-resolve-tool,air-purifier,air-quality-sensor,all-clusters,all-clusters-minimal,all-devices,all-devices-chime,all-devices-contact-sensor,all-devices-dimmable-light,all-devices-occupancy-sensor,all-devices-on-off-light,all-devices-soil-sensor,all-devices-speaker,all-devices-temperature-sensor,all-devices-water-leak-detector,bridge,camera,camera-controller,chip-cert,chip-tool,closure,contact-sensor,dishwasher,energy-gateway,evse,fabric-admin,fabric-bridge,fabric-sync,java-matter-controller,jf-admin-app,jf-control-app,kotlin-matter-controller,light,light-data-model-no-unique-id,lit-icd,lock,microwave-oven,minmdns,network-manager,ota-provider,ota-requestor,python-bindings,refrigerator,rpc-console,rvc,shell,simulated-app1,simulated-app2,terms-and-conditions,tests,thermostat,tv-app,tv-casting-app,water-heater,water-leak-detector}[-asan][-boringssl][-chip-casting-simplified][-clang][-coverage][-disable-dnssd-tests][-dmalloc][-enable-dnssd-tests][-endpoint-unique-id][-evse-test-event][-googletest][-ipv6only][-libfuzzer][-libnl][-mbedtls][-minmdns-verbose][-nfc-commission][-nlfaultinject][-no-ble][-no-groupcast][-no-interactive][-no-shell][-no-thread][-no-wifi][-no-wifipaf][-nodeps][-openthread-endpoint][-ossfuzz][-platform-mdns][-pw-fuzztest][-rpc][-same-event-loop][-terms-and-conditions][-test][-tsan][-ubsan][-unified][-webrtc][-with-ui]
1313
linux-x64-efr32-test-runner[-clang]
1414
imx-{all-clusters-app,all-clusters-minimal-app,chip-tool,lighting-app,ota-provider-app,thermostat}[-ele][-release][-trusty]
1515
infineon-psoc6-{all-clusters,all-clusters-minimal,light,lock}[-ota][-trustm][-updateimage]

src/platform/Linux/DiagnosticDataProviderImpl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ enum class WiFiStatsCountType
7676

7777
#if defined(__GLIBC__)
7878
// Static variable to store the maximum heap size
79-
static size_t maxHeapHighWatermark = 0;
79+
static uint64_t maxHeapHighWatermark = 0;
8080
#endif
8181

8282
CHIP_ERROR GetEthernetStatsCount(EthernetStatsCountType type, uint64_t & count)

src/wifipaf/WiFiPAFLayer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,15 @@ class WiFiPAFEndPointPool
7979
#ifdef CHIP_WIFIPAF_LAYER_DEBUG_LOGGING_ENABLED
8080
{
8181
const WiFiPAFSession * pElmInfo = &elem->mSessionInfo;
82-
ChipLogError(WiFiPAF, "EndPoint[%lu]", i);
82+
ChipLogError(WiFiPAF, "EndPoint[%zu]", i);
8383
ChipLogError(WiFiPAF, "Role: [%d, %d]", pElmInfo->role, pInInfo->role);
8484
ChipLogError(WiFiPAF, "id: [%u, %u]", pElmInfo->id, pInInfo->id);
8585
ChipLogError(WiFiPAF, "peer_id: [%d, %d]", pElmInfo->peer_id, pInInfo->peer_id);
8686
ChipLogError(WiFiPAF, "ElmMac: [%02x:%02x:%02x:%02x:%02x:%02x]", pElmInfo->peer_addr[0], pElmInfo->peer_addr[1],
8787
pElmInfo->peer_addr[2], pElmInfo->peer_addr[3], pElmInfo->peer_addr[4], pElmInfo->peer_addr[5]);
8888
ChipLogError(WiFiPAF, "InMac: [%02x:%02x:%02x:%02x:%02x:%02x]", pInInfo->peer_addr[0], pInInfo->peer_addr[1],
8989
pInInfo->peer_addr[2], pInInfo->peer_addr[3], pInInfo->peer_addr[4], pInInfo->peer_addr[5]);
90-
ChipLogError(WiFiPAF, "nodeId: [%lu, %lu]", pElmInfo->nodeId, pInInfo->nodeId);
90+
ChipLogError(WiFiPAF, "nodeId: [%" PRIu64 ", %" PRIu64 "]", pElmInfo->nodeId, pInInfo->nodeId);
9191
ChipLogError(WiFiPAF, "discriminator: [%d, %d]", pElmInfo->discriminator, pInInfo->discriminator);
9292
}
9393
#endif

0 commit comments

Comments
 (0)