public KinetisBuilder(BSPDirectories dirs, bool parsePeripheralRegisters) : base(dirs) { ShortName = "Kinetis"; LDSTemplate = XmlTools.LoadObject<LinkerScriptTemplate>(dirs.RulesDir + @"\Kinetis.ldsx"); _parsePeripheralRegisters = parsePeripheralRegisters; }
//=========================================================== static void Main(string[] args) { List<HardwareRegister> registers; if (args.Length < 1) throw new Exception("Usage: InfineonXMC.exe <InfineonXMC SW package directory>"); var bspDir = new BSPDirectories(args[0], @"..\..\Output", @"..\..\rules"); string aDirCoreReg = @"..\..\OutCorexx"; //bspDir.OutputDir var setsCortexM0 = SVDParser.ParseSVDFileToHardSet(Path.Combine(bspDir.RulesDir, @"XMC1100.svd"), "Cortex-M0 Private Peripheral Block"); SaveReg(setsCortexM0, aDirCoreReg, CortexCore.M0); if (setsCortexM0 == null) throw new Exception("No ppb reg M0"); // Cortex M4--- var setsCortexM4 = SVDParser.ParseSVDFileToHardSet(Path.Combine(bspDir.RulesDir, @"XMC4100.svd"), "Cortex-M4 Private Peripheral Block"); if (setsCortexM4 == null) throw new Exception("No ppb reg M4"); SaveReg(setsCortexM4, aDirCoreReg, CortexCore.M4); // Cortex M3--- registers = new List<HardwareRegister>(setsCortexM4.Registers); //FPU Remove registers.Remove(registers.FirstOrDefault(f => "CPACR" == f.Name)); registers.Remove(registers.FirstOrDefault(f => "FPCCR" == f.Name)); registers.Remove(registers.FirstOrDefault(f => "FPCAR" == f.Name)); registers.Remove(registers.FirstOrDefault(f => "FPSCR" == f.Name)); registers.Remove(registers.FirstOrDefault(f => "FPDSCR" == f.Name)); setsCortexM4.Registers = registers.ToArray(); SaveReg(setsCortexM4, aDirCoreReg, CortexCore.M3); // Cortex M0Plus--- registers.Clear(); registers.AddRange(setsCortexM0.Registers); registers.AddRange(LoadAddReg(Path.Combine(bspDir.RulesDir, "core_m0mpu.txt"))); setsCortexM4.Registers = registers.ToArray(); SaveReg(setsCortexM4, aDirCoreReg, CortexCore.M0Plus); // Cortex M7--- setsCortexM4 = SVDParser.ParseSVDFileToHardSet(Path.Combine(bspDir.InputDir, @"CMSIS\Infineon\SVD\XMC4100.svd"), "Cortex-M4 Private Peripheral Block"); registers.Clear(); registers.AddRange(setsCortexM4.Registers); registers.AddRange(LoadAddReg(Path.Combine(bspDir.RulesDir, "core_m7ppb.txt"))); setsCortexM4.Registers = registers.ToArray(); SaveReg(setsCortexM4, aDirCoreReg, CortexCore.M7); }
public Msp432Builder(BSPDirectories dirs) : base(dirs, linkerScriptLevel: 5) { ShortName = "MSP432"; }
public InfineonXMCBSPBuilder(BSPDirectories dirs) : base(dirs) { ShortName = "Infineon_XMC"; LDSTemplateX1 = XmlTools.LoadObject<LinkerScriptTemplate>(@"..\..\..\..\GenericARM.ldsx"); var dataSection = LDSTemplateX1.Sections.IndexOf(LDSTemplateX1.Sections.First(s => s.Name == ".data")); LDSTemplateX1.Sections.First(s => s.Name == ".isr_vector").Flags |= SectionFlags.DefineShortLabels | SectionFlags.ProvideLongLabels; LDSTemplateX1.Sections.Insert(dataSection, new Section { Name = ".isr_veneers", TargetMemory = "SRAM", Alignment = 4, CustomContents = new string[] { ". = . + SIZEOF(.isr_vector) * 2;" }, Flags = SectionFlags.DefineShortLabels | SectionFlags.ProvideLongLabels, }); LDSTemplate = LDSTemplateX1; }
static List<Framework> GenereteAddFrameWorks(BSPDirectories pBspDir, string pstrFile) { List<Framework> bleFrameworks = new List<Framework>(); foreach (var line in File.ReadAllLines(Path.Combine(pBspDir.RulesDir, pstrFile)))// bspBuilder.Directories.RulesDir + @"\EmbFrameworks.txt")) { int idx = line.IndexOf('|'); string dir = line.Substring(0, idx); string desc = line.Substring(idx + 1); string id = Path.GetFileName(dir); List<string> strRFrameworks = new List<string>(); if (dir.StartsWith("smtp") || dir.StartsWith("http/server") || dir.StartsWith("xmpp")) strRFrameworks.Add("com.sysprogs.arm.ti.cc3200.netapps.base64encoder"); id = dir.Replace("/", "_"); Patch[] aPatchesFilesFramowirks = null; string[] aStrIns = { "#include <stdlib.h>", "#define esnprintf snprintf" }; string[] aStrInsiFn = { "#if 0" }; string[] aStrInsiFnLe = { "#endif" }; string[] aStrInsInT = { " #include <sys/types.h>" }; string[] aStrInsLPrintN = { "#define Log_print1(...)", "#define Log_print2(...)", "#define Log_print3(...)", "#define Log_print4(...)", "#define Log_print5(...)", "#define Log_print6(...)", "#define Log_print0(...)"}; if (dir.StartsWith("http/client")) aPatchesFilesFramowirks = new Patch[] { #region JOB_PATCHES_FILES new Patch.ReplaceLine { FilePath = "httpsrv.h", OldLine = "#include <ti/net/network.h>", NewLine = "#include <network.h>", }, new Patch.ReplaceLine { FilePath = "httpsrv.c", OldLine = "#include <ti/net/network.h>", NewLine = "#include <network.h>", }, new Patch.ReplaceLine { FilePath = "ssnull.c", OldLine = "#include <ti/net/network.h>", NewLine = "#include <network.h>", }, new Patch.ReplaceLine { FilePath = "httpsend.c", OldLine = "#include <ti/net/http/httpsrv.h>", NewLine = "#include \"httpsrv.h\"", }, new Patch.ReplaceLine { FilePath = "httpsend.c", OldLine = "#error \"undefined printf() macros\"", NewLine = "//#error \"undefined printf() macros\"", }, new Patch.InsertLines { FilePath = "httpsend.c", AfterLine = "//#error \"undefined printf() macros\"", InsertedLines = aStrIns, }, new Patch.ReplaceLine { FilePath = "httpsrv.c", OldLine = "Registry_Desc ti_net_http_HTTPSrv_desc;", NewLine = "//Registry_Desc ti_net_http_HTTPSrv_desc;", }, new Patch.ReplaceLine { FilePath = "httpsrv.c", OldLine = "#include <ti/net/http/ssock.h>", NewLine = "#include \"ssock.h\"", }, new Patch.ReplaceLine { FilePath = "httpsrv.c", OldLine = "#include <ti/net/http/urlhandler.h>", NewLine = "#include \"urlhandler.h\"", }, new Patch.ReplaceLine { FilePath = "httpsrv.c", OldLine = " Registry_addModule(&ti_net_http_HTTPSrv_desc, \"ti.net.http.HTTPSrv\");", NewLine = " //Registry_addModule(&ti_net_http_HTTPSrv_desc, \"ti.net.http.HTTPSrv\");", }, //------urlfile.h new Patch.ReplaceLine { FilePath = "httpsrv.h", OldLine = "#include <ti/net/http/ssock.h>", NewLine = "#include \"ssock.h\"", }, new Patch.ReplaceLine { FilePath = "httpsrv.h", OldLine = "#include <ti/net/http/urlhandler.h>", NewLine = "#include \"urlhandler.h\"", }, //--- logging.h new Patch.InsertLines { FilePath = "logging.h", AfterLine = "#define _LOGGING_H_", InsertedLines = aStrInsiFn, }, new Patch.InsertLines { FilePath = "logging.h", AfterLine = "extern Registry_Desc ti_net_http_HTTPSrv_desc;", InsertedLines = aStrInsiFnLe, }, new Patch.InsertLines { FilePath = "logging.h", AfterLine = "#endif", InsertedLines = aStrInsLPrintN, }, ///------------------ network.h new Patch.InsertLines { FilePath = "network.h", AfterLine = "#include <simplelink.h>", InsertedLines = aStrInsInT, }, new Patch.ReplaceLine { FilePath = "network.h", OldLine = "typedef long int ssize_t;", NewLine = "//typedef long int ssize_t;", }, //------urlfile.h new Patch.ReplaceLine { FilePath = "urlfile.h", OldLine = "#include <ti/net/http/ssock.h>", NewLine = "#include \"ssock.h\"", }, new Patch.ReplaceLine { FilePath = "urlfile.h", OldLine = "#include <ti/net/http/urlhandler.h>", NewLine = "#include \"urlhandler.h\"", }, #endregion JOB_PATCHES_FILES }; bleFrameworks.Add(new Framework { Name = string.Format("Net Apps - {0} ({1})", desc, Path.GetFileName(dir)), ID = "com.sysprogs.arm.ti.cc3200.netapps." + id, ClassID = "com.sysprogs.arm.ti.cc3200.cl.netapps." + id, ProjectFolderName = "netapps_" + dir, DefaultEnabled = false, RequiredFrameworks = strRFrameworks.ToArray(), CopyJobs = new CopyJob[] { new CopyJob { SourceFolder = @"$$BSPGEN:INPUT_DIR$$\cc3200-sdk\netapps\" + dir, TargetFolder = @"netapps\" + dir, FilesToCopy = "-*base64.c;*.c;*.h", Patches = aPatchesFilesFramowirks, } } }); } return bleFrameworks; }
public RISCVBSPBuilder(BSPDirectories dirs) : base(dirs) { }
public TivaBSPBuilder(BSPDirectories dirs) : base(dirs) { ShortName = "Tiva"; }
public DummyBSPBuilder(BSPDirectories dirs) : base(dirs, null, -1) { }
public STM32BSPBuilder(BSPDirectories dirs, string cubeDir) : base(dirs) { ShortName = "STM32"; }
public NxpBSPBuilder(BSPDirectories dirs) : base(dirs) { ShortName = "NXP_LPC"; _Memories = ParseMemories(Path.Combine(dirs.RulesDir, "memories.csv")); }
public Msp432Builder(BSPDirectories dirs) : base(dirs) { ShortName = "MSP432"; }
public TivaBSPBuilder(BSPDirectories dirs) : base(dirs, null, 5) { ShortName = "Tiva"; }
static List <Framework> GenereteAddFrameWorks(BSPDirectories pBspDir, string pstrFile) { List <Framework> bleFrameworks = new List <Framework>(); foreach (var line in File.ReadAllLines(Path.Combine(pBspDir.RulesDir, pstrFile)))// bspBuilder.Directories.RulesDir + @"\EmbFrameworks.txt")) { int idx = line.IndexOf('|'); string dir = line.Substring(0, idx); string desc = line.Substring(idx + 1); string id = Path.GetFileName(dir); List <string> strRFrameworks = new List <string>(); if (dir.StartsWith("smtp") || dir.StartsWith("http/server") || dir.StartsWith("xmpp")) { strRFrameworks.Add("com.sysprogs.arm.ti.cc3200.netapps.base64encoder"); } id = dir.Replace("/", "_"); Patch[] aPatchesFilesFramowirks = null; string[] aStrIns = { "#include <stdlib.h>", "#define esnprintf snprintf" }; string[] aStrInsiFn = { "#if 0" }; string[] aStrInsiFnLe = { "#endif" }; string[] aStrInsInT = { " #include <sys/types.h>" }; string[] aStrInsLPrintN = { "#define Log_print1(...)", "#define Log_print2(...)", "#define Log_print3(...)", "#define Log_print4(...)", "#define Log_print5(...)", "#define Log_print6(...)", "#define Log_print0(...)" }; if (dir.StartsWith("http/client")) { aPatchesFilesFramowirks = new Patch[] { #region JOB_PATCHES_FILES new Patch.ReplaceLine { FilePath = "httpsrv.h", OldLine = "#include <ti/net/network.h>", NewLine = "#include <network.h>", }, new Patch.ReplaceLine { FilePath = "httpsrv.c", OldLine = "#include <ti/net/network.h>", NewLine = "#include <network.h>", }, new Patch.ReplaceLine { FilePath = "ssnull.c", OldLine = "#include <ti/net/network.h>", NewLine = "#include <network.h>", }, new Patch.ReplaceLine { FilePath = "httpsend.c", OldLine = "#include <ti/net/http/httpsrv.h>", NewLine = "#include \"httpsrv.h\"", }, new Patch.ReplaceLine { FilePath = "httpsend.c", OldLine = "#error \"undefined printf() macros\"", NewLine = "//#error \"undefined printf() macros\"", }, new Patch.InsertLines { FilePath = "httpsend.c", AfterLine = "//#error \"undefined printf() macros\"", InsertedLines = aStrIns, }, new Patch.ReplaceLine { FilePath = "httpsrv.c", OldLine = "Registry_Desc ti_net_http_HTTPSrv_desc;", NewLine = "//Registry_Desc ti_net_http_HTTPSrv_desc;", }, new Patch.ReplaceLine { FilePath = "httpsrv.c", OldLine = "#include <ti/net/http/ssock.h>", NewLine = "#include \"ssock.h\"", }, new Patch.ReplaceLine { FilePath = "httpsrv.c", OldLine = "#include <ti/net/http/urlhandler.h>", NewLine = "#include \"urlhandler.h\"", }, new Patch.ReplaceLine { FilePath = "httpsrv.c", OldLine = " Registry_addModule(&ti_net_http_HTTPSrv_desc, \"ti.net.http.HTTPSrv\");", NewLine = " //Registry_addModule(&ti_net_http_HTTPSrv_desc, \"ti.net.http.HTTPSrv\");", }, //------urlfile.h new Patch.ReplaceLine { FilePath = "httpsrv.h", OldLine = "#include <ti/net/http/ssock.h>", NewLine = "#include \"ssock.h\"", }, new Patch.ReplaceLine { FilePath = "httpsrv.h", OldLine = "#include <ti/net/http/urlhandler.h>", NewLine = "#include \"urlhandler.h\"", }, //--- logging.h new Patch.InsertLines { FilePath = "logging.h", AfterLine = "#define _LOGGING_H_", InsertedLines = aStrInsiFn, }, new Patch.InsertLines { FilePath = "logging.h", AfterLine = "extern Registry_Desc ti_net_http_HTTPSrv_desc;", InsertedLines = aStrInsiFnLe, }, new Patch.InsertLines { FilePath = "logging.h", AfterLine = "#endif", InsertedLines = aStrInsLPrintN, }, ///------------------ network.h new Patch.InsertLines { FilePath = "network.h", AfterLine = "#include <simplelink.h>", InsertedLines = aStrInsInT, }, new Patch.ReplaceLine { FilePath = "network.h", OldLine = "typedef long int ssize_t;", NewLine = "//typedef long int ssize_t;", }, //------urlfile.h new Patch.ReplaceLine { FilePath = "urlfile.h", OldLine = "#include <ti/net/http/ssock.h>", NewLine = "#include \"ssock.h\"", }, new Patch.ReplaceLine { FilePath = "urlfile.h", OldLine = "#include <ti/net/http/urlhandler.h>", NewLine = "#include \"urlhandler.h\"", }, #endregion JOB_PATCHES_FILES } } ; bleFrameworks.Add(new Framework { Name = string.Format("Net Apps - {0} ({1})", desc, Path.GetFileName(dir)), ID = "com.sysprogs.arm.ti.cc3200.netapps." + id, ClassID = "com.sysprogs.arm.ti.cc3200.cl.netapps." + id, ProjectFolderName = "netapps_" + dir, DefaultEnabled = false, RequiredFrameworks = strRFrameworks.ToArray(), CopyJobs = new CopyJob[] { new CopyJob { SourceFolder = @"$$BSPGEN:INPUT_DIR$$\cc3200-sdk\netapps\" + dir, TargetFolder = @"netapps\" + dir, FilesToCopy = "-*base64.c;*.c;*.h", Patches = aPatchesFilesFramowirks, } } }); } return(bleFrameworks); }
public CC3200BSPBuilder(BSPDirectories dirs) : base(dirs) { ShortName = "CC3200"; }
static List <Framework> GenereteAddFrameWorksDir(BSPDirectories pBspDir, string pstrTypSam) { List <Framework> bleFrameworks = new List <Framework>(); List <PropertyEntry> propFr = new List <PropertyEntry>(); PropertyList pl = new PropertyList(); List <string> a_SimpleFileConditions = new List <string>(); string strIdFr = "com.sysprogs.arm.atmel.drivers." + pstrTypSam; string strClFr = "com.sysprogs.arm.atmel.cl.drivers." + pstrTypSam; string nameFr = pstrTypSam.ToUpper() + "_Drivers"; string asrcJob = @"$$BSPGEN:INPUT_DIR$$\" + pstrTypSam + @"\drivers"; string astrTargetJob = pstrTypSam + @"\drivers"; string astrFileJob = "-*example*.c;-*example*.h;-*unit_test*.*;-*doxygen*;-*mega*;-*avr*;-*adc_enhanced_mode*;-*quick_start*;*.c;*.h"; string aInclJob = "";// " - sam[0-9g]?*;-uc*;*.h"; string aPrjInclMsk = "*.c;*.h"; List <string> strIncompFrIDs = new List <string>(); if (pstrTypSam.ToUpper() == "SAM") { strIncompFrIDs.Add("com.sysprogs.arm.atmel.drivers.sam0"); } else { aPrjInclMsk = "-sercom\\spi_master_vec\\*.c;-*_sam*.h;*.c;*.h"; aInclJob = "$$SYS:BSP_ROOT$$/sam0/drivers/system/clock/$$com.sysprogs.atmel.sam0.driver.clock$$;" + "$$SYS:BSP_ROOT$$/sam0/drivers/system/clock/$$com.sysprogs.atmel.sam0.driver.clock$$/module_config;" + "$$SYS:BSP_ROOT$$/sam0/drivers/system/interrupt/$$com.sysprogs.atmel.sam0.driver.interrupt$$;" + "$$SYS:BSP_ROOT$$/sam0/drivers/system/interrupt/$$com.sysprogs.atmel.sam0.driver.interrupt$$/module_config;" + "$$SYS:BSP_ROOT$$/sam0/drivers/system/power/$$com.sysprogs.atmel.sam0.driver.power$$;" + "$$SYS:BSP_ROOT$$/sam0/drivers/system/reset/$$com.sysprogs.atmel.sam0.driver.reset$$" + ";$$SYS:BSP_ROOT$$/sam0/drivers/adc/$$com.sysprogs.atmel.sam0.driver.globaldir$$"; foreach (var dirdr in Directory.GetDirectories(Path.Combine(pBspDir.InputDir, pstrTypSam + @"\drivers"))) { foreach (var dirdr1 in Directory.GetDirectories(dirdr)) { if (dirdr1.Contains("_sam")) { string aName = dirdr.Substring(dirdr.LastIndexOf("\\") + 1); aInclJob += @";$$SYS:BSP_ROOT$$/sam0/drivers/" + aName + @"/" + aName + "$$com.sysprogs.atmel.sam0.driver.globaldir$$"; break; } } } strIncompFrIDs.Add("com.sysprogs.arm.atmel.drivers.sam"); } string[] strPropFrim = Directory.GetDirectories(Path.Combine(pBspDir.InputDir, pstrTypSam + @"\drivers")); SetDriverConditions(strPropFrim, ref propFr, ref a_SimpleFileConditions, ref aInclJob, pstrTypSam); List <PropertyGroup> pg = new List <PropertyGroup>(); pg.Add(new PropertyGroup { Name = nameFr, Properties = propFr }); pl.PropertyGroups = pg; aInclJob = aInclJob.Trim(';'); if (aInclJob == "") { aInclJob = null; } bleFrameworks.Add(new Framework { Name = nameFr + "Library", ID = strIdFr, ClassID = strClFr, ProjectFolderName = "Atmel_" + nameFr, DefaultEnabled = false, IncompatibleFrameworks = strIncompFrIDs.ToArray(), CopyJobs = new CopyJob[] { new CopyJob { PreprocessorMacros = "ADC_CALLBACK_MODE=true;USART_CALLBACK_MODE=true", SourceFolder = asrcJob, TargetFolder = astrTargetJob, FilesToCopy = astrFileJob, SimpleFileConditions = a_SimpleFileConditions.ToArray(), AutoIncludeMask = "-*_sam*.h;*.h", AdditionalIncludeDirs = aInclJob, ProjectInclusionMask = aPrjInclMsk } }, ConfigurableProperties = pl, }); return(bleFrameworks); }
public AtmelBSPBuilder(BSPDirectories dirs) : base(dirs) { ShortName = "Atmel"; }
public ESP32BSPBuilder(BSPDirectories dirs) : base(dirs) { }
public RM57xBSPBuilder(BSPDirectories dirs) : base(dirs, null, 5) { ShortName = "RM57x"; }
static List <Framework> GenereteAddFrameWorks(BSPDirectories pBspDir, string pstrFile) { List <Framework> bleFrameworks = new List <Framework>(); List <PropertyEntry> propFr = new List <PropertyEntry>(); PropertyList pl = new PropertyList(); List <string> a_SimpleFileConditions = new List <string>(); foreach (var line in File.ReadAllLines(Path.Combine(pBspDir.RulesDir, pstrFile))) { string dir = line; string desc = ""; string id = dir; int idx = line.IndexOf('|'); if (idx > 0) { dir = line.Substring(0, idx); desc = line.Substring(idx + 1); id = Path.GetFileName(dir); } dir = dir.ToLower(); id = dir.Replace("\\", "_"); string a_name = line.Substring(line.LastIndexOf("\\") + 1).ToLower();; dir = a_name; string aIncludeMask = "-sam[0-9g]?*;-uc*;*.h"; a_SimpleFileConditions.Clear(); if (a_name.ToLower() == "sleepmgr") { a_SimpleFileConditions.Add(@"samd\\*: $$com.sysprogs.atmel.sam32._header_prefix_samser$$ == samd"); a_SimpleFileConditions.Add(@"samc\\*: $$com.sysprogs.atmel.sam32._header_prefix_samser$$ == samc"); a_SimpleFileConditions.Add(@"sam\\*: $$com.sysprogs.atmel.sam32._header_prefix_sam0$$ != yes"); aIncludeMask = @"-*/*;*.h"; } if (a_name.ToLower() == "serial") { a_SimpleFileConditions.Add(@"sam0_usart\\*: $$com.sysprogs.atmel.sam32._header_prefix_sam0$$ == yes"); a_SimpleFileConditions.Add(@"sam_uart\\*: $$com.sysprogs.atmel.sam32._header_prefix_sam0$$ != yes"); a_SimpleFileConditions.Add(@"samb_uart\\*: $$com.sysprogs.atmel.sam32._header_prefix_sam0$$ == samb"); aIncludeMask = @"-*/*;*.h"; } if (a_name.ToLower() == "adp" || a_name.ToLower() == "ioport") { a_SimpleFileConditions.Add(@"sam0\\*: $$com.sysprogs.atmel.sam32._header_prefix_sam0$$ == yes"); a_SimpleFileConditions.Add(@"sam\\*: $$com.sysprogs.atmel.sam32._header_prefix_sam0$$ != yes"); aIncludeMask = @"-*/*;*.h"; } if (a_name.ToLower() == "clock") { a_SimpleFileConditions.Add(@"sam4l\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == sam4l"); a_SimpleFileConditions.Add(@"sam3n\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == sam3n"); a_SimpleFileConditions.Add(@"sam3s\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == sam3s"); a_SimpleFileConditions.Add(@"sam3u\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == sam3u"); a_SimpleFileConditions.Add(@"sam3x\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == sam3x"); a_SimpleFileConditions.Add(@"sam4c\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == sam4c"); a_SimpleFileConditions.Add(@"sam4cp\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == sam4cp"); a_SimpleFileConditions.Add(@"sam4cm\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == sam4cm"); a_SimpleFileConditions.Add(@"sam4e\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == sam4e"); a_SimpleFileConditions.Add(@"sam4n\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == sam4n"); a_SimpleFileConditions.Add(@"sam4s\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == sam4s"); a_SimpleFileConditions.Add(@"same70\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == same70"); a_SimpleFileConditions.Add(@"sams70\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == sams70"); a_SimpleFileConditions.Add(@"samv70\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == samv70"); a_SimpleFileConditions.Add(@"samv71\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == samv71"); a_SimpleFileConditions.Add(@"samg\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == samg51"); aIncludeMask = @"-*/*;*.h"; } bleFrameworks.Add(new Framework { Name = "Atmel Services " + dir, ID = "com.sysprogs.arm.atmel.service." + dir, ClassID = "com.sysprogs.arm.atmel.cl.services." + dir, ProjectFolderName = "Services_" + dir, DefaultEnabled = false, CopyJobs = new CopyJob[] { new CopyJob { SourceFolder = @"$$BSPGEN:INPUT_DIR$$\common\services\" + dir, TargetFolder = @"common\services\" + dir, FilesToCopy = "-*example*.c;-*example*.h;-*unit_test*.*;-*doxygen*;-*mega*;-*avr*;-*uc3*;*.c;*.h", AutoIncludeMask = aIncludeMask, ProjectInclusionMask = "*.c", SimpleFileConditions = a_SimpleFileConditions.ToArray(), } }, }); } return(bleFrameworks); }
public KinetisBuilder(BSPDirectories dirs, bool parsePeripheralRegisters) : base(dirs) { ShortName = "Kinetis"; LDSTemplate = XmlTools.LoadObject <LinkerScriptTemplate>(dirs.RulesDir + @"\Kinetis.ldsx"); _parsePeripheralRegisters = parsePeripheralRegisters; }
static List <Framework> GenereteAddFrameWorksDir(BSPDirectories pBspDir, string pstrTypSam) { List <Framework> bleFrameworks = new List <Framework>(); List <PropertyEntry> propFr = new List <PropertyEntry>(); PropertyList pl = new PropertyList(); List <string> a_SimpleFileConditions = new List <string>(); string a_macname = "com.sysprogs.arm.atmel.drivers." + pstrTypSam + "."; string strIdFr = "com.sysprogs.arm.atmel.drivers." + pstrTypSam; string strClFr = "com.sysprogs.arm.atmel.cl.drivers." + pstrTypSam; string nameFr = pstrTypSam.ToUpper() + "_Drivers"; string asrcJob = @"$$BSPGEN:INPUT_DIR$$\" + pstrTypSam + @"\drivers"; string astrTargetJob = pstrTypSam + @"\drivers"; string astrFileJob = "-*example*.c;-*example*.h;-*unit_test*.*;-*doxygen*;-*mega*;-*avr*;-*adc_enhanced_mode*;-*quick_start*;*.c;*.h"; string aInclJob = "";// " - sam[0-9g]?*;-uc*;*.h"; string aPrjInclMsk = "*.c;*.h"; List <string> strIncompFrIDs = new List <string>(); if (pstrTypSam.ToUpper() == "SAM") { strIncompFrIDs.Add("com.sysprogs.arm.atmel.drivers.sam0"); } else { aPrjInclMsk = "-*_sam*.h;*.c;*.h"; aInclJob = "$$SYS:BSP_ROOT$$/sam0/drivers/system/clock/$$com.sysprogs.atmel.sam0.driver.clock$$;" + "$$SYS:BSP_ROOT$$/sam0/drivers/system/clock/$$com.sysprogs.atmel.sam0.driver.clock$$/module_config;" + "$$SYS:BSP_ROOT$$/sam0/drivers/system/interrupt/$$com.sysprogs.atmel.sam0.driver.interrupt$$;" + "$$SYS:BSP_ROOT$$/sam0/drivers/system/interrupt/$$com.sysprogs.atmel.sam0.driver.interrupt$$/module_config;" + "$$SYS:BSP_ROOT$$/sam0/drivers/system/power/$$com.sysprogs.atmel.sam0.driver.power$$;" + "$$SYS:BSP_ROOT$$/sam0/drivers/system/reset/$$com.sysprogs.atmel.sam0.driver.reset$$" + ";$$SYS:BSP_ROOT$$/sam0/drivers/adc/$$com.sysprogs.atmel.sam0.driver.globaldir$$"; foreach (var dirdr in Directory.GetDirectories(Path.Combine(pBspDir.InputDir, pstrTypSam + @"\drivers"))) { foreach (var dirdr1 in Directory.GetDirectories(dirdr)) { if (dirdr1.Contains("_sam")) { string aName = dirdr.Substring(dirdr.LastIndexOf("\\") + 1); aInclJob += @";$$SYS:BSP_ROOT$$/sam0/drivers/" + aName + @"/" + aName + "$$com.sysprogs.atmel.sam0.driver.globaldir$$"; break; } } } strIncompFrIDs.Add("com.sysprogs.arm.atmel.drivers.sam"); } string[] strPropFrim = Directory.GetDirectories(Path.Combine(pBspDir.InputDir, pstrTypSam + @"\drivers")); string aAddSimpleCond = ""; foreach (var line in strPropFrim) { bool aflIsCond = false; string a_name = line.Substring(line.LastIndexOf("\\") + 1).ToLower(); if (a_name.Contains("gpio") && pstrTypSam.ToUpper() == "SAM") { aInclJob = ""; } if (Directory.GetFiles(line, "*.c", SearchOption.AllDirectories).Count() == 0) { continue; } string[] strDirToDir = Directory.GetDirectories(line, "*", SearchOption.AllDirectories); // string[] strDirToDir = Directory.GetFiles(line, "*", SearchOption.AllDirectories); // string aDrivCond = "^" + a_name + @"\\: $$" + a_macname + a_name + "$$ == 1"; string aDrivCond = " $$" + a_macname + a_name + "$$ == 1"; if (pstrTypSam.ToUpper() == "SAM0") { foreach (var dir in strDirToDir) { if (dir.Contains("_sam")) { if (dir.Contains("quick")) { continue; } string aPatchPref = dir.Substring(dir.LastIndexOf(a_name + "\\") + a_name.Length + 1).ToLower(); string prefs = "^sam("; if (dir.EndsWith("module_config")) { continue; } if (dir.Contains("unit_test")) { continue; } int ac = 0; int idx1 = dir.LastIndexOf("\\"); int idx2 = dir.LastIndexOf("_sam"); string aflPtch; if (idx2 < idx1) { aflPtch = dir.Remove(idx1); } else { aflPtch = dir; } foreach (var pref in aflPtch.Substring(dir.LastIndexOf("_sam") + 4).Split('_')) { if (pref == "") { continue; } /* int idx = pref.LastIndexOf("\\"); * string regdata; * if (idx > 0) * regdata = pref.Remove(idx); * else*/ // regdata = pref; if (pref[0] != '0' && pref[0] != 'd' && pref[0] != 'r' && pref[0] != 'l' && pref[0] != 'b' && pref[0] != 'c') { throw new Exception(" unknow prefix " + pref + " in " + dir); } if (ac > 0) { prefs += "|"; } if (pref == "0") { prefs = "sam(?!d20"; } else { prefs += pref;//.Replace(".c", ""); } ac++; } prefs += ")"; aPatchPref = aPatchPref.Replace(@"\", @"\\"); /* if(aPatchPref.EndsWith(".c"))//file * aAddSimpleCond = "^" + a_name + @"\\" + aPatchPref + @":$$com.sysprogs.atmel.sam32._header_prefix$$ =~ " + prefs; * else */aAddSimpleCond = "^" + a_name + @"\\" + aPatchPref + @"\\:$$com.sysprogs.atmel.sam32._header_prefix$$ =~ " + prefs; a_SimpleFileConditions.Add(aAddSimpleCond + "&& " + aDrivCond); aflIsCond = true; } /* * string[] strFileToDir = Directory.GetFiles(line, "*_sam_*.c", SearchOption.AllDirectories); * foreach(var fl in strFileToDir) * { * int ac = 0; * * * string aPatchPref = fl.Substring(fl.LastIndexOf(a_name + "\\") + a_name.Length + 1).ToLower(); * string prefs = "^sam("; * * foreach (var pref in fl.Substring(fl.LastIndexOf("_sam") + 4).Split('_')) * { * if (pref == "") * continue; * * if ( pref[0] != 'd' && pref[0] != 'r' && pref[0] != 'l' && pref[0] != 'b' && pref[0] != 'c') * throw new Exception(" unknow prefix " + pref + " in " + dir); * if (ac > 0) * prefs += "|"; * * if (pref == "0") * prefs = "sam(?!d20"; * else * prefs += pref.Replace(".c", ""); * * * * ac++; * } * prefs += ")"; * aPatchPref = aPatchPref.Replace(@"\", @"\\"); * * aAddSimpleCond = "^" + a_name + @"\\" + aPatchPref + @":$$com.sysprogs.atmel.sam32._header_prefix$$ =~ " + prefs; * * a_SimpleFileConditions.Add(aAddSimpleCond + "&& " + aDrivCond); * aflIsCond = true; * * } */ } if (aflIsCond) { foreach (var dir in strDirToDir) { if (!dir.Contains("_sam")) { if (dir.Contains("quick")) { continue; } if (dir.Contains("unit") || dir.Contains("docimg")) { continue; } if (Directory.GetFiles(dir, "*.c", SearchOption.TopDirectoryOnly).Count() == 0) { continue; } string aPatchPref = dir.Substring(dir.LastIndexOf(a_name + "\\") + a_name.Length + 1).ToLower(); aAddSimpleCond = "^" + a_name + @"\\" + aPatchPref + @"\\:" + aDrivCond; a_SimpleFileConditions.Add(aAddSimpleCond); } } string[] strFileToDir = Directory.GetFiles(line, "*.c"); foreach (var file in strFileToDir) { if (Path.GetFileNameWithoutExtension(file).Contains("_sam_")) { string prefs = "sam("; string aPatchPref = file.Substring(file.LastIndexOf(a_name + "\\") + a_name.Length + 1).ToLower(); foreach (var pref in Path.GetFileNameWithoutExtension(file).Substring(Path.GetFileNameWithoutExtension(file).LastIndexOf("_sam_") + 5).Split('_')) { // regdata = pref; if (pref[0] != '0' && pref[0] != 'd' && pref[0] != 'r' && pref[0] != 'l' && pref[0] != 'b' && pref[0] != 'c') { throw new Exception(" unknow prefix " + pref + " in "); } if (pref == "0") { prefs = "sam(?!d20"; } else { prefs += pref;//.Replace(".c", ""); } } prefs += ")"; aAddSimpleCond = "^" + a_name + @"\\" + aPatchPref + @":$$com.sysprogs.atmel.sam32._header_prefix$$ =~ " + prefs; a_SimpleFileConditions.Add(aAddSimpleCond + aDrivCond); if (prefs == "sam()") { a_SimpleFileConditions.Add(aAddSimpleCond); } } else { aAddSimpleCond = "^" + a_name + @"\\" + Path.GetFileName(file) + ":" + aDrivCond; a_SimpleFileConditions.Add(aAddSimpleCond); } } } } /* { * if (dir.Contains("quick")) * continue; * string aPatchPref = dir.Substring(dir.LastIndexOf("\\") + 1).ToLower(); * if (dir.Contains("_sam_d_r")) * { * aAddSimpleCond = "^" + a_name + @"\\" + aPatchPref + @"\\:$$com.sysprogs.atmel.typsam0$$ == sam_d_r"; * continue; * } * if (dir.Contains("_sam_b")) * { * aAddSimpleCond = "^" + a_name + @"\\" + aPatchPref + @"\\:$$com.sysprogs.atmel.typsam0$$ == sam_b"; * continue; * } * if (dir.Contains("_sam_l_c")) * { * aAddSimpleCond = "^" + a_name + @"\\" + aPatchPref + @"\\:$$com.sysprogs.atmel.typsam0$$ == sam_l_c"; * continue; * } * if (dir.Contains("_sam_")) * Console.WriteLine(" throw new Exception( unknow prefix in "+ dir); * * } */ propFr.Add(new PropertyEntry.Boolean { Name = a_name, UniqueID = a_macname + a_name, ValueForTrue = "1", ValueForFalse = "0", }); if (!aflIsCond) { a_SimpleFileConditions.Add("^" + a_name + @"\\:" + aDrivCond); } /* * a_SimpleFileConditions.Add(aDrivCond) ; * if(aAddSimpleCond!= "") * a_SimpleFileConditions.Add(aAddSimpleCond);*/ } List <PropertyGroup> pg = new List <PropertyGroup>(); pg.Add(new PropertyGroup { Name = nameFr, Properties = propFr }); pl.PropertyGroups = pg; aInclJob = aInclJob.Trim(';'); if (aInclJob == "") { aInclJob = null; } bleFrameworks.Add(new Framework { Name = nameFr + "Library", ID = strIdFr, ClassID = strClFr, ProjectFolderName = "Atmel_" + nameFr, DefaultEnabled = false, IncompatibleFrameworks = strIncompFrIDs.ToArray(), CopyJobs = new CopyJob[] { new CopyJob { PreprocessorMacros = "ADC_CALLBACK_MODE=true;USART_CALLBACK_MODE=true", SourceFolder = asrcJob, TargetFolder = astrTargetJob, FilesToCopy = astrFileJob, SimpleFileConditions = a_SimpleFileConditions.ToArray(), AutoIncludeMask = "-*_sam*.h;*.h", AdditionalIncludeDirs = aInclJob, ProjectInclusionMask = aPrjInclMsk } }, ConfigurableProperties = pl, }); return(bleFrameworks); }
public SLabBSPBuilder(BSPDirectories dirs) : base(dirs) { ShortName = "SiLab_EFM32"; }
public CC3220BSPBuilder(BSPDirectories dirs) : base(dirs, null, 5) { ShortName = "CC3220"; SkipHiddenFiles = true; }
public CC3220BSPBuilder(BSPDirectories dirs) : base(dirs, null, 5) { ShortName = "CC3220"; }
static void Main(string[] args) { if (args.Length < 1) { throw new Exception("Usage: cc3220.exe <cc3220 SW package directory>"); } string DirSDK = args[0]; using (var bspBuilder = new CC3220BSPBuilder(BSPDirectories.MakeDefault(args))) { bool noPeripheralRegisters = args.Contains("/noperiph"); bool noPack = args.Contains("/nopack"); MCUFamilyBuilder famBuilder = new MCUFamilyBuilder(bspBuilder, XmlTools.LoadObject <FamilyDefinition>(Path.Combine(bspBuilder.Directories.RulesDir, "families\\cc3220.xml"))); string deviceDefinitionFile = @"DeviceDefinitions/CC_3220.xml"; foreach (var name in new[] { "CC3220SF", "CC3220S", "CC3235SF", "CC3235S" }) { famBuilder.MCUs.Add(new MCUBuilder { Core = CortexCore.M4, FPU = FPUType.SP, FlashSize = name.EndsWith("SF") ? 1024 * 1024 : 0, RAMSize = 256 * 1024, Name = name, MCUDefinitionFile = deviceDefinitionFile, //LinkerScriptPath = $"$$SYS:BSP_ROOT$$/source/ti/boards/{name}_LAUNCHXL/{name}_LAUNCHXL_$$com.sysprogs.cc3220.rtos$$.lds", StartupFile = null }); } List <EmbeddedFramework> frameworks = new List <EmbeddedFramework>(); List <MCUFamilyBuilder.CopiedSample> exampleDirs = new List <MCUFamilyBuilder.CopiedSample>(); MCUFamilyBuilder commonPseudofamily = new MCUFamilyBuilder(bspBuilder, XmlTools.LoadObject <FamilyDefinition>(bspBuilder.Directories.RulesDir + @"\CommonFiles.xml")); var famObj = famBuilder.GenerateFamilyObject(MCUFamilyBuilder.CoreSpecificFlags.All & ~MCUFamilyBuilder.CoreSpecificFlags.PrimaryMemory); List <string> projectFiles = new List <string>(); commonPseudofamily.CopyFamilyFiles(ref famObj.CompilationFlags, projectFiles); famObj.AdditionalSourceFiles = famObj.AdditionalSourceFiles.Concat(projectFiles).ToArray(); foreach (var fw in commonPseudofamily.GenerateFrameworkDefinitions()) { frameworks.Add(fw); } foreach (var sample in commonPseudofamily.CopySamples()) { exampleDirs.Add(sample); } if (!noPeripheralRegisters) { famBuilder.AttachPeripheralRegisters(ParsePeripheralRegisters(famBuilder.Definition.PrimaryHeaderDir)); } List <MCU> mcuDefinitions = new List <MCU>(); foreach (var mcuDef in famBuilder.MCUs) { var mcu = mcuDef.GenerateDefinition(famBuilder, bspBuilder, !noPeripheralRegisters, true); mcuDefinitions.Add(mcu); } BoardSupportPackage bsp = new BoardSupportPackage { PackageID = "com.sysprogs.arm.ti.cc3220", PackageDescription = "TI CC3220 Devices", GNUTargetID = "arm-eabi", GeneratedMakFileName = "cc3220.mak", MCUFamilies = new[] { famObj }, SupportedMCUs = mcuDefinitions.ToArray(), Frameworks = frameworks.ToArray(), Examples = exampleDirs.Where(s => !s.IsTestProjectSample).Select(s => s.RelativePath).ToArray(), TestExamples = exampleDirs.Where(s => s.IsTestProjectSample).Select(s => s.RelativePath).ToArray(), FileConditions = bspBuilder.MatchedFileConditions.Values.ToArray(), ConditionalFlags = commonPseudofamily.Definition.ConditionalFlags, PackageVersion = "4.20.00" }; bspBuilder.Save(bsp, !noPack); //StandaloneBSPValidator.Program.Main(new[] { "..\\..\\cc3220.validatejob", "f:\\bsptest" }); } }
static List<Framework> GenereteAddFrameWorksDir(BSPDirectories pBspDir, string pstrTypSam) { List<Framework> bleFrameworks = new List<Framework>(); List<PropertyEntry> propFr = new List<PropertyEntry>(); PropertyList pl = new PropertyList(); List<string> a_SimpleFileConditions = new List<string>(); string a_macname = "com.sysprogs.arm.atmel.drivers."+ pstrTypSam+"."; string strIdFr = "com.sysprogs.arm.atmel.drivers." + pstrTypSam ; string strClFr = "com.sysprogs.arm.atmel.cl.drivers."+ pstrTypSam; string nameFr = pstrTypSam.ToUpper()+"_Drivers"; string asrcJob = @"$$BSPGEN:INPUT_DIR$$\"+ pstrTypSam+@"\drivers"; string astrTargetJob = pstrTypSam + @"\drivers"; string astrFileJob = "-*example*.c;-*example*.h;-*unit_test*.*;-*doxygen*;-*mega*;-*avr*;-*adc_enhanced_mode*;-*quick_start*;*.c;*.h"; string aInclJob = "";// " - sam[0-9g]?*;-uc*;*.h"; string aPrjInclMsk = "*.c;*.h"; List<string> strIncompFrIDs = new List<string>(); if (pstrTypSam.ToUpper() == "SAM") strIncompFrIDs.Add("com.sysprogs.arm.atmel.drivers.sam0"); else { aPrjInclMsk = "-*_sam*.h;*.c;*.h"; aInclJob = "$$SYS:BSP_ROOT$$/sam0/drivers/system/clock/$$com.sysprogs.atmel.sam0.driver.clock$$;" + "$$SYS:BSP_ROOT$$/sam0/drivers/system/clock/$$com.sysprogs.atmel.sam0.driver.clock$$/module_config;" + "$$SYS:BSP_ROOT$$/sam0/drivers/system/interrupt/$$com.sysprogs.atmel.sam0.driver.interrupt$$;" + "$$SYS:BSP_ROOT$$/sam0/drivers/system/interrupt/$$com.sysprogs.atmel.sam0.driver.interrupt$$/module_config;" + "$$SYS:BSP_ROOT$$/sam0/drivers/system/power/$$com.sysprogs.atmel.sam0.driver.power$$;" + "$$SYS:BSP_ROOT$$/sam0/drivers/system/reset/$$com.sysprogs.atmel.sam0.driver.reset$$"+ ";$$SYS:BSP_ROOT$$/sam0/drivers/adc/$$com.sysprogs.atmel.sam0.driver.globaldir$$"; foreach(var dirdr in Directory.GetDirectories(Path.Combine(pBspDir.InputDir, pstrTypSam + @"\drivers"))) foreach(var dirdr1 in Directory.GetDirectories(dirdr)) if(dirdr1.Contains("_sam")) { string aName = dirdr.Substring(dirdr.LastIndexOf("\\") + 1); aInclJob += @";$$SYS:BSP_ROOT$$/sam0/drivers/" + aName + @"/" + aName+"$$com.sysprogs.atmel.sam0.driver.globaldir$$"; break; } strIncompFrIDs.Add("com.sysprogs.arm.atmel.drivers.sam"); } string[] strPropFrim = Directory.GetDirectories(Path.Combine(pBspDir.InputDir, pstrTypSam + @"\drivers")); string aAddSimpleCond = ""; foreach (var line in strPropFrim) { bool aflIsCond = false; string a_name = line.Substring(line.LastIndexOf("\\") + 1).ToLower(); if(a_name.Contains("gpio") && pstrTypSam.ToUpper() == "SAM") aInclJob = ""; if (Directory.GetFiles(line, "*.c", SearchOption.AllDirectories).Count() == 0) continue; string[] strDirToDir = Directory.GetDirectories(line, "*", SearchOption.AllDirectories); // string[] strDirToDir = Directory.GetFiles(line, "*", SearchOption.AllDirectories); // string aDrivCond = "^" + a_name + @"\\: $$" + a_macname + a_name + "$$ == 1"; string aDrivCond =" $$" + a_macname + a_name + "$$ == 1"; if (pstrTypSam.ToUpper() == "SAM0") { foreach (var dir in strDirToDir) if (dir.Contains("_sam") ) { if (dir.Contains("quick")) continue; string aPatchPref = dir.Substring(dir.LastIndexOf(a_name+"\\") + a_name.Length + 1).ToLower(); string prefs = "^sam("; if (dir.EndsWith("module_config")) continue; if (dir.Contains("unit_test")) continue; int ac = 0; int idx1 = dir.LastIndexOf("\\"); int idx2 = dir.LastIndexOf("_sam"); string aflPtch; if (idx2 < idx1) aflPtch = dir.Remove(idx1); else aflPtch = dir; foreach (var pref in aflPtch.Substring(dir.LastIndexOf("_sam") + 4).Split('_')) { if (pref == "") continue; /* int idx = pref.LastIndexOf("\\"); string regdata; if (idx > 0) regdata = pref.Remove(idx); else*/ // regdata = pref; if (pref[0] != '0' && pref[0] != 'd' && pref[0] != 'r' && pref[0] != 'l' && pref[0] != 'b' && pref[0] != 'c') throw new Exception(" unknow prefix " + pref + " in " + dir); if(ac > 0) prefs += "|"; if (pref == "0") prefs = "sam(?!d20"; else prefs += pref;//.Replace(".c", ""); ac++; } prefs += ")"; aPatchPref = aPatchPref.Replace(@"\",@"\\"); /* if(aPatchPref.EndsWith(".c"))//file aAddSimpleCond = "^" + a_name + @"\\" + aPatchPref + @":$$com.sysprogs.atmel.sam32._header_prefix$$ =~ " + prefs; else */ aAddSimpleCond = "^" + a_name + @"\\" + aPatchPref + @"\\:$$com.sysprogs.atmel.sam32._header_prefix$$ =~ " + prefs; a_SimpleFileConditions.Add(aAddSimpleCond+ "&& "+ aDrivCond); aflIsCond = true; }/* string[] strFileToDir = Directory.GetFiles(line, "*_sam_*.c", SearchOption.AllDirectories); foreach(var fl in strFileToDir) { int ac = 0; string aPatchPref = fl.Substring(fl.LastIndexOf(a_name + "\\") + a_name.Length + 1).ToLower(); string prefs = "^sam("; foreach (var pref in fl.Substring(fl.LastIndexOf("_sam") + 4).Split('_')) { if (pref == "") continue; if ( pref[0] != 'd' && pref[0] != 'r' && pref[0] != 'l' && pref[0] != 'b' && pref[0] != 'c') throw new Exception(" unknow prefix " + pref + " in " + dir); if (ac > 0) prefs += "|"; if (pref == "0") prefs = "sam(?!d20"; else prefs += pref.Replace(".c", ""); ac++; } prefs += ")"; aPatchPref = aPatchPref.Replace(@"\", @"\\"); aAddSimpleCond = "^" + a_name + @"\\" + aPatchPref + @":$$com.sysprogs.atmel.sam32._header_prefix$$ =~ " + prefs; a_SimpleFileConditions.Add(aAddSimpleCond + "&& " + aDrivCond); aflIsCond = true; } */ if (aflIsCond) { foreach (var dir in strDirToDir) if (!dir.Contains("_sam")) { if (dir.Contains("quick")) continue; if (dir.Contains("unit") || dir.Contains("docimg")) continue; if (Directory.GetFiles(dir,"*.c", SearchOption.TopDirectoryOnly).Count() == 0) continue; string aPatchPref = dir.Substring(dir.LastIndexOf(a_name + "\\") + a_name.Length + 1).ToLower(); aAddSimpleCond = "^" + a_name + @"\\" + aPatchPref + @"\\:" + aDrivCond; a_SimpleFileConditions.Add(aAddSimpleCond); } string[] strFileToDir = Directory.GetFiles(line, "*.c"); foreach (var file in strFileToDir) { if (Path.GetFileNameWithoutExtension(file).Contains("_sam_")) { string prefs = "sam("; string aPatchPref = file.Substring(file.LastIndexOf(a_name + "\\") + a_name.Length + 1).ToLower(); foreach (var pref in Path.GetFileNameWithoutExtension(file).Substring(Path.GetFileNameWithoutExtension(file).LastIndexOf("_sam_") + 5).Split('_')) { // regdata = pref; if (pref[0] != '0' && pref[0] != 'd' && pref[0] != 'r' && pref[0] != 'l' && pref[0] != 'b' && pref[0] != 'c') throw new Exception(" unknow prefix " + pref + " in "); if (pref == "0") prefs = "sam(?!d20"; else prefs += pref;//.Replace(".c", ""); } prefs += ")"; aAddSimpleCond = "^" + a_name + @"\\" + aPatchPref + @":$$com.sysprogs.atmel.sam32._header_prefix$$ =~ " + prefs; a_SimpleFileConditions.Add(aAddSimpleCond + aDrivCond); if (prefs == "sam()") a_SimpleFileConditions.Add(aAddSimpleCond); } else { aAddSimpleCond = "^" + a_name + @"\\" + Path.GetFileName(file) + ":" + aDrivCond; a_SimpleFileConditions.Add(aAddSimpleCond); } } } } /* { if (dir.Contains("quick")) continue; string aPatchPref = dir.Substring(dir.LastIndexOf("\\") + 1).ToLower(); if (dir.Contains("_sam_d_r")) { aAddSimpleCond = "^" + a_name + @"\\" + aPatchPref + @"\\:$$com.sysprogs.atmel.typsam0$$ == sam_d_r"; continue; } if (dir.Contains("_sam_b")) { aAddSimpleCond = "^" + a_name + @"\\" + aPatchPref + @"\\:$$com.sysprogs.atmel.typsam0$$ == sam_b"; continue; } if (dir.Contains("_sam_l_c")) { aAddSimpleCond = "^" + a_name + @"\\" + aPatchPref + @"\\:$$com.sysprogs.atmel.typsam0$$ == sam_l_c"; continue; } if (dir.Contains("_sam_")) Console.WriteLine(" throw new Exception( unknow prefix in "+ dir); } */ propFr.Add(new PropertyEntry.Boolean { Name = a_name, UniqueID = a_macname+a_name, ValueForTrue = "1", ValueForFalse = "0", }); if(!aflIsCond) a_SimpleFileConditions.Add("^" + a_name + @"\\:" + aDrivCond); /* a_SimpleFileConditions.Add(aDrivCond) ; if(aAddSimpleCond!= "") a_SimpleFileConditions.Add(aAddSimpleCond);*/ } List<PropertyGroup> pg = new List<PropertyGroup>(); pg.Add( new PropertyGroup {Name = nameFr, Properties = propFr }); pl.PropertyGroups = pg; aInclJob = aInclJob.Trim(';'); if (aInclJob == "") aInclJob = null; bleFrameworks.Add(new Framework { Name = nameFr + "Library", ID = strIdFr, ClassID = strClFr, ProjectFolderName = "Atmel_" + nameFr, DefaultEnabled = false, IncompatibleFrameworks = strIncompFrIDs.ToArray(), CopyJobs = new CopyJob[] { new CopyJob { PreprocessorMacros = "ADC_CALLBACK_MODE=true;USART_CALLBACK_MODE=true", SourceFolder = asrcJob , TargetFolder = astrTargetJob , FilesToCopy = astrFileJob, SimpleFileConditions = a_SimpleFileConditions.ToArray(), AutoIncludeMask = "-*_sam*.h;*.h", AdditionalIncludeDirs = aInclJob, ProjectInclusionMask = aPrjInclMsk } }, ConfigurableProperties = pl, }); return bleFrameworks; }
static List<Framework> GenereteAddFrameWorks(BSPDirectories pBspDir, string pstrFile) { List<Framework> bleFrameworks = new List<Framework>(); List<PropertyEntry> propFr = new List<PropertyEntry>(); PropertyList pl = new PropertyList(); List<string> a_SimpleFileConditions = new List<string>(); foreach (var line in File.ReadAllLines(Path.Combine(pBspDir.RulesDir, pstrFile))) { string dir = line; string desc = ""; string id = dir; int idx = line.IndexOf('|'); if (idx > 0) { dir = line.Substring(0, idx); desc = line.Substring(idx + 1); id = Path.GetFileName(dir); } dir= dir.ToLower(); id = dir.Replace("\\", "_"); string a_name = line.Substring(line.LastIndexOf("\\") + 1).ToLower(); ; dir = a_name; string aIncludeMask = "-sam[0-9g]?*;-uc*;*.h"; a_SimpleFileConditions.Clear(); if (a_name.ToLower() == "sleepmgr") { a_SimpleFileConditions.Add(@"samd\\*: $$com.sysprogs.atmel.sam32._header_prefix_samser$$ == samd"); a_SimpleFileConditions.Add(@"samc\\*: $$com.sysprogs.atmel.sam32._header_prefix_samser$$ == samc"); a_SimpleFileConditions.Add(@"sam\\*: $$com.sysprogs.atmel.sam32._header_prefix_sam0$$ != yes"); aIncludeMask = @"-*/*;*.h"; } if (a_name.ToLower() == "serial") { a_SimpleFileConditions.Add(@"sam0_usart\\*: $$com.sysprogs.atmel.sam32._header_prefix_sam0$$ == yes"); a_SimpleFileConditions.Add(@"sam_uart\\*: $$com.sysprogs.atmel.sam32._header_prefix_sam0$$ != yes"); a_SimpleFileConditions.Add(@"samb_uart\\*: $$com.sysprogs.atmel.sam32._header_prefix_sam0$$ == samb"); aIncludeMask = @"-*/*;*.h"; } if (a_name.ToLower() == "adp"|| a_name.ToLower() == "ioport") { a_SimpleFileConditions.Add(@"sam0\\*: $$com.sysprogs.atmel.sam32._header_prefix_sam0$$ == yes"); a_SimpleFileConditions.Add(@"sam\\*: $$com.sysprogs.atmel.sam32._header_prefix_sam0$$ != yes"); aIncludeMask = @"-*/*;*.h"; } if (a_name.ToLower() == "clock") { a_SimpleFileConditions.Add(@"sam4l\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == sam4l"); a_SimpleFileConditions.Add(@"sam3n\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == sam3n"); a_SimpleFileConditions.Add(@"sam3s\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == sam3s"); a_SimpleFileConditions.Add(@"sam3u\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == sam3u"); a_SimpleFileConditions.Add(@"sam3x\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == sam3x"); a_SimpleFileConditions.Add(@"sam4c\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == sam4c"); a_SimpleFileConditions.Add(@"sam4cp\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == sam4cp"); a_SimpleFileConditions.Add(@"sam4cm\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == sam4cm"); a_SimpleFileConditions.Add(@"sam4e\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == sam4e"); a_SimpleFileConditions.Add(@"sam4n\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == sam4n"); a_SimpleFileConditions.Add(@"sam4s\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == sam4s"); a_SimpleFileConditions.Add(@"same70\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == same70"); a_SimpleFileConditions.Add(@"sams70\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == sams70"); a_SimpleFileConditions.Add(@"samv70\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == samv70"); a_SimpleFileConditions.Add(@"samv71\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == samv71"); a_SimpleFileConditions.Add(@"samg\\sysclk.c: $$com.sysprogs.atmel.sam32._header_prefix$$ == samg51"); aIncludeMask = @"-*/*;*.h"; } bleFrameworks.Add(new Framework { Name = "Atmel Services " + dir, ID = "com.sysprogs.arm.atmel.service." + dir, ClassID = "com.sysprogs.arm.atmel.cl.services." + dir, ProjectFolderName = "Services_" + dir, DefaultEnabled = false, CopyJobs = new CopyJob[] { new CopyJob { SourceFolder = @"$$BSPGEN:INPUT_DIR$$\common\services\"+dir, TargetFolder = @"common\services\"+dir, FilesToCopy = "-*example*.c;-*example*.h;-*unit_test*.*;-*doxygen*;-*mega*;-*avr*;-*uc3*;*.c;*.h", AutoIncludeMask =aIncludeMask, ProjectInclusionMask = "*.c", SimpleFileConditions = a_SimpleFileConditions.ToArray(), } }, }); } return bleFrameworks; }