Beispiel #1
0
        public override MemoryLayoutCollection GenerateLinkerScripts(bool generalizeWherePossible)
        {
            foreach (var mcu in MCUs)
            {
                var stMCU = (DeviceListProviders.CubeProvider.STM32MCUBuilder)mcu;
                if (stMCU.PredefinedLinkerScripts.Length != 1)
                {
                    throw new Exception($"Unexpected predefined linker scripts for {mcu.Name}");
                }

                string relPath = $"{FamilyFilePrefix}LinkerScripts/{Path.GetFileName(stMCU.PredefinedLinkerScripts[0])}";
                mcu.LinkerScriptPath = "$$SYS:BSP_ROOT$$/" + relPath;
                string sourcePath = "$$STM32:MP1_DIR$$/Drivers/CMSIS/" + stMCU.PredefinedLinkerScripts[0];
                var    targetPath = Path.Combine(BSP.Directories.OutputDir, relPath);
                BSP.ExpandVariables(ref sourcePath);
                Directory.CreateDirectory(Path.GetDirectoryName(targetPath));
                File.Copy(sourcePath, targetPath, true);
            }

            return(null);
        }