Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restyle Add Lock app example for infineon P6 board #8274

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Restyled by gn
  • Loading branch information
restyled-commits committed Jul 9, 2021
commit f3192d049af5d19258555047f446f2fe5b851b20
1 change: 0 additions & 1 deletion BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
# Build the p6 lock app example.
enable_p6_lock_app_build = enable_p6_builds


# Build the qpgxxxx lock app example.
enable_qpg_lock_app_build = enable_qpg_builds && !is_debug

Expand Down
1 change: 0 additions & 1 deletion config/p6/toolchain/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,3 @@ arm_toolchain("p6_lock_app") {
treat_warnings_as_errors = false
}
}

5 changes: 3 additions & 2 deletions examples/lock-app/p6/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ p6_sdk_sources("lock_app_sdk_sources") {
#"${p6_project_dir}/include/FreeRTOSConfig.h",
]

public_configs = ["${chip_root}/third_party/p6:p6_sdk_config"]
public_configs = [ "${chip_root}/third_party/p6:p6_sdk_config" ]

#public_configs += ["${chip_root}/third_party/p6:project_configs"]
}

Expand Down Expand Up @@ -82,12 +83,12 @@ p6_executable("lock_app") {
"${examples_plat_dir}/LEDWidget.cpp",
"${examples_plat_dir}/Service.cpp",
"${examples_plat_dir}/init_p6Platform.cpp",
"${p6_project_dir}/include/CHIPProjectConfig.h",
"src/AppTask.cpp",
"src/BoltLockManager.cpp",
"src/ButtonHandler.cpp",
"src/ZclCallbacks.cpp",
"src/main.cpp",
"${p6_project_dir}/include/CHIPProjectConfig.h",
]

output_dir = root_out_dir
Expand Down
4 changes: 2 additions & 2 deletions examples/lock-app/p6/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ import("//build_overrides/chip.gni")
import("//build_overrides/pigweed.gni")
import("${chip_root}/src/platform/P6/args.gni")

p6_target_project = get_label_info(":lock_app_sdk_sources", "label_no_toolchain")

