1# Copyright 2022 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") 16import("$dir_pw_build/linker_script.gni") 17import("$dir_pw_build/target_types.gni") 18import("$dir_pw_third_party/smartfusion_mss/mss.gni") 19 20declare_args() { 21 pw_target_smartfusion2_LINK_CONFIG_DEFINES = [] 22} 23 24if (dir_pw_third_party_smartfusion_mss != "") { 25 # The list currently includes all source files for build. 26 smartfusion_mss_sources = [ 27 "exported_firmware/CMSIS/startup_gcc/startup_m2sxxx.S", 28 "exported_firmware/CMSIS/system_m2sxxx.c", 29 "exported_firmware/drivers/mss_can/mss_can.c", 30 "exported_firmware/drivers/mss_ethernet_mac/m88e1340_phy.c", 31 "exported_firmware/drivers/mss_ethernet_mac/mss_ethernet_mac.c", 32 "exported_firmware/drivers/mss_gpio/mss_gpio.c", 33 "exported_firmware/drivers/mss_hpdma/mss_hpdma.c", 34 "exported_firmware/drivers/mss_i2c/mss_i2c.c", 35 "exported_firmware/drivers/mss_nvm/mss_nvm.c", 36 "exported_firmware/drivers/mss_rtc/mss_rtc.c", 37 "exported_firmware/drivers/mss_spi/mss_spi.c", 38 "exported_firmware/drivers/mss_sys_services/mss_comblk.c", 39 "exported_firmware/drivers/mss_sys_services/mss_sys_services.c", 40 "exported_firmware/drivers/mss_uart/mss_uart.c", 41 "exported_firmware/drivers/mss_usb/mss_usb_common_cif.c", 42 "exported_firmware/drivers/mss_usb/mss_usb_device.c", 43 "exported_firmware/drivers/mss_usb/mss_usb_device_cdc.c", 44 "exported_firmware/drivers/mss_usb/mss_usb_device_cif.c", 45 "exported_firmware/drivers/mss_usb/mss_usb_device_hid.c", 46 "exported_firmware/drivers/mss_usb/mss_usb_device_msd.c", 47 "exported_firmware/drivers/mss_usb/mss_usb_device_printer.c", 48 "exported_firmware/drivers/mss_usb/mss_usb_device_rndis.c", 49 "exported_firmware/drivers/mss_usb/mss_usb_device_vendor.c", 50 "exported_firmware/drivers/mss_usb/mss_usb_host.c", 51 "exported_firmware/drivers/mss_usb/mss_usb_host_cif.c", 52 "exported_firmware/drivers/mss_usb/mss_usb_host_msc.c", 53 "exported_firmware/drivers_config/sys_config/sys_config.c", 54 ] 55 56 liberosoc_configs = [ 57 { 58 name = "default" 59 config_header = "configs/config_default.h" 60 }, 61 { 62 name = "debug" 63 config_header = "configs/config_debug.h" 64 }, 65 ] 66 67 foreach(ele, liberosoc_configs) { 68 config_name = ele.name + "_config" 69 config(config_name) { 70 # Custom config file is specified by macro liberosoc_CONFIG_FILE 71 # for liberosoc 72 defines = [ "liberosoc_CONFIG_FILE=\"${ele.config_header}\"" ] 73 } 74 75 srcset_name = ele.name + "_config_srcset" 76 pw_source_set(srcset_name) { 77 public = [ 78 "configs/config_pigweed_common.h", 79 ele.config_header, 80 ] 81 public_configs = [ 82 ":${config_name}", 83 ":smartfusion_mss_common_config", 84 ] 85 } 86 } 87 88 config("smartfusion_mss_common_config") { 89 include_dirs = [ 90 "$dir_pw_third_party_smartfusion_mss/exported_firmware/CMSIS/V4.5/Include", 91 "$dir_pw_third_party_smartfusion_mss/exported_firmware/drivers", 92 "$dir_pw_third_party_smartfusion_mss/exported_firmware/CMSIS", 93 "$dir_pw_third_party/smartfusion_mss", 94 ] 95 cflags = [ 96 "-Wno-error=cast-qual", 97 "-Wno-error=redundant-decls", 98 "-w", 99 ] 100 } 101 102 pw_source_set("smartfusion_mss") { 103 sources = [] 104 foreach(source, smartfusion_mss_sources) { 105 sources += [ "$dir_pw_third_party_smartfusion_mss/" + source ] 106 } 107 public_deps = [ ":${pw_third_party_smartfusion_mss_CONFIG}_config_srcset" ] 108 } 109} else { 110 group("smartfusion_mss") { 111 } 112} 113