1# Copyright 2021 The Pigweed Authors 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); you may not 4# use this file except in compliance with the License. You may obtain a copy of 5# the License at 6# 7# https://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12# License for the specific language governing permissions and limitations under 13# the License. 14 15import("//build_overrides/pigweed.gni") 16 17import("$dir_pw_build/linker_script.gni") 18import("$dir_pw_build/target_types.gni") 19import("$dir_pw_docgen/docs.gni") 20import("$dir_pw_malloc/backend.gni") 21import("$dir_pw_third_party/mcuxpresso/mcuxpresso.gni") 22import("$dir_pw_toolchain/generate_toolchain.gni") 23import("target_toolchains.gni") 24 25generate_toolchains("target_toolchains") { 26 toolchains = pw_target_toolchain_mimxrt595_evk_list 27} 28 29declare_args() { 30 # This list should contain the necessary defines for setting linker script 31 # memory regions. While we don't directly use the pw_boot_cortex_m linker 32 # script, these are deliberately matching to make being able to later easier. 33 pw_target_mimxrt595_evk_LINK_CONFIG_DEFINES = [] 34} 35 36config("pw_malloc_active") { 37 if (pw_malloc_BACKEND != "") { 38 defines = [ "PW_MALLOC_ACTIVE=1" ] 39 } 40} 41 42config("disable_warnings") { 43 cflags = [ 44 "-Wno-cast-qual", 45 "-Wno-error=strict-prototypes", 46 "-Wno-redundant-decls", 47 "-Wno-shadow", 48 "-Wno-sign-compare", 49 "-Wno-type-limits", 50 "-Wno-undef", 51 "-Wno-unused-function", 52 "-Wno-unused-parameter", 53 "-Wno-unused-variable", 54 ] 55 visibility = [ ":*" ] 56} 57 58config("freestanding") { 59 cflags = [ 60 "-ffreestanding", 61 "-fno-builtin", 62 ] 63 asmflags = cflags 64 ldflags = cflags 65 visibility = [ ":*" ] 66} 67 68config("sdk_defines") { 69 defines = [ 70 "BOOT_HEADER_ENABLE=1", 71 "CPU_MIMXRT595SFFOC_cm33", 72 "DEBUG_CONSOLE_TRANSFER_NON_BLOCKING=1", 73 "DEBUG_CONSOLE_DISABLE_RTOS_SYNCHRONIZATION", 74 "FSL_SDK_DRIVER_QUICK_ACCESS_ENABLE=1", 75 "SDK_DEBUGCONSOLE=1", 76 ] 77 visibility = [ ":*" ] 78} 79 80if (current_toolchain != default_toolchain) { 81 pw_linker_script("flash_linker_script") { 82 defines = pw_target_mimxrt595_evk_LINK_CONFIG_DEFINES 83 linker_script = "mimxrt595_flash.ld" 84 } 85 if (pw_third_party_mcuxpresso_SDK != "") { 86 # Startup and vector table for NXP MIMXRT595-EVK. 87 pw_source_set("boot") { 88 public_configs = [ ":pw_malloc_active" ] 89 deps = [ 90 "$dir_pigweed/targets/mimxrt595_evk/config", 91 "$dir_pw_boot", 92 "$dir_pw_boot_cortex_m", 93 "$dir_pw_preprocessor", 94 "$dir_pw_sys_io_mcuxpresso", 95 "$dir_pw_toolchain:infinite_loop", 96 pw_third_party_mcuxpresso_SDK, 97 ] 98 if (pw_malloc_BACKEND != "") { 99 deps += [ "$dir_pw_malloc" ] 100 } 101 sources = [ 102 "boot.cc", 103 "vector_table.c", 104 ] 105 } 106 } 107} 108 109if (pw_third_party_mcuxpresso_SDK == "//targets/mimxrt595_evk:mcuxpresso_sdk") { 110 pw_source_set("mcuxpresso_sdk") { 111 public_deps = [ 112 "$dir_pw_third_party_mcuxpresso/:component.serial_manager.MIMXRT595S", 113 "$dir_pw_third_party_mcuxpresso/:component.serial_manager_uart.MIMXRT595S", 114 "$dir_pw_third_party_mcuxpresso/:platform.drivers.flash_config.evkmimxrt595.MIMXRT595S", 115 "$dir_pw_third_party_mcuxpresso/:platform.drivers.flexcomm_i2c.MIMXRT595S", 116 "$dir_pw_third_party_mcuxpresso/:platform.drivers.flexcomm_spi.MIMXRT595S", 117 "$dir_pw_third_party_mcuxpresso/:platform.drivers.flexcomm_usart_dma.MIMXRT595S", 118 "$dir_pw_third_party_mcuxpresso/:platform.drivers.flexio_spi.MIMXRT595S", 119 "$dir_pw_third_party_mcuxpresso/:platform.drivers.i3c.MIMXRT595S", 120 "$dir_pw_third_party_mcuxpresso/:platform.drivers.inputmux.MIMXRT595S", 121 "$dir_pw_third_party_mcuxpresso/:platform.drivers.lpc_dma.MIMXRT595S", 122 "$dir_pw_third_party_mcuxpresso/:platform.drivers.lpc_gpio.MIMXRT595S", 123 "$dir_pw_third_party_mcuxpresso/:platform.drivers.mu.MIMXRT595S", 124 "$dir_pw_third_party_mcuxpresso/:platform.drivers.pint.MIMXRT595S", 125 "$dir_pw_third_party_mcuxpresso/:platform.drivers.power.MIMXRT595S", 126 "$dir_pw_third_party_mcuxpresso/:platform.utilities.assert.MIMXRT595S", 127 "$dir_pw_third_party_mcuxpresso/:project_template.evkmimxrt595.MIMXRT595S", 128 "$dir_pw_third_party_mcuxpresso/:utility.debug_console.MIMXRT595S", 129 ] 130 } 131 132 pw_source_set("mcuxpresso_sdk_config") { 133 public_configs = [ 134 ":freestanding", 135 ":sdk_defines", 136 ":disable_warnings", 137 ] 138 } 139} 140 141pw_doc_group("target_docs") { 142 sources = [ "target_docs.rst" ] 143} 144