Exemplo n.º 1
0
        public void ProduceBSPArchive(BoardSupportPackage bsp)
        {
            //bsp.PackageVersion = string.Format("{0:d4}{1:d2}{2:d2}", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
            //bsp.PackageVersion += "-beta";
            XmlTools.SaveObject(bsp, Path.Combine(mbedRoot, "BSP.XML"));

            string archiveName = string.Format("{0}-{1}.vgdbxbsp", bsp.PackageID.Split('.').Last(), bsp.PackageVersion);

            Console.WriteLine("Creating BSP archive...");

            TarPacker.PackDirectoryToTGZ(mbedRoot, Path.Combine(Path.GetDirectoryName(mbedRoot), archiveName), fn =>
            {
                string relPath = fn.Substring(mbedRoot.Length + 1);
                if (relPath.StartsWith(".git"))
                {
                    return(false);
                }
                if (relPath.ToLower() == "ParsedTargets.xml".ToLower())
                {
                    return(false);
                }
                return(true);
            }, subdir => !subdir.StartsWith(".git", StringComparison.CurrentCultureIgnoreCase));

            var lst = new BSPGenerationTools.BSPSummary
            {
                BSPName              = bsp.PackageDescription,
                BSPID                = bsp.PackageID,
                BSPVersion           = bsp.PackageVersion,
                MinimumEngineVersion = bsp.MinimumEngineVersion,
                FileName             = archiveName,
            };

            foreach (var mcu in bsp.SupportedMCUs)
            {
                lst.MCUs.Add(new BSPGenerationTools.BSPSummary.MCU {
                    Name = mcu.ID, FLASHSize = mcu.FLASHSize, RAMSize = mcu.RAMSize
                });
            }

            XmlTools.SaveObject(lst, Path.Combine(Path.GetDirectoryName(mbedRoot), Path.ChangeExtension(archiveName, ".xml")));
        }
Exemplo n.º 2
0
        public void Save(BoardSupportPackage bsp, bool produceBSPArchive, bool addFixedStackHeapFramework = true)
        {
            if (addFixedStackHeapFramework)
            {
                string dir = Path.Combine(Directories.OutputDir, "StackAndHeap");
                Directory.CreateDirectory(dir);
                File.Copy(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "StackAndHeap.c"), Path.Combine(dir, "StackAndHeap.c"));
                var framework = XmlTools.LoadObject <EmbeddedFramework>(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "StackAndHeap.xml"));
                bsp.Frameworks = LoadedBSP.Combine(bsp.Frameworks, new[] { framework });
            }

            XmlTools.SaveObject(bsp, Path.Combine(BSPRoot, "BSP.XML"));

            string archiveName = string.Format("{0}-{1}.vgdbxbsp", bsp.PackageID.Split('.').Last(), bsp.PackageVersion);

            if (produceBSPArchive)
            {
                TarPacker.PackDirectoryToTGZ(BSPRoot, Path.Combine(BSPRoot, archiveName), fn => Path.GetExtension(fn).ToLower() != ".vgdbxbsp");
            }

            BSPSummary lst = new BSPSummary
            {
                BSPName              = bsp.PackageDescription,
                BSPID                = bsp.PackageID,
                BSPVersion           = bsp.PackageVersion,
                MinimumEngineVersion = bsp.MinimumEngineVersion,
                FileName             = archiveName,
            };

            foreach (var mcu in bsp.SupportedMCUs)
            {
                lst.MCUs.Add(new BSPSummary.MCU {
                    Name = mcu.ID, FLASHSize = mcu.FLASHSize, RAMSize = mcu.RAMSize, UserFriendlyName = mcu.UserFriendlyName
                });
            }

            XmlTools.SaveObject(lst, Path.Combine(BSPRoot, Path.ChangeExtension(archiveName, ".xml")));
        }