Beispiel #1
0
        static void Main(string[] args)
        {
            if (args.Length < 2)
            {
                throw new Exception("Usage: stm32.exe <SW package directory> <temporary directory>");
            }
            string       SDKdir    = args[0];
            string       outputDir = @"..\..\Output";
            const string bspDir    = @"..\..\..\..\generators\stm32\output";
            string       tempDir   = args[1];

            string sampleListFile = Path.Combine(outputDir, "samples.xml");

            var sampleDir = BuildOrLoadSampleDirectory(SDKdir, outputDir, sampleListFile);

            if (sampleDir.Samples.FirstOrDefault(s => s.AllDependencies != null) == null)
            {
                //Perform Pass 1 testing - test the raw VendorSamples in-place
                StandaloneBSPValidator.Program.TestVendorSamples(sampleDir, bspDir, tempDir);
                XmlTools.SaveObject(sampleDir, sampleListFile);
            }

            //Insert the samples into the generated BSP
            var relocator = new STM32SampleRelocator();

            relocator.InsertVendorSamplesIntoBSP(sampleDir, bspDir, new STM32PathMapper(sampleDir));

            var bsp = XmlTools.LoadObject <BoardSupportPackage>(Path.Combine(bspDir, "bsp.xml"));

            bsp.VendorSampleDirectoryPath = "VendorSamples";
            bsp.VendorSampleCatalogName   = "STM32 CubeMX Samples";
            XmlTools.SaveObject(bsp, Path.Combine(bspDir, "bsp.xml"));

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

            TarPacker.PackDirectoryToTGZ(bspDir, Path.Combine(bspDir, archiveName), fn => Path.GetExtension(fn).ToLower() != ".vgdbxbsp" && Path.GetFileName(fn) != statFile);

            // Finally verify that everything builds
            var expandedSamples = XmlTools.LoadObject <VendorSampleDirectory>(Path.Combine(bspDir, "VendorSamples", "VendorSamples.xml"));

            expandedSamples.Path = Path.GetFullPath(Path.Combine(bspDir, "VendorSamples"));
            StandaloneBSPValidator.Program.TestVendorSamples(expandedSamples, bspDir, tempDir, 1);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            if (args.Length < 2)
                throw new Exception("Usage: stm32.exe <SW package directory> <temporary directory>");
            string SDKdir = args[0];
            string outputDir = @"..\..\Output";
            const string bspDir = @"..\..\..\..\generators\stm32\output";
            string tempDir = args[1];

            string sampleListFile = Path.Combine(outputDir, "samples.xml");

            var sampleDir = BuildOrLoadSampleDirectory(SDKdir, outputDir, sampleListFile);

            if (sampleDir.Samples.FirstOrDefault(s => s.AllDependencies != null) == null)
            {
                //Perform Pass 1 testing - test the raw VendorSamples in-place
                StandaloneBSPValidator.Program.TestVendorSamples(sampleDir, bspDir, tempDir);
                XmlTools.SaveObject(sampleDir, sampleListFile);
            }

            //Insert the samples into the generated BSP
            var relocator = new STM32SampleRelocator();
            relocator.InsertVendorSamplesIntoBSP(sampleDir, bspDir);

            var bsp = XmlTools.LoadObject<BoardSupportPackage>(Path.Combine(bspDir, "bsp.xml"));
            bsp.VendorSampleDirectoryPath = "VendorSamples";
            bsp.VendorSampleCatalogName = "STM32 CubeMX Samples";
            XmlTools.SaveObject(bsp, Path.Combine(bspDir, "bsp.xml"));

            string archiveName = string.Format("{0}-{1}.vgdbxbsp", bsp.PackageID.Split('.').Last(), bsp.PackageVersion);
            string statFile = Path.ChangeExtension(archiveName, ".xml");
            TarPacker.PackDirectoryToTGZ(bspDir, Path.Combine(bspDir, archiveName), fn => Path.GetExtension(fn).ToLower() != ".vgdbxbsp" && Path.GetFileName(fn) != statFile);

            // Finally verify that everything builds
            var expandedSamples = XmlTools.LoadObject<VendorSampleDirectory>(Path.Combine(bspDir, "VendorSamples", "VendorSamples.xml"));
            expandedSamples.Path = Path.GetFullPath(Path.Combine(bspDir, "VendorSamples"));
            StandaloneBSPValidator.Program.TestVendorSamples(expandedSamples, bspDir, tempDir, 0.1);
        }