Skip to content

Commit

Permalink
Clean up P6 SDK paths (#20624)
Browse files Browse the repository at this point in the history
Introduce a new variable p6_sdk_root for the actual root of the SDK
repository and use this to specify SDK paths.

This avoids forcing locating the SDK submodule at a particular location
in the Matter SDK directory, as projects may want to use a different
layout.
  • Loading branch information
mspang authored Jul 12, 2022
1 parent 57cb679 commit 01a11aa
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 84 deletions.
5 changes: 5 additions & 0 deletions build_overrides/p6.gni
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@ declare_args() {
# Root directory for p6 SDK build files.
p6_sdk_build_root = "//third_party/p6"
}

declare_args() {
# Root directory for p6 SDK sources.
p6_sdk_root = "${p6_sdk_build_root}/p6_sdk"
}
29 changes: 14 additions & 15 deletions examples/all-clusters-app/p6/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ declare_args() {
}

config("p6_ota_config") {
linker_script =
"${chip_root}/third_party/p6/p6_sdk/ota/cy8c6xxa_cm4_dual_ota_int.ld"
linker_script = "${p6_sdk_root}/ota/cy8c6xxa_cm4_dual_ota_int.ld"

ldflags = [ "-T" + rebase_path(linker_script, root_build_dir) ]

Expand Down Expand Up @@ -100,21 +99,21 @@ p6_sdk_sources("all_clusters_app_sdk_sources") {

if (chip_enable_ota_requestor) {
sources += [
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/bootutil/src/bootutil_misc.c",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_flash_map.c",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_flash_psoc6.c",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_smif_psoc6.c",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/mem_config/mem_config_sfdp.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/bootutil/src/bootutil_misc.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_flash_map.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_flash_psoc6.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_smif_psoc6.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/mem_config/mem_config_sfdp.c",
]
include_dirs += [
"${chip_root}/third_party/p6/p6_sdk/ota/config",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/mem_config/",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/include/",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/include/flash_map_backend/",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/sysflash/",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/bootutil/include",
"${p6_sdk_root}/ota/config",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/mem_config/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/include/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/include/flash_map_backend/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/sysflash/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/bootutil/include",
]
public_configs += [ ":p6_ota_config" ]
}
Expand Down
29 changes: 14 additions & 15 deletions examples/all-clusters-minimal-app/p6/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ declare_args() {
}

config("p6_ota_config") {
linker_script =
"${chip_root}/third_party/p6/p6_sdk/ota/cy8c6xxa_cm4_dual_ota_int.ld"
linker_script = "${p6_sdk_root}/ota/cy8c6xxa_cm4_dual_ota_int.ld"

ldflags = [ "-T" + rebase_path(linker_script, root_build_dir) ]

Expand Down Expand Up @@ -100,21 +99,21 @@ p6_sdk_sources("all_clusters_app_sdk_sources") {

if (chip_enable_ota_requestor) {
sources += [
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/bootutil/src/bootutil_misc.c",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_flash_map.c",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_flash_psoc6.c",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_smif_psoc6.c",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/mem_config/mem_config_sfdp.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/bootutil/src/bootutil_misc.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_flash_map.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_flash_psoc6.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_smif_psoc6.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/mem_config/mem_config_sfdp.c",
]
include_dirs += [
"${chip_root}/third_party/p6/p6_sdk/ota/config",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/mem_config/",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/include/",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/include/flash_map_backend/",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/sysflash/",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/bootutil/include",
"${p6_sdk_root}/ota/config",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/mem_config/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/include/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/include/flash_map_backend/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/sysflash/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/bootutil/include",
]
public_configs += [ ":p6_ota_config" ]
}
Expand Down
5 changes: 5 additions & 0 deletions examples/build_overrides/p6.gni
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@ declare_args() {
# Root directory for P6 SDK.
p6_sdk_build_root = "//third_party/connectedhomeip/third_party/p6"
}

declare_args() {
# Root directory for p6 SDK sources.
p6_sdk_root = "${p6_sdk_build_root}/p6_sdk"
}
29 changes: 14 additions & 15 deletions examples/lighting-app/p6/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ declare_args() {
}

config("p6_ota_config") {
linker_script =
"${chip_root}/third_party/p6/p6_sdk/ota/cy8c6xxa_cm4_dual_ota_int.ld"
linker_script = "${p6_sdk_root}/ota/cy8c6xxa_cm4_dual_ota_int.ld"

ldflags = [ "-T" + rebase_path(linker_script, root_build_dir) ]

Expand Down Expand Up @@ -99,21 +98,21 @@ p6_sdk_sources("lighting_app_sdk_sources") {

if (chip_enable_ota_requestor) {
sources += [
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/bootutil/src/bootutil_misc.c",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_flash_map.c",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_flash_psoc6.c",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_smif_psoc6.c",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/mem_config/mem_config_sfdp.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/bootutil/src/bootutil_misc.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_flash_map.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_flash_psoc6.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_smif_psoc6.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/mem_config/mem_config_sfdp.c",
]
include_dirs += [
"${chip_root}/third_party/p6/p6_sdk/ota/config",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/mem_config/",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/include/",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/include/flash_map_backend/",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/sysflash/",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/bootutil/include",
"${p6_sdk_root}/ota/config",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/mem_config/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/include/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/include/flash_map_backend/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/sysflash/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/bootutil/include",
]
public_configs += [ ":p6_ota_config" ]
}
Expand Down
29 changes: 14 additions & 15 deletions examples/lock-app/p6/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ declare_args() {
}

config("p6_ota_config") {
linker_script =
"${chip_root}/third_party/p6/p6_sdk/ota/cy8c6xxa_cm4_dual_ota_int.ld"
linker_script = "${p6_sdk_root}/ota/cy8c6xxa_cm4_dual_ota_int.ld"

ldflags = [ "-T" + rebase_path(linker_script, root_build_dir) ]

Expand Down Expand Up @@ -96,21 +95,21 @@ p6_sdk_sources("lock_app_sdk_sources") {

if (chip_enable_ota_requestor) {
sources += [
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/bootutil/src/bootutil_misc.c",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_flash_map.c",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_flash_psoc6.c",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_smif_psoc6.c",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/mem_config/mem_config_sfdp.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/bootutil/src/bootutil_misc.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_flash_map.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_flash_psoc6.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_smif_psoc6.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/mem_config/mem_config_sfdp.c",
]
include_dirs += [
"${chip_root}/third_party/p6/p6_sdk/ota/config",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/mem_config/",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/include/",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/include/flash_map_backend/",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/sysflash/",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/bootutil/include",
"${p6_sdk_root}/ota/config",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/mem_config/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/include/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/include/flash_map_backend/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/sysflash/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/bootutil/include",
]
public_configs += [ ":p6_ota_config" ]
}
Expand Down
29 changes: 14 additions & 15 deletions examples/ota-requestor-app/p6/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ declare_args() {
}

config("p6_ota_config") {
linker_script =
"${chip_root}/third_party/p6/p6_sdk/ota/cy8c6xxa_cm4_dual_ota_int.ld"
linker_script = "${p6_sdk_root}/ota/cy8c6xxa_cm4_dual_ota_int.ld"

ldflags = [ "-T" + rebase_path(linker_script, root_build_dir) ]

Expand Down Expand Up @@ -88,14 +87,14 @@ p6_sdk_sources("ota_requestor_app_sdk_sources") {
"${chip_root}/src/platform/P6",
"${p6_project_dir}/include",
"${examples_plat_dir}",
"${chip_root}/third_party/p6/p6_sdk/ota/config",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/mem_config/",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/include/",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/include/flash_map_backend/",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/sysflash/",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/bootutil/include",
"${p6_sdk_root}/ota/config",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/mem_config/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/include/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/include/flash_map_backend/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/sysflash/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/bootutil/include",
]

defines = [
Expand All @@ -105,12 +104,12 @@ p6_sdk_sources("ota_requestor_app_sdk_sources") {
]

sources = [
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/bootutil/src/bootutil_misc.c",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_flash_map.c",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_flash_psoc6.c",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_smif_psoc6.c",
"${chip_root}/third_party/p6/p6_sdk/libs/anycloud-ota/source/mcuboot/cy_flash_pal/mem_config/mem_config_sfdp.c",
"${p6_project_dir}/include/CHIPProjectConfig.h",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/bootutil/src/bootutil_misc.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_flash_map.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_flash_psoc6.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_smif_psoc6.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/mem_config/mem_config_sfdp.c",
]

public_configs = [
Expand Down
6 changes: 3 additions & 3 deletions third_party/p6/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ config("p6_sdk_config") {
include_dir = string_replace(include_dir, "-I", "", 1)

# Path is relative to SDK
include_dir = "${p6_sdk_build_root}/p6_sdk/${include_dir}"
include_dir = "${p6_sdk_root}/${include_dir}"

_system_include_dirs += [ include_dir ]
}
Expand All @@ -57,7 +57,7 @@ config("p6_sdk_config") {
libs = []
foreach(lib, mtb_json.libs) {
# Path is relative to SDK
lib = "${p6_sdk_build_root}/p6_sdk/${lib}"
lib = "${p6_sdk_root}/${lib}"

libs += [ lib ]
}
Expand All @@ -76,7 +76,7 @@ config("p6_sdk_config") {
linker_script = string_replace(linker_script, "-T", "", 1)

# Path is relative to SDK
linker_script = "${p6_sdk_build_root}/p6_sdk/${linker_script}"
linker_script = "${p6_sdk_root}/${linker_script}"

ldflags += [ "-T" + rebase_path(linker_script, root_build_dir) ]
}
Expand Down
11 changes: 5 additions & 6 deletions third_party/p6/p6_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ if (is_debug) {
debug_str = "Release"
}

mtb_json = read_file(
"$p6_sdk_build_root/p6_sdk/build/${p6_board}/$debug_str/GCC_ARM.json",
"json")
mtb_json = read_file("${p6_sdk_root}/build/${p6_board}/$debug_str/GCC_ARM.json",
"json")

# Defines an p6 SDK build target.
#
Expand Down Expand Up @@ -85,17 +84,17 @@ template("p6_sdk_sources") {

# Pull out c sources from generated json
foreach(src, mtb_json_local.c_source) {
sources += [ "${p6_sdk_build_root}/p6_sdk/${src}" ]
sources += [ "${p6_sdk_root}/${src}" ]
}

# Pull out cpp sources from generated json
foreach(src, mtb_json_local.cxx_source) {
sources += [ "${p6_sdk_build_root}/p6_sdk/${src}" ]
sources += [ "${p6_sdk_root}/${src}" ]
}

# Pull out .S files from generated json
foreach(asm, mtb_json_local.asm_source) {
sources += [ "${p6_sdk_build_root}/p6_sdk/${asm}" ]
sources += [ "${p6_sdk_root}/${asm}" ]
}

public_deps = []
Expand Down

0 comments on commit 01a11aa

Please sign in to comment.