Exemple #1
0
            public List <MCUBuilder> LoadDeviceList(Program.STM32BSPBuilder bspBuilder)
            {
                List <MCUBuilder> result    = new List <MCUBuilder>();
                XmlDocument       doc       = new XmlDocument();
                string            familyDir = Path.Combine(bspBuilder.STM32CubeDir, @"db\mcu");
                var db = new DeviceMemoryDatabase(bspBuilder.STM32CubeDir);

                doc.Load(Path.Combine(familyDir, @"families.xml"));
                var rawMCUs = doc.DocumentElement.SelectNodes("Family/SubFamily/Mcu").OfType <XmlElement>().Select(n => new ParsedMCU(n, familyDir, db)).ToArray();

                foreach (var grp in rawMCUs.GroupBy(m => m.RPN))
                {
                    //As of November 2017, some MCUs in sharing the same RPN (namely STM32F103RC) have different FLASH/RAM sizes.
                    //We need to detect this and create multiple MCU entries for them, e.g. STM32F103RCTx and STM32F103RCYx
                    var mcusByConfig = grp.GroupBy(m => m.Config).ToArray();
                    if (mcusByConfig.Length == 1)
                    {
                        result.Add(mcusByConfig.First().First().ToMCUBuilder(db));
                    }
                    else
                    {
                        foreach (var subGrp in mcusByConfig)
                        {
                            result.Add(subGrp.First().ToMCUBuilder(db, true));
                        }
                    }
                }

                return(result);
            }
Exemple #2
0
            public List <MCUBuilder> LoadDeviceList(Program.STM32BSPBuilder bspBuilder)
            {
                var devices    = BSPGeneratorTools.ReadMCUDevicesFromCommaDelimitedCSVFile(bspBuilder.Directories.RulesDir + @"\stm32devices.csv", "Part Number", "FLASH Size (Prog)", "Internal RAM Size", "Core", true);
                var devicesOld = BSPGeneratorTools.ReadMCUDevicesFromCommaDelimitedCSVFile(bspBuilder.Directories.RulesDir + @"\stm32devicesOld.csv", "Part Number", "FLASH Size (Prog)", "Internal RAM Size", "Core", true);

                foreach (var d in devicesOld)
                {
                    if (!devices.Contains(d))
                    {
                        devices.Add(d);
                    }
                }
                return(devices);
            }