static void Main(string[] args) { if (args.Length < 1) { throw new Exception("Usage: rs14100.exe <rs14100 SW package directory>"); } using (var bspBuilder = new RS14100BSPBuilder(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, "rs14100.xml"))); foreach (var name in new[] { "RS14100" }) { famBuilder.MCUs.Add(new MCUBuilder { Core = CortexCore.M4, FlashSize = 0x000EE000, RAMSize = 0x00030000, Name = name, LinkerScriptPath = $"$$SYS:BSP_ROOT$$/DeviceDefinition/arm-gcc-link.ld", StartupFile = "$$SYS:BSP_ROOT$$/DeviceDefinition/startup_RS1xxxx.c" }); } List <EmbeddedFramework> frameworks = new List <EmbeddedFramework>(); List <MCUFamilyBuilder.CopiedSample> exampleDirs = new List <MCUFamilyBuilder.CopiedSample>(); var famObj = famBuilder.GenerateFamilyObject(MCUFamilyBuilder.CoreSpecificFlags.All & ~MCUFamilyBuilder.CoreSpecificFlags.PrimaryMemory); List <string> projectFiles = new List <string>(); if (!noPeripheralRegisters) { var definition = SVDParser.ParseSVDFile(Path.Combine(bspBuilder.Directories.InputDir, "RS1xxxx.svd"), "RS14100"); definition.MatchPredicate = m => true; famBuilder.AttachPeripheralRegisters(new[] { definition }, "DeviceDefinition"); } foreach (var fw in famBuilder.GenerateFrameworkDefinitions()) { frameworks.Add(fw); } foreach (var sample in famBuilder.CopySamples()) { exampleDirs.Add(sample); } 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.rs14100", PackageDescription = "Redpine RS14100 Devices", GNUTargetID = "arm-eabi", GeneratedMakFileName = "rs14100.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(), PackageVersion = "1.1.3" }; bspBuilder.ValidateBSP(bsp); bspBuilder.Save(bsp, !noPack, false); //StandaloneBSPValidator.Program.RunJob( "..\\..\\rs14100.validatejob", "f:\\bsptest"); } }
//=========================================================== static void Main(string[] args) { if (args.Length < 1) { throw new Exception("Usage: InfineonXMC.exe <InfineonXMC SW package directory>"); } using (var bspBuilder = new InfineonXMCBSPBuilder(BSPDirectories.MakeDefault(args))) { var devices = BSPGeneratorTools.ReadMCUDevicesFromCommaDelimitedCSVFile(bspBuilder.Directories.RulesDir + @"\McuInfineonDevices.csv", "Product", "Program Memory(KB) ", "SRAM (KB) ", "CORE", true); devices = UpdateListMCU(devices); List <MCUFamilyBuilder> allFamilies = new List <MCUFamilyBuilder>(); foreach (var fn in Directory.GetFiles(bspBuilder.Directories.RulesDir + @"\Families", "*.xml")) { allFamilies.Add(new MCUFamilyBuilder(bspBuilder, XmlTools.LoadObject <FamilyDefinition>(fn))); } var rejects = BSPGeneratorTools.AssignMCUsToFamilies(devices, allFamilies); if (rejects.Count > 0) { throw new Exception($"Found {rejects.Count} MCUs not assigned to any family"); } List <MCUFamily> familyDefinitions = new List <MCUFamily>(); List <MCU> mcuDefinitions = new List <MCU>(); List <EmbeddedFramework> frameworks = new List <EmbeddedFramework>(); List <string> exampleDirs = new List <string>(); bool noPeripheralRegisters = args.Contains("/noperiph"); List <KeyValuePair <string, string> > macroToHeaderMap = new List <KeyValuePair <string, string> >(); var commonPseudofamily = new MCUFamilyBuilder(bspBuilder, XmlTools.LoadObject <FamilyDefinition>(bspBuilder.Directories.RulesDir + @"\CommonFiles.xml")); var flags = new ToolFlags(); List <string> projectFiles = new List <string>(); commonPseudofamily.CopyFamilyFiles(ref flags, projectFiles); foreach (var sample in commonPseudofamily.CopySamples()) { exampleDirs.Add(sample.RelativePath); } foreach (var fam in allFamilies) { var rejectedMCUs = fam.RemoveUnsupportedMCUs(); if (rejectedMCUs.Length != 0) { Console.WriteLine("Unsupported {0} MCUs:", fam.Definition.Name); foreach (var mcu in rejectedMCUs) { Console.WriteLine("\t{0}", mcu.Name); } } fam.AttachStartupFiles(ParseStartupFiles(fam.Definition.StartupFileDir)); if (!noPeripheralRegisters) { fam.AttachPeripheralRegisters(new MCUDefinitionWithPredicate[] { SVDParser.ParseSVDFile(Path.Combine(fam.Definition.PrimaryHeaderDir, @"CMSIS\Infineon\SVD\" + fam.Definition.Name + ".svd"), fam.Definition.Name) }); } var famObj = fam.GenerateFamilyObject(true); famObj.AdditionalSourceFiles = LoadedBSP.Combine(famObj.AdditionalSourceFiles, projectFiles.Where(f => !MCUFamilyBuilder.IsHeaderFile(f)).ToArray()); famObj.AdditionalHeaderFiles = LoadedBSP.Combine(famObj.AdditionalHeaderFiles, projectFiles.Where(f => MCUFamilyBuilder.IsHeaderFile(f)).ToArray()); famObj.AdditionalSystemVars = LoadedBSP.Combine(famObj.AdditionalSystemVars, commonPseudofamily.Definition.AdditionalSystemVars); famObj.CompilationFlags = famObj.CompilationFlags.Merge(flags); famObj.CompilationFlags.PreprocessorMacros = LoadedBSP.Combine(famObj.CompilationFlags.PreprocessorMacros, new string[] { "$$com.sysprogs.bspoptions.primary_memory$$_layout" }); familyDefinitions.Add(famObj); fam.GenerateLinkerScripts(false); foreach (var mcu in fam.MCUs) { mcuDefinitions.Add(mcu.GenerateDefinition(fam, bspBuilder, !noPeripheralRegisters)); } foreach (var fw in fam.GenerateFrameworkDefinitions()) { frameworks.Add(fw); } foreach (var sample in fam.CopySamples()) { exampleDirs.Add(sample.RelativePath); } } BoardSupportPackage bsp = new BoardSupportPackage { PackageID = "com.sysprogs.arm.infineon.xmc", PackageDescription = "Infineon XMC Devices", GNUTargetID = "arm-eabi", GeneratedMakFileName = "infineon_xmc.mak", MCUFamilies = familyDefinitions.ToArray(), SupportedMCUs = mcuDefinitions.ToArray(), Frameworks = frameworks.ToArray(), Examples = exampleDirs.ToArray(), FileConditions = bspBuilder.MatchedFileConditions.Values.ToArray(), PackageVersion = "2.1.24R2" }; bspBuilder.Save(bsp, true); } }
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" }); } }