Esempio n. 1
0
                public STM32MCUBuilder(ParsedMCU parsedMCU, DeviceMemoryDatabase db)
                {
                    MCU      = parsedMCU;
                    Memories = db.LookupMemories(parsedMCU.RPN, parsedMCU.RefName, out PredefinedLinkerScripts);
                    if (Memories.Length < 1)
                    {
                        if (parsedMCU.strCore != "")
                        {
                            Memories = db.LookupMemoriesTwoCore(parsedMCU.RPN, parsedMCU.strCore, parsedMCU.RefName);
                        }
                        if (Memories.Length < 1)
                        {
                            throw new Exception("Could not locate memories for " + parsedMCU.Name);
                        }
                    }

                    for (int i = 0; i < Memories.Length; i++)
                    {
                        Memories[i].SortWeight = 100 + i;
                        if (Memories[i].Name == "FLASH")
                        {
                            Memories[i].SortWeight = 0;
                        }
                        else if (Memories[i].Name == "RAM")
                        {
                            Memories[i].SortWeight = 1;
                        }
                    }

                    Memories = Memories.OrderBy(m => m.SortWeight).ToArray();
                }
Esempio n. 2
0
                public ParsedMCU(XmlElement n, string familyDir, DeviceMemoryDatabase db, string[] cores, int coreIndex)
                {
                    Name    = n.GetAttribute("Name");
                    RefName = n.GetAttribute("RefName");
                    RPN     = n.GetAttribute("RPN");

                    const string prefix = "Arm Cortex-";

                    if (!cores[coreIndex].StartsWith(prefix, StringComparison.InvariantCultureIgnoreCase))
                    {
                        throw new Exception("Unknown core: " + cores[coreIndex]);
                    }

                    string shortCore = cores[coreIndex].Substring(prefix.Length);

                    Core = ParseCore(shortCore);

                    if (cores.Length > 1)
                    {
                        CoreSuffix = shortCore.Replace('+', 'p');

                        if (coreIndex > 0)
                        {
                            //Secondary core uses a special name.
                            Name += "_" + CoreSuffix;
                            RPN  += "_" + CoreSuffix;
                        }
                    }
                    else
                    {
                        CoreSuffix = null;
                    }

                    Memories = db.LookupMemories(RPN, RefName, CoreSuffix, out LinkerScripts, out Define, out string fpu);
                    FPU      = ParseFPU(fpu);

                    if (cores.Length > 1 && coreIndex > 0 && Core == CortexCore.M4)
                    {
                        FPU = FPUType.SP;
                    }

                    //RAMs = mcuDef.SelectNodes("mcu:Ram", nsmgr2).OfType<XmlElement>().Select(n2 => int.Parse(n2.InnerText)).ToArray();
                    RAMs = n.SelectNodes("Ram").OfType <XmlElement>().Select(n2 => int.Parse(n2.InnerText)).ToArray();
                    if (RAMs.Length < 1)
                    {
                        throw new Exception("No RAMs defined for " + Name);
                    }

                    var flash = n.SelectNodes("Flash").OfType <XmlElement>().Select(n2 => int.Parse(n2.InnerText)).ToArray();

                    if (flash.Length != 1)
                    {
                        throw new Exception("Multiple or missing FLASH definitions of " + Name);
                    }
                    FLASH = flash[0];
                }
Esempio n. 3
0
                public ParsedMCU(XmlElement n, string familyDir, DeviceMemoryDatabase db)
                {
                    Name    = n.GetAttribute("Name");
                    RefName = n.GetAttribute("RefName");
                    RPN     = n.GetAttribute("RPN");

                    //var mcuDef = LoadMCUDefinition(familyDir, Name);
                    //var nsmgr2 = new XmlNamespaceManager(mcuDef.OwnerDocument.NameTable);
                    //nsmgr2.AddNamespace("mcu", "http://mcd.rou.st.com/modules.php?name=mcu");

                    var core = n.SelectSingleNode("Core").InnerText;

                    switch (core)
                    {
                    case "ARM Cortex-M0":
                        Core = CortexCore.M0;
                        break;

                    case "ARM Cortex-M0+":
                        Core = CortexCore.M0Plus;
                        break;

                    case "ARM Cortex-M3":
                        Core = CortexCore.M3;
                        break;

                    case "ARM Cortex-M4":
                        Core = CortexCore.M4;
                        break;

                    case "ARM Cortex-M7":
                        Core = CortexCore.M7;
                        break;

                    default:
                        throw new Exception("Don't know how to map core: " + core);
                    }

                    Memories = db.LookupMemories(RPN, RefName);

                    //RAMs = mcuDef.SelectNodes("mcu:Ram", nsmgr2).OfType<XmlElement>().Select(n2 => int.Parse(n2.InnerText)).ToArray();
                    RAMs = n.SelectNodes("Ram").OfType <XmlElement>().Select(n2 => int.Parse(n2.InnerText)).ToArray();
                    if (RAMs.Length < 1)
                    {
                        throw new Exception("No RAMs defined for " + Name);
                    }

                    var flash = n.SelectNodes("Flash").OfType <XmlElement>().Select(n2 => int.Parse(n2.InnerText)).ToArray();

                    if (flash.Length != 1)
                    {
                        throw new Exception("Multiple or missing FLASH definitions of " + Name);
                    }
                    FLASH = flash[0];
                }
Esempio n. 4
0
                public STM32MCUBuilder(ParsedMCU parsedMCU, DeviceMemoryDatabase db, string specializedName)
                {
                    MCU      = parsedMCU;
                    Memories = db.LookupMemories(specializedName ?? parsedMCU.RPN);
                    if (Memories.Length < 1)
                    {
                        throw new Exception("Could not locate memories for " + parsedMCU.Name);
                    }

                    for (int i = 0; i < Memories.Length; i++)
                    {
                        Memories[i].SortWeight = 100 + i;
                        if (Memories[i].Name == "FLASH")
                        {
                            Memories[i].SortWeight = 0;
                        }
                        else if (Memories[i].Name == "RAM")
                        {
                            Memories[i].SortWeight = 1;
                        }
                    }

                    Memories = Memories.OrderBy(m => m.SortWeight).ToArray();
                }