Пример #1
0
        public LdsFileGenerator(LinkerScriptTemplate scriptTemplate, MemoryLayout memoryTemplate)
        {
            _ScriptTemplate = scriptTemplate;
            _MemoryTemplate = memoryTemplate;

            if (memoryTemplate.Memories == null)
            {
                throw new Exception("Memory list cannot be empty");
            }
            foreach (var mem in memoryTemplate.Memories)
            {
                _Memories[mem.Name] = mem;
                if (mem.Type == MemoryType.FLASH)
                {
                    if (_MainFLASH == null)
                    {
                        _MainFLASH = mem;
                    }
                    if (mem.Access == MemoryAccess.Undefined)
                    {
                        mem.Access = MemoryAccess.Readable | MemoryAccess.Executable;
                    }
                }
                if (mem.Type == MemoryType.RAM)
                {
                    if (_MainRAM == null)
                    {
                        _MainRAM = mem;
                    }
                    if (mem.Access == MemoryAccess.Undefined)
                    {
                        mem.Access = MemoryAccess.Readable | MemoryAccess.Writable | MemoryAccess.Executable;
                    }
                }

                // Main flash can be 0!
                if (mem.Size == 0 && ((_MainFLASH == null) || (mem.MemoryDefinitionString != _MainFLASH.MemoryDefinitionString)))
                {
                    throw new Exception("Memory size cannot be 0");
                }
            }

            if (_MainRAM == null)
            {
                throw new Exception("Cannot find the primary RAM memory. At least one memory with Type = RAM should be defined.");
            }
            if (_MainFLASH == null)
            {
                _MainFLASH = _MainRAM;
                //throw new Exception("Cannot find the primary FLASH memory. At least one memory with Type = FLASH should be defined.");
            }
        }
Пример #2
0
        public LdsFileGenerator(LinkerScriptTemplate scriptTemplate, MemoryLayout memoryTemplate)
        {
            _ScriptTemplate = scriptTemplate;
            _MemoryTemplate = memoryTemplate;

            if (memoryTemplate.Memories == null)
                throw new Exception("Memory list cannot be empty");
            foreach (var mem in memoryTemplate.Memories)
            {
                _Memories[mem.Name] = mem;
                if (mem.Type == MemoryType.FLASH)
                {
                    if (_MainFLASH == null)
                        _MainFLASH = mem;
                    if (mem.Access == MemoryAccess.Undefined)
                        mem.Access = MemoryAccess.Readable | MemoryAccess.Executable;
                }
                if (mem.Type == MemoryType.RAM)
                {
                    if (_MainRAM == null)
                        _MainRAM = mem;
                    if (mem.Access == MemoryAccess.Undefined)
                        mem.Access = MemoryAccess.Readable | MemoryAccess.Writable | MemoryAccess.Executable;
                }

                // Main flash can be 0!
                if (mem.Size == 0 && ((_MainFLASH == null) || (mem.MemoryDefinitionString != _MainFLASH.MemoryDefinitionString)))
                    throw new Exception("Memory size cannot be 0");
            }

            if (_MainRAM == null)
                throw new Exception("Cannot find the primary RAM memory. At least one memory with Type = RAM should be defined.");
            if (_MainFLASH == null)
            {
                _MainFLASH = _MainRAM;
                //throw new Exception("Cannot find the primary FLASH memory. At least one memory with Type = FLASH should be defined.");
            }
        }
Пример #3
0
            public InfineonXMCBSPBuilder(BSPDirectories dirs)
                : base(dirs)
            {
                ShortName = "Infineon_XMC";

                LDSTemplateX1 = XmlTools.LoadObject<LinkerScriptTemplate>(@"..\..\..\..\GenericARM.ldsx");
                var dataSection = LDSTemplateX1.Sections.IndexOf(LDSTemplateX1.Sections.First(s => s.Name == ".data"));
                LDSTemplateX1.Sections.First(s => s.Name == ".isr_vector").Flags |= SectionFlags.DefineShortLabels | SectionFlags.ProvideLongLabels;

                LDSTemplateX1.Sections.Insert(dataSection, new Section
                {
                    Name = ".isr_veneers",
                    TargetMemory = "SRAM",
                    Alignment = 4,
                    CustomContents = new string[] { ". = . + SIZEOF(.isr_vector) * 2;" },
                    Flags = SectionFlags.DefineShortLabels | SectionFlags.ProvideLongLabels,
                });

                LDSTemplate = LDSTemplateX1;
            }