| # Copyright (c) 2021 Project CHIP Authors |
| # |
| # 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. |
| |
| import("//build_overrides/build.gni") |
| import("//build_overrides/chip.gni") |
| import("//build_overrides/psoc6.gni") |
| |
| import("${build_root}/config/defaults.gni") |
| import("${chip_root}/src/platform/device.gni") |
| import("${psoc6_sdk_build_root}/psoc6_executable.gni") |
| import("${psoc6_sdk_build_root}/psoc6_sdk.gni") |
| |
| assert(current_os == "freertos") |
| |
| psoc6_project_dir = "${chip_root}/examples/lighting-app/infineon/psoc6" |
| examples_plat_dir = "${chip_root}/examples/platform/infineon/psoc6" |
| |
| declare_args() { |
| # Dump memory usage at link time. |
| chip_print_memory_usage = false |
| |
| # PIN code for PASE session establishment. |
| setup_pin_code = 20202021 |
| |
| # Monitor & log memory usage at runtime. |
| enable_heap_monitoring = false |
| |
| # Build update app |
| build_update_image = false |
| } |
| |
| config("psoc6_ota_config") { |
| linker_script = "${psoc6_sdk_root}/ota/cy8c6xxa_cm4_dual_ota_int.ld" |
| |
| ldflags = [ "-T" + rebase_path(linker_script, root_build_dir) ] |
| |
| ldflags += [ "-Wl,--undefined=uxTopUsedPriority -Wl,--defsym,MCUBOOT_HEADER_SIZE=0x400,--defsym,FLASH_AREA_IMG_1_PRIMARY_START=0x028000,--defsym,FLASH_AREA_IMG_1_PRIMARY_SIZE=0x1c0000" ] |
| |
| defines = [ |
| "P6_OTA", |
| "COMPONENT_MCUBOOT", |
| "CY_BOOTLOADER=MCUBOOT", |
| "OTA_SUPPORT=1", |
| "COMPONENT_OTA_PSOC_062", |
| "PSOC_062_2M", |
| "OTA_USE_EXTERNAL_FLASH=1", |
| "ENABLE_OTA_LOGS", |
| "ENABLE_OTA_BOOTLOADER_ABSTRACTION_LOGS", |
| "MCUBOOT_IMAGE_NUMBER=1", |
| "MCUBOOT_MAX_IMG_SECTORS=3584", |
| "FLASH_AREA_BOOTLOADER_DEV_ID='FLASH_DEVICE_INTERNAL_FLASH'", |
| "FLASH_AREA_BOOTLOADER_SIZE=0x028000", |
| "FLASH_AREA_BOOTLOADER_START=0x000000", |
| "FLASH_AREA_IMAGE_SCRATCH_DEV_ID='FLASH_DEVICE_EXTERNAL_FLASH(CY_BOOT_EXTERNAL_DEVICE_INDEX)'", |
| "FLASH_AREA_IMAGE_SCRATCH_SIZE=0x080000", |
| "FLASH_AREA_IMAGE_SCRATCH_START=0x440000", |
| "FLASH_AREA_IMAGE_SWAP_STATUS_DEV_ID='FLASH_DEVICE_INTERNAL_FLASH'", |
| "FLASH_AREA_IMAGE_SWAP_STATUS_SIZE=0x006c00", |
| "FLASH_AREA_IMAGE_SWAP_STATUS_START=0x1e8000", |
| "FLASH_AREA_IMG_1_PRIMARY_DEV_ID='FLASH_DEVICE_INTERNAL_FLASH'", |
| "FLASH_AREA_IMG_1_PRIMARY_SIZE=0x1c0000", |
| "FLASH_AREA_IMG_1_PRIMARY_START=0x028000", |
| "FLASH_AREA_IMG_1_SECONDARY_DEV_ID='FLASH_DEVICE_EXTERNAL_FLASH(CY_BOOT_EXTERNAL_DEVICE_INDEX)'", |
| "FLASH_AREA_IMG_1_SECONDARY_SIZE=0x1c0000", |
| "FLASH_AREA_IMG_1_SECONDARY_START=0x000200", |
| "APP_VERSION_MAJOR=1", |
| "APP_VERSION_MINOR=0", |
| "APP_VERSION_BUILD=0", |
| ] |
| |
| if (build_update_image) { |
| defines += [ "CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION=2" ] |
| } |
| } |
| |
| psoc6_sdk_sources("lighting_app_sdk_sources") { |
| include_dirs = [ |
| "${chip_root}/src/platform/Infineon/PSOC6", |
| "${psoc6_project_dir}/include", |
| "${examples_plat_dir}", |
| ] |
| |
| defines = [ |
| "BOARD_ID=${psoc6_board}", |
| "PSOC6_LOG_ENABLED=1", |
| "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setup_pin_code}", |
| ] |
| |
| sources = [ "${psoc6_project_dir}/include/CHIPProjectConfig.h" ] |
| |
| public_configs = |
| [ "${chip_root}/third_party/infineon/psoc6:psoc6_sdk_config" ] |
| |
| if (chip_enable_ota_requestor) { |
| public_configs += [ ":psoc6_ota_config" ] |
| } |
| } |
| |
| psoc6_executable("lighting_app") { |
| include_dirs = [] |
| defines = [] |
| output_name = "chip-psoc6-lighting-example.out" |
| |
| sources = [ |
| "${examples_plat_dir}/LEDWidget.cpp", |
| "${examples_plat_dir}/init_psoc6Platform.cpp", |
| "src/AppTask.cpp", |
| "src/ButtonHandler.cpp", |
| "src/LightingManager.cpp", |
| "src/ZclCallbacks.cpp", |
| "src/main.cpp", |
| ] |
| |
| deps = [ |
| ":lighting_app_sdk_sources", |
| "${chip_root}/examples/common/QRCode", |
| "${chip_root}/examples/lighting-app/lighting-common", |
| "${chip_root}/examples/providers:device_info_provider", |
| "${chip_root}/src/lib", |
| "${chip_root}/src/platform/logging:default", |
| "${chip_root}/src/setup_payload", |
| ] |
| |
| include_dirs += [ |
| "include", |
| "${examples_plat_dir}", |
| "${psoc6_project_dir}/include", |
| ] |
| |
| defines = [] |
| |
| if (enable_heap_monitoring) { |
| sources += [ "${examples_plat_dir}/MemMonitoring.cpp" ] |
| defines += [ "HEAP_MONITORING" ] |
| } |
| |
| if (chip_print_memory_usage) { |
| ldflags += [ |
| "-Wl,--print-memory-usage", |
| "-fstack-usage", |
| ] |
| } |
| |
| output_dir = root_out_dir |
| } |
| |
| group("psoc6") { |
| deps = [ ":lighting_app" ] |
| } |
| |
| group("default") { |
| deps = [ ":psoc6" ] |
| } |