Skip to content

Commit

Permalink
[esp32] Enable light example compilation in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
chshu committed Jan 5, 2022
1 parent 99118d4 commit 88f2f46
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 0 deletions.
47 changes: 47 additions & 0 deletions examples/lighting-app/esp32/sdkconfig_s3devkit.defaults
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#
# Copyright (c) 2020 Project CHIP Authors
# Copyright (c) 2018 Nest Labs, Inc.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Description:
# CI uses this to select the ESP32S3-DevKitM.
#
CONFIG_IDF_TARGET="esp32s3"

# Default to 921600 baud when flashing and monitoring device
CONFIG_ESPTOOLPY_BAUD_921600B=y
CONFIG_ESPTOOLPY_BAUD=921600
CONFIG_ESPTOOLPY_COMPRESSED=y
CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y
CONFIG_ESPTOOLPY_MONITOR_BAUD=115200

#enable BT
CONFIG_BT_ENABLED=y
CONFIG_BT_NIMBLE_ENABLED=y

#enable lwip ipv6 autoconfig
CONFIG_LWIP_IPV6_AUTOCONFIG=y

# Use a custom partition table
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"

#enable lwIP route hooks
CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT=y
CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT=y

# Serial Flasher config
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
CONFIG_ESPTOOLPY_FLASHSIZE="4MB"
2 changes: 2 additions & 0 deletions scripts/build/build/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,14 @@ def Esp32Targets():
yield esp32_target.Extend('m5stack-all-clusters-rpc-ipv6only', board=Esp32Board.M5Stack, app=Esp32App.ALL_CLUSTERS, enable_rpcs=True, enable_ipv4=False)

yield esp32_target.Extend('c3devkit-all-clusters', board=Esp32Board.C3DevKit, app=Esp32App.ALL_CLUSTERS)
yield esp32_target.Extend('s3devkit-light', board=Esp32Board.S3Devkit, app=Esp32App.LIGHT)

devkitc = esp32_target.Extend('devkitc', board=Esp32Board.DevKitC)

yield devkitc.Extend('all-clusters', app=Esp32App.ALL_CLUSTERS)
yield devkitc.Extend('all-clusters-ipv6only', app=Esp32App.ALL_CLUSTERS, enable_ipv4=False)
yield devkitc.Extend('shell', app=Esp32App.SHELL)
yield devkitc.Extend('light', app=Esp32App.LIGHT)
yield devkitc.Extend('lock', app=Esp32App.LOCK)
yield devkitc.Extend('bridge', app=Esp32App.BRIDGE)
yield devkitc.Extend('temperature-measurement', app=Esp32App.TEMPERATURE_MEASUREMENT)
Expand Down
10 changes: 10 additions & 0 deletions scripts/build/builders/esp32.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ class Esp32Board(Enum):
DevKitC = auto()
M5Stack = auto()
C3DevKit = auto()
S3Devkit = auto()
QEMU = auto()


class Esp32App(Enum):
ALL_CLUSTERS = auto()
LIGHT = auto()
LOCK = auto()
SHELL = auto()
BRIDGE = auto()
Expand All @@ -40,6 +42,8 @@ class Esp32App(Enum):
def ExamplePath(self):
if self == Esp32App.ALL_CLUSTERS:
return 'examples/all-clusters-app'
elif self == Esp32App.LIGHT:
return 'examples/lighting-app'
elif self == Esp32App.LOCK:
return 'examples/lock-app'
elif self == Esp32App.SHELL:
Expand All @@ -57,6 +61,8 @@ def ExamplePath(self):
def AppNamePrefix(self):
if self == Esp32App.ALL_CLUSTERS:
return 'chip-all-clusters-app'
elif self == Esp32App.LIGHT:
return 'chip-lighting-app'
elif self == Esp32App.LOCK:
return 'chip-lock-app'
elif self == Esp32App.SHELL:
Expand Down Expand Up @@ -84,6 +90,8 @@ def IsCompatible(self, board: Esp32Board):
return self == Esp32App.ALL_CLUSTERS
elif board == Esp32Board.C3DevKit:
return self == Esp32App.ALL_CLUSTERS
elif board == Esp32Board.S3DevKit:
return self == Esp32App.LIGHT
else:
return (board == Esp32Board.DevKitC) and (self != Esp32App.TESTS)

Expand All @@ -101,6 +109,8 @@ def DefaultsFileName(board: Esp32Board, app: Esp32App, enable_rpcs: bool):
return 'sdkconfig_m5stack{}.defaults'.format(rpc)
elif board == Esp32Board.C3DevKit:
return 'sdkconfig_c3devkit{}.defaults'.format(rpc)
elif board == Esp32Board.S3DevKit:
return 'sdkconfig_s3devkit{}.defaults'.format(rpc)
else:
raise Exception('Unknown board type')

Expand Down
2 changes: 2 additions & 0 deletions scripts/build/testdata/all_targets_except_host.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ efr32-brd4304a-lock (NOGLOB: only user requested)
efr32-brd4304a-lock-rpc (NOGLOB: only user requested)
efr32-brd4304a-unit-test (NOGLOB: only user requested)
efr32-brd4304a-window-covering (NOGLOB: only user requested)
esp32-s3devkit-light
esp32-c3devkit-all-clusters
esp32-devkitc-all-clusters
esp32-devkitc-all-clusters-ipv6only
esp32-devkitc-light
esp32-devkitc-bridge
esp32-devkitc-lock
esp32-devkitc-shell
Expand Down
22 changes: 22 additions & 0 deletions scripts/build/testdata/build_all_except_host.txt
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,17 @@ gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/src
# Generating efr32-brd4304a-window-covering
gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/window-app/efr32 '--args=efr32_board="BRD4304A"' {out}/efr32-brd4304a-window-covering

# Generating esp32-s3devkit-light
mkdir -p {out}/esp32-s3devkit-light

cp examples/lighting-app/esp32/sdkconfig_s3devkit.defaults {out}/esp32-s3devkit-light/sdkconfig.defaults

rm -f examples/lighting-app/esp32/sdkconfig

bash -c 'source $IDF_PATH/export.sh; source scripts/activate.sh;
export SDKCONFIG_DEFAULTS={out}/esp32-s3devkit-light/sdkconfig.defaults
idf.py -C examples/lighting-app/esp32 -B {out}/esp32-s3devkit-light reconfigure'

# Generating esp32-c3devkit-all-clusters
mkdir -p {out}/esp32-c3devkit-all-clusters

Expand Down Expand Up @@ -332,6 +343,17 @@ bash -c 'source $IDF_PATH/export.sh; source scripts/activate.sh;
export SDKCONFIG_DEFAULTS={out}/esp32-devkitc-bridge/sdkconfig.defaults
idf.py -C examples/bridge-app/esp32 -B {out}/esp32-devkitc-bridge reconfigure'

# Generating esp32-devkitc-light
mkdir -p {out}/esp32-devkitc-light

cp examples/lighting-app/esp32/sdkconfig.defaults {out}/esp32-devkitc-light/sdkconfig.defaults

rm -f examples/lighting-app/esp32/sdkconfig

bash -c 'source $IDF_PATH/export.sh; source scripts/activate.sh;
export SDKCONFIG_DEFAULTS={out}/esp32-devkitc-light/sdkconfig.defaults
idf.py -C examples/lighting-app/esp32 -B {out}/esp32-devkitc-light reconfigure'

# Generating esp32-devkitc-lock
mkdir -p {out}/esp32-devkitc-lock

Expand Down

0 comments on commit 88f2f46

Please sign in to comment.