Skip to content

Commit

Permalink
qpg: build libFactoryData instead of using an artifact (#26449)
Browse files Browse the repository at this point in the history
Instead of using a static factory data blob, use a freshly build
libfactorydata.a so any changes to .factory_data_config file or its
input files are picked up by the GN build.
  • Loading branch information
q-thla authored and pull[bot] committed Jul 20, 2023
1 parent a133902 commit 3235dce
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 26 deletions.
14 changes: 1 addition & 13 deletions examples/lighting-app/qpg/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ qpg_executable("lighting_app") {
]

deps = [
":factorydata_lib",
":sdk",
"${chip_root}/examples/lighting-app/lighting-common:color-format",
"${chip_root}/examples/lighting-app/qpg/zap/",
Expand All @@ -73,6 +72,7 @@ qpg_executable("lighting_app") {
"${chip_root}/src/setup_payload",
"${chip_root}/third_party/openthread/platforms:libopenthread-platform",
"${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils",
"${chip_root}/third_party/qpg_sdk:qpg_light_factorydata_lib",
]

if (chip_openthread_ftd) {
Expand Down Expand Up @@ -156,15 +156,3 @@ group("qpg") {
group("default") {
deps = [ ":qpg" ]
}

static_library("factorydata_lib") {
libs = [ "${qpg_sdk_root}/Binaries/FactoryData/FactoryData_example/FactoryData_example.a" ]
public_configs = [ ":qpg_retain_factorydata" ]
}

config("qpg_retain_factorydata") {
ldflags = [
"-Wl,-u_binary_factory_data_bin_start",
"-Wl,-u_binary_factory_data_start",
]
}
14 changes: 1 addition & 13 deletions examples/lock-app/qpg/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ qpg_executable("lock_app") {
]

deps = [
":factorydata_lib",
":sdk",
"${chip_root}/examples/lock-app/qpg/zap/",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/setup_payload",
"${chip_root}/third_party/openthread/platforms:libopenthread-platform",
"${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils",
"${chip_root}/third_party/qpg_sdk:qpg_lock_factorydata_lib",
]

if (chip_openthread_ftd) {
Expand Down Expand Up @@ -153,15 +153,3 @@ group("qpg") {
group("default") {
deps = [ ":qpg" ]
}

static_library("factorydata_lib") {
libs = [ "${qpg_sdk_root}/Binaries/FactoryData/FactoryData_example/FactoryData_example.a" ]
public_configs = [ ":qpg_retain_factorydata" ]
}

config("qpg_retain_factorydata") {
ldflags = [
"-Wl,-u_binary_factory_data_bin_start",
"-Wl,-u_binary_factory_data_start",
]
}
41 changes: 41 additions & 0 deletions third_party/qpg_sdk/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,44 @@ static_library("qpg_openthread_glue_lib") {
deps = [ "${chip_root}/third_party/qpg_sdk:qpg_openthread_glue" ]
libs = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/OpenThreadQorvoGlue_qpg6105_ftd/libOpenThreadQorvoGlue_${qpg_target_ic}_ftd.a" ]
}

qpg_make_build("qpg_light_factorydata") {
make_sources = [ "${qpg_sdk_root}/Tools/FactoryData" ]
make_output = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/FactoryData_light_static_pake/libFactoryData_light_static_pake.a" ]
make_args = [
"-f",
rebase_path(qpg_sdk_root, root_build_dir) +
"/Libraries/Qorvo/FactoryData/Makefile.FactoryData_light_static_pake",
"WORKDIR=" + rebase_path(target_gen_dir, root_build_dir) +
"/${qpg_sdk_lib_dir}/FactoryData_light_static_pake",
]
}
static_library("qpg_light_factorydata_lib") {
deps = [ "${chip_root}/third_party/qpg_sdk:qpg_light_factorydata" ]
libs = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/FactoryData_light_static_pake/libFactoryData_light_static_pake.a" ]
public_configs = [ ":qpg_retain_factorydata" ]
}

qpg_make_build("qpg_lock_factorydata") {
make_sources = [ "${qpg_sdk_root}/Tools/FactoryData" ]
make_output = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/FactoryData_lock_static_pake/libFactoryData_lock_static_pake.a" ]
make_args = [
"-f",
rebase_path(qpg_sdk_root, root_build_dir) +
"/Libraries/Qorvo/FactoryData/Makefile.FactoryData_lock_static_pake",
"WORKDIR=" + rebase_path(target_gen_dir, root_build_dir) +
"/${qpg_sdk_lib_dir}/FactoryData_lock_static_pake",
]
}
static_library("qpg_lock_factorydata_lib") {
deps = [ "${chip_root}/third_party/qpg_sdk:qpg_lock_factorydata" ]
libs = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/FactoryData_lock_static_pake/libFactoryData_lock_static_pake.a" ]
public_configs = [ ":qpg_retain_factorydata" ]
}

config("qpg_retain_factorydata") {
ldflags = [
"-Wl,-u_binary_factory_data_bin_start",
"-Wl,-u_binary_factory_data_start",
]
}

0 comments on commit 3235dce

Please sign in to comment.