public MCU GenerateDefinition(MCUFamilyBuilder fam, BSPBuilder bspBuilder, bool requirePeripheralRegisters) { if (string.IsNullOrEmpty(LinkerScriptPath)) { throw new Exception("Linker script not defined for " + Name); } if (string.IsNullOrEmpty(StartupFile)) { throw new Exception("Startup file not defined for " + Name); } if (string.IsNullOrEmpty(MCUDefinitionFile) && requirePeripheralRegisters) { throw new Exception("Peripheral register definition not found for " + Name); } var mcu = new MCU { ID = Name, FamilyID = fam.Definition.Name, FLASHSize = FlashSize, RAMSize = RAMSize, HierarchicalPath = string.Format(@"{0}\{1}", bspBuilder.ShortName, fam.Definition.Name), CompilationFlags = new ToolFlags { PreprocessorMacros = new string[] { bspBuilder.GetMCUTypeMacro(this) }, LinkerScript = LinkerScriptPath, }, AdditionalSourceFiles = new string[] { StartupFile }, MCUDefinitionFile = MCUDefinitionFile }; if (fam.Definition.HasMixedCores) { MCUFamilyBuilder.AddCoreSpecificFlags(true, mcu, Core); } List <SysVarEntry> sysVars = new List <SysVarEntry>(); foreach (var classifier in fam.Definition.Subfamilies) { string category = classifier.TryMatchMCUName(Name); if (category == null) { if (classifier.Required) { throw new Exception("Cannot detect subfamily for " + Name); } } sysVars.Add(new SysVarEntry { Key = classifier.VariableName, Value = category }); } if (sysVars.Count > 0) { mcu.AdditionalSystemVars = sysVars.ToArray(); } bspBuilder.GetMemoryBases(out mcu.FLASHBase, out mcu.RAMBase); return(mcu); }
public abstract MemoryLayout GetMemoryLayout(MCUBuilder mcu, MCUFamilyBuilder family);