p6_target_project =
get_label_info(":lock_app_sdk_sources", "label_no_toolchain")
2 changes: 1 addition & 1 deletion src/lwip/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if (lwip_platform == "") {
assert(lwip_platform == "external" || lwip_platform == "standalone" ||
lwip_platform == "cc13x2_26x2" || lwip_platform == "efr32" ||
lwip_platform == "k32w" || lwip_platform == "qpg" ||
lwip_platform == "mbed" || lwip_platform == "p6" ,
lwip_platform == "mbed" || lwip_platform == "p6",
"Unsupported lwIP platform: ${lwip_platform}")

if (lwip_platform != "external") {
Expand Down
2 changes: 1 addition & 1 deletion src/platform/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ if (chip_device_platform != "none") {
defines += [
"CHIP_DEVICE_LAYER_TARGET_P6=1",
"CHIP_DEVICE_LAYER_TARGET=P6",
]
]
} else if (chip_device_platform == "linux") {
defines += [
"CHIP_DEVICE_LAYER_TARGET_LINUX=1",
Expand Down
82 changes: 42 additions & 40 deletions src/platform/P6/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -25,46 +25,48 @@ if (chip_enable_openthread) {

static_library("P6") {
sources = [
"BLEManagerImpl.cpp",
"BLEManagerImpl.h",
"BlePlatformConfig.h",
"CHIPDevicePlatformConfig.h",
"CHIPDevicePlatformEvent.h",
"CHIPPlatformConfig.h",
"ConfigurationManagerImpl.cpp",
"ConfigurationManagerImpl.h",
"ConnectivityManagerImpl.cpp",
"ConnectivityManagerImpl.h",
"DeviceNetworkProvisioningDelegateImpl.cpp",
"DeviceNetworkProvisioningDelegateImpl.h",
#"P6/Entropy.cpp",
"InetPlatformConfig.h",
"Logging.cpp",
"LwIPCoreLock.cpp",
#"P6/MdnsImpl.cpp",
"P6Config.cpp",
"P6Config.h",
"P6Utils.cpp",
"P6Utils.h",
"PlatformManagerImpl.cpp",
"PlatformManagerImpl.h",
"SoftwareUpdateManagerImpl.cpp",
"SoftwareUpdateManagerImpl.h",
"SystemPlatformConfig.h",
"WarmPlatformConfig.h",
"../FreeRTOS/SystemTimeSupport.cpp",
"KeyValueStoreManagerImpl.cpp",
"KeyValueStoreManagerImpl.h",
"MTBKeyValueStore.cpp",
"MTBKeyValueStore.h",
"app_platform_cfg.c",
"app_platform_cfg.h",
"cycfg_bt_settings.c",
"cycfg_bt_settings.h",
"cycfg_gap.c",
"cycfg_gap.h",
"cycfg_gatt_db.c",
"cycfg_gatt_db.h",
"../FreeRTOS/SystemTimeSupport.cpp",
"BLEManagerImpl.cpp",
"BLEManagerImpl.h",
"BlePlatformConfig.h",
"CHIPDevicePlatformConfig.h",
"CHIPDevicePlatformEvent.h",
"CHIPPlatformConfig.h",
"ConfigurationManagerImpl.cpp",
"ConfigurationManagerImpl.h",
"ConnectivityManagerImpl.cpp",
"ConnectivityManagerImpl.h",
"DeviceNetworkProvisioningDelegateImpl.cpp",
"DeviceNetworkProvisioningDelegateImpl.h",

#"P6/Entropy.cpp",
"InetPlatformConfig.h",
"KeyValueStoreManagerImpl.cpp",
"KeyValueStoreManagerImpl.h",
"Logging.cpp",
"LwIPCoreLock.cpp",
"MTBKeyValueStore.cpp",
"MTBKeyValueStore.h",

#"P6/MdnsImpl.cpp",
"P6Config.cpp",
"P6Config.h",
"P6Utils.cpp",
"P6Utils.h",
"PlatformManagerImpl.cpp",
"PlatformManagerImpl.h",
"SoftwareUpdateManagerImpl.cpp",
"SoftwareUpdateManagerImpl.h",
"SystemPlatformConfig.h",
"WarmPlatformConfig.h",
"app_platform_cfg.c",
"app_platform_cfg.h",
"cycfg_bt_settings.c",
"cycfg_bt_settings.h",
"cycfg_gap.c",
"cycfg_gap.h",
"cycfg_gatt_db.c",
"cycfg_gatt_db.h",
]
deps = [ "${chip_root}/src/lib/mdns:platform_header" ]

Expand Down
1 change: 1 addition & 0 deletions src/platform/P6/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ mbedtls_target = "${p6_sdk_build_root}:p6_build"
chip_device_platform = "p6"

lwip_platform = "p6"

#lwip_ipv6 = true
#lwip_ipv4 = true
#lwip_api = true
Expand Down
32 changes: 18 additions & 14 deletions third_party/p6/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -25,54 +25,58 @@ assert(p6_target_project != "", "p6_target_project must be specified")
# Add includes, cflags, asmflags, etc in config
config("p6_sdk_config") {
# Pull out includes from generated json
# Treat these includes as system includes, so warnings in them are not fatal.
# Treat these includes as system includes, so warnings in them are not fatal.
_include_dirs = []
foreach(inc, mtb_json.includes) {
# Strip off leading -I part
_include_dirs += ["/" + rebase_path(string_replace(inc, "-I", "", 1), "/", "${p6_sdk_build_root}/repo/")]
_include_dirs += [ "/" + rebase_path(string_replace(inc, "-I", "", 1),
"/",
"${p6_sdk_build_root}/repo/") ]
}

# Also add project include path (passed in from project build)
proj_path = get_label_info(p6_target_project, "dir")
_include_dirs += ["/" + rebase_path("${proj_path}/include", "/", ".")]
_include_dirs += [ "/" + rebase_path("${proj_path}/include", "/", ".") ]

cflags = []
foreach(include_dir, _include_dirs) {
cflags += ["-isystem" + include_dir]
cflags += [ "-isystem" + include_dir ]
}

# Pull out defines from generated json
defines = []
foreach(def, mtb_json.defines) {
# Strip off leading -D part
defines += [string_replace(def, "-D", "", 1)]
defines += [ string_replace(def, "-D", "", 1) ]
}

# Pull out static libs (.a files) from generated json
libs = []
foreach(lib, mtb_json.libs) {
libs += ["/" + rebase_path(lib, "/", "${p6_sdk_build_root}/repo/")]
libs += [ "/" + rebase_path(lib, "/", "${p6_sdk_build_root}/repo/") ]
}

cflags_c = mtb_json.cflags
cflags_cc = mtb_json.cxxflags
asmflags = mtb_json.asflags
ldflags = filter_exclude(mtb_json.ldflags, ["-T*"])
ldflags = filter_exclude(mtb_json.ldflags, [ "-T*" ])

# Pull out linker flags with paths (-T flags) and make paths absolute
linker_script_flags = filter_include(mtb_json.ldflags, ["-T*"])
linker_script_flags = filter_include(mtb_json.ldflags, [ "-T*" ])
foreach(flag, linker_script_flags) {
ldflags += ["-T/" + rebase_path(string_replace(flag, "-T", "", 1), "/", "${p6_sdk_build_root}/repo/")]
ldflags += [ "-T/" + rebase_path(string_replace(flag, "-T", "", 1),
"/",
"${p6_sdk_build_root}/repo/") ]
}

# --specs=nano.specs is getting added twice and causing compile issues so remove from cxx flags here.
cflags_c -= ["--specs=nano.specs"]
cflags_cc -= ["--specs=nano.specs"]
asmflags -= ["--specs=nano.specs"]
ldflags -= ["--specs=nano.specs"]
cflags_c -= [ "--specs=nano.specs" ]
cflags_cc -= [ "--specs=nano.specs" ]
asmflags -= [ "--specs=nano.specs" ]
ldflags -= [ "--specs=nano.specs" ]
}

group("p6_build") {
public_configs = [":p6_sdk_config"]
public_configs = [ ":p6_sdk_config" ]
public_deps = [ p6_target_project ]
}
32 changes: 18 additions & 14 deletions third_party/p6/p6_executable.gni
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import("//build_overrides/chip.gni")
import("//build/toolchain/flashable_executable.gni")
import("//build_overrides/chip.gni")

import("p6_board.gni")

Expand All @@ -24,27 +24,31 @@ template("p6_executable") {
objcopy_image_format = "ihex"
objcopy = "arm-none-eabi-objcopy"

#Copy flashing dependencies to the output directory so that the output
#is collectively self-contained; this allows flashing to work reliably
#even if the build and flashing steps take place on different machines
#or in different containers.
#Copy flashing dependencies to the output directory so that the output
#is collectively self-contained; this allows flashing to work reliably
#even if the build and flashing steps take place on different machines
#or in different containers.

flashing_runtime_target = target_name + ".flashing_runtime"
copy(flashing_runtime_target) {
sources = [
"${chip_root}/scripts/flashing/p6_firmware_utils.py",
"${chip_root}/scripts/flashing/firmware_utils.py",
]
outputs = [ "${root_out_dir}/{{source_file_part}}" ]
sources = [
"${chip_root}/scripts/flashing/firmware_utils.py",
"${chip_root}/scripts/flashing/p6_firmware_utils.py",
]
outputs = [ "${root_out_dir}/{{source_file_part}}" ]
}

flashing_script_generator =
"${chip_root}/scripts/flashing/gen_flashing_script.py"
"${chip_root}/scripts/flashing/gen_flashing_script.py"
flashing_script_name = output_base_name + ".flash.py"
flashing_options = [ "p6", "--device", "${p6_board}" ]
flashing_options = [
"p6",
"--device",
"${p6_board}",
]

flashable_executable(target_name) {
forward_variables_from(invoker, "*")
data_deps = [ ":${flashing_runtime_target}" ]
forward_variables_from(invoker, "*")
data_deps = [ ":${flashing_runtime_target}" ]
}
}
35 changes: 24 additions & 11 deletions third_party/p6/p6_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,33 @@ import("//build_overrides/chip.gni")
import("//build_overrides/jlink.gni")
import("//build_overrides/mbedtls.gni")

import("p6_board.gni")
import("//build_overrides/p6.gni")
import("p6_board.gni")

# TODO: Don't hardcode config/toolchain
# TODO: Convert to GN action?
if(is_debug) {
if (is_debug) {
debug_str = "Debug"
}
else {
} else {
debug_str = "Release"
}
mtb_json = exec_script("$p6_sdk_build_root/repo/make_gni.py", ["${p6_board}", "-c", debug_str, "-t", "GCC_ARM"], "json", [])
mtb_json = exec_script("$p6_sdk_build_root/repo/make_gni.py",
[
"${p6_board}",
"-c",
debug_str,
"-t",
"GCC_ARM",
],
"json",
[])

# Defines an p6 SDK build target.
#
# Parameters:
# sources - The sources files to build.
#
template("p6_sdk_sources") {

if (defined(invoker.p6_project_dir)) {
p6_project_dir = invoker.p6_project_dir
}
Expand All @@ -48,7 +55,7 @@ template("p6_sdk_sources") {
if (defined(invoker.include_dirs)) {
include_dirs += invoker.include_dirs
}
include_dirs += ["${p6_project_dir}/include"]
include_dirs += [ "${p6_project_dir}/include" ]

defines = []
if (defined(invoker.defines)) {
Expand All @@ -67,17 +74,23 @@ template("p6_sdk_sources") {

# Pull out c sources from generated json
foreach(src, mtb_json.c_source) {
sources += [rebase_path(src, "${p6_project_dir}", "${p6_sdk_build_root}/repo/")]
sources += [ rebase_path(src,
"${p6_project_dir}",
"${p6_sdk_build_root}/repo/") ]
}

# Pull out cpp sources from generated json
foreach(src, mtb_json.cxx_source) {
sources += [rebase_path(src, "${p6_project_dir}", "${p6_sdk_build_root}/repo/")]
sources += [ rebase_path(src,
"${p6_project_dir}",
"${p6_sdk_build_root}/repo/") ]
}

# Pull out .S files from generated json
foreach(asm, mtb_json.asm_source) {
sources += [rebase_path(asm, "${p6_project_dir}", "${p6_sdk_build_root}/repo/")]
sources += [ rebase_path(asm,
"${p6_project_dir}",
"${p6_sdk_build_root}/repo/") ]
}

public_deps = []
Expand All @@ -92,7 +105,7 @@ template("p6_sdk_sources") {
#"${segger_rtt_root}:segger_rtt_syscalls",
]

public_configs = [":project_configs"]
public_configs = [ ":project_configs" ]
if (defined(invoker.public_configs)) {
public_configs += invoker.public_configs
}
Expand Down