1*61c4878aSAndroid Build Coastguard Worker# Copyright 2022 The Pigweed Authors 2*61c4878aSAndroid Build Coastguard Worker# 3*61c4878aSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License"); you may not 4*61c4878aSAndroid Build Coastguard Worker# use this file except in compliance with the License. You may obtain a copy of 5*61c4878aSAndroid Build Coastguard Worker# the License at 6*61c4878aSAndroid Build Coastguard Worker# 7*61c4878aSAndroid Build Coastguard Worker# https://www.apache.org/licenses/LICENSE-2.0 8*61c4878aSAndroid Build Coastguard Worker# 9*61c4878aSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software 10*61c4878aSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11*61c4878aSAndroid Build Coastguard Worker# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12*61c4878aSAndroid Build Coastguard Worker# License for the specific language governing permissions and limitations under 13*61c4878aSAndroid Build Coastguard Worker# the License. 14*61c4878aSAndroid Build Coastguard Worker 15*61c4878aSAndroid Build Coastguard Workerimport("//build_overrides/pigweed.gni") 16*61c4878aSAndroid Build Coastguard Workerimport("$dir_pw_build/linker_script.gni") 17*61c4878aSAndroid Build Coastguard Workerimport("$dir_pw_build/target_types.gni") 18*61c4878aSAndroid Build Coastguard Workerimport("$dir_pw_third_party/smartfusion_mss/mss.gni") 19*61c4878aSAndroid Build Coastguard Worker 20*61c4878aSAndroid Build Coastguard Workerdeclare_args() { 21*61c4878aSAndroid Build Coastguard Worker pw_target_smartfusion2_LINK_CONFIG_DEFINES = [] 22*61c4878aSAndroid Build Coastguard Worker} 23*61c4878aSAndroid Build Coastguard Worker 24*61c4878aSAndroid Build Coastguard Workerif (dir_pw_third_party_smartfusion_mss != "") { 25*61c4878aSAndroid Build Coastguard Worker # The list currently includes all source files for build. 26*61c4878aSAndroid Build Coastguard Worker smartfusion_mss_sources = [ 27*61c4878aSAndroid Build Coastguard Worker "exported_firmware/CMSIS/startup_gcc/startup_m2sxxx.S", 28*61c4878aSAndroid Build Coastguard Worker "exported_firmware/CMSIS/system_m2sxxx.c", 29*61c4878aSAndroid Build Coastguard Worker "exported_firmware/drivers/mss_can/mss_can.c", 30*61c4878aSAndroid Build Coastguard Worker "exported_firmware/drivers/mss_ethernet_mac/m88e1340_phy.c", 31*61c4878aSAndroid Build Coastguard Worker "exported_firmware/drivers/mss_ethernet_mac/mss_ethernet_mac.c", 32*61c4878aSAndroid Build Coastguard Worker "exported_firmware/drivers/mss_gpio/mss_gpio.c", 33*61c4878aSAndroid Build Coastguard Worker "exported_firmware/drivers/mss_hpdma/mss_hpdma.c", 34*61c4878aSAndroid Build Coastguard Worker "exported_firmware/drivers/mss_i2c/mss_i2c.c", 35*61c4878aSAndroid Build Coastguard Worker "exported_firmware/drivers/mss_nvm/mss_nvm.c", 36*61c4878aSAndroid Build Coastguard Worker "exported_firmware/drivers/mss_rtc/mss_rtc.c", 37*61c4878aSAndroid Build Coastguard Worker "exported_firmware/drivers/mss_spi/mss_spi.c", 38*61c4878aSAndroid Build Coastguard Worker "exported_firmware/drivers/mss_sys_services/mss_comblk.c", 39*61c4878aSAndroid Build Coastguard Worker "exported_firmware/drivers/mss_sys_services/mss_sys_services.c", 40*61c4878aSAndroid Build Coastguard Worker "exported_firmware/drivers/mss_uart/mss_uart.c", 41*61c4878aSAndroid Build Coastguard Worker "exported_firmware/drivers/mss_usb/mss_usb_common_cif.c", 42*61c4878aSAndroid Build Coastguard Worker "exported_firmware/drivers/mss_usb/mss_usb_device.c", 43*61c4878aSAndroid Build Coastguard Worker "exported_firmware/drivers/mss_usb/mss_usb_device_cdc.c", 44*61c4878aSAndroid Build Coastguard Worker "exported_firmware/drivers/mss_usb/mss_usb_device_cif.c", 45*61c4878aSAndroid Build Coastguard Worker "exported_firmware/drivers/mss_usb/mss_usb_device_hid.c", 46*61c4878aSAndroid Build Coastguard Worker "exported_firmware/drivers/mss_usb/mss_usb_device_msd.c", 47*61c4878aSAndroid Build Coastguard Worker "exported_firmware/drivers/mss_usb/mss_usb_device_printer.c", 48*61c4878aSAndroid Build Coastguard Worker "exported_firmware/drivers/mss_usb/mss_usb_device_rndis.c", 49*61c4878aSAndroid Build Coastguard Worker "exported_firmware/drivers/mss_usb/mss_usb_device_vendor.c", 50*61c4878aSAndroid Build Coastguard Worker "exported_firmware/drivers/mss_usb/mss_usb_host.c", 51*61c4878aSAndroid Build Coastguard Worker "exported_firmware/drivers/mss_usb/mss_usb_host_cif.c", 52*61c4878aSAndroid Build Coastguard Worker "exported_firmware/drivers/mss_usb/mss_usb_host_msc.c", 53*61c4878aSAndroid Build Coastguard Worker "exported_firmware/drivers_config/sys_config/sys_config.c", 54*61c4878aSAndroid Build Coastguard Worker ] 55*61c4878aSAndroid Build Coastguard Worker 56*61c4878aSAndroid Build Coastguard Worker liberosoc_configs = [ 57*61c4878aSAndroid Build Coastguard Worker { 58*61c4878aSAndroid Build Coastguard Worker name = "default" 59*61c4878aSAndroid Build Coastguard Worker config_header = "configs/config_default.h" 60*61c4878aSAndroid Build Coastguard Worker }, 61*61c4878aSAndroid Build Coastguard Worker { 62*61c4878aSAndroid Build Coastguard Worker name = "debug" 63*61c4878aSAndroid Build Coastguard Worker config_header = "configs/config_debug.h" 64*61c4878aSAndroid Build Coastguard Worker }, 65*61c4878aSAndroid Build Coastguard Worker ] 66*61c4878aSAndroid Build Coastguard Worker 67*61c4878aSAndroid Build Coastguard Worker foreach(ele, liberosoc_configs) { 68*61c4878aSAndroid Build Coastguard Worker config_name = ele.name + "_config" 69*61c4878aSAndroid Build Coastguard Worker config(config_name) { 70*61c4878aSAndroid Build Coastguard Worker # Custom config file is specified by macro liberosoc_CONFIG_FILE 71*61c4878aSAndroid Build Coastguard Worker # for liberosoc 72*61c4878aSAndroid Build Coastguard Worker defines = [ "liberosoc_CONFIG_FILE=\"${ele.config_header}\"" ] 73*61c4878aSAndroid Build Coastguard Worker } 74*61c4878aSAndroid Build Coastguard Worker 75*61c4878aSAndroid Build Coastguard Worker srcset_name = ele.name + "_config_srcset" 76*61c4878aSAndroid Build Coastguard Worker pw_source_set(srcset_name) { 77*61c4878aSAndroid Build Coastguard Worker public = [ 78*61c4878aSAndroid Build Coastguard Worker "configs/config_pigweed_common.h", 79*61c4878aSAndroid Build Coastguard Worker ele.config_header, 80*61c4878aSAndroid Build Coastguard Worker ] 81*61c4878aSAndroid Build Coastguard Worker public_configs = [ 82*61c4878aSAndroid Build Coastguard Worker ":${config_name}", 83*61c4878aSAndroid Build Coastguard Worker ":smartfusion_mss_common_config", 84*61c4878aSAndroid Build Coastguard Worker ] 85*61c4878aSAndroid Build Coastguard Worker } 86*61c4878aSAndroid Build Coastguard Worker } 87*61c4878aSAndroid Build Coastguard Worker 88*61c4878aSAndroid Build Coastguard Worker config("smartfusion_mss_common_config") { 89*61c4878aSAndroid Build Coastguard Worker include_dirs = [ 90*61c4878aSAndroid Build Coastguard Worker "$dir_pw_third_party_smartfusion_mss/exported_firmware/CMSIS/V4.5/Include", 91*61c4878aSAndroid Build Coastguard Worker "$dir_pw_third_party_smartfusion_mss/exported_firmware/drivers", 92*61c4878aSAndroid Build Coastguard Worker "$dir_pw_third_party_smartfusion_mss/exported_firmware/CMSIS", 93*61c4878aSAndroid Build Coastguard Worker "$dir_pw_third_party/smartfusion_mss", 94*61c4878aSAndroid Build Coastguard Worker ] 95*61c4878aSAndroid Build Coastguard Worker cflags = [ 96*61c4878aSAndroid Build Coastguard Worker "-Wno-error=cast-qual", 97*61c4878aSAndroid Build Coastguard Worker "-Wno-error=redundant-decls", 98*61c4878aSAndroid Build Coastguard Worker "-w", 99*61c4878aSAndroid Build Coastguard Worker ] 100*61c4878aSAndroid Build Coastguard Worker } 101*61c4878aSAndroid Build Coastguard Worker 102*61c4878aSAndroid Build Coastguard Worker pw_source_set("smartfusion_mss") { 103*61c4878aSAndroid Build Coastguard Worker sources = [] 104*61c4878aSAndroid Build Coastguard Worker foreach(source, smartfusion_mss_sources) { 105*61c4878aSAndroid Build Coastguard Worker sources += [ "$dir_pw_third_party_smartfusion_mss/" + source ] 106*61c4878aSAndroid Build Coastguard Worker } 107*61c4878aSAndroid Build Coastguard Worker public_deps = [ ":${pw_third_party_smartfusion_mss_CONFIG}_config_srcset" ] 108*61c4878aSAndroid Build Coastguard Worker } 109*61c4878aSAndroid Build Coastguard Worker} else { 110*61c4878aSAndroid Build Coastguard Worker group("smartfusion_mss") { 111*61c4878aSAndroid Build Coastguard Worker } 112*61c4878aSAndroid Build Coastguard Worker} 113