protected override void ValidateFinalMCUName(string mcu) { base.ValidateFinalMCUName(mcu); if (!_SupportedMCUNames.Contains(mcu)) { _Report.ReportMergeableError("Invalid MCU", mcu); } }
public MemoryLayoutAndSubstitutionRules ToMemoryLayout(BSPReportWriter report) { var layout = new MemoryLayout { DeviceName = Name, Memories = Memories.Select(m => m.ToMemoryDefinition()).ToList() }; const string FLASHMemoryName = "FLASH"; const string FLASHMemoryName2 = "FLASH1"; Memory ram; Dictionary <string, string> memorySubstitutionRulesForRAMMode = null; if (MCU.Name.StartsWith("STM32H7") && MCU.Name.EndsWith("M4")) { ram = layout.TryLocateAndMarkPrimaryMemory(MemoryType.RAM, MemoryLocationRule.ByAddress(0x30000000), MemoryLocationRule.ByName("RAM_D2")); } else if (MCU.Name.StartsWith("STM32MP1")) { ram = layout.TryLocateAndMarkPrimaryMemory(MemoryType.RAM, MemoryLocationRule.ByName("RAM1")); } else { ram = layout.TryLocateAndMarkPrimaryMemory(MemoryType.RAM, MemoryLocationRule.ByAddress(0x20000000)); } if (MCU.Name.StartsWith("STM32H7") && !MCU.Name.EndsWith("M4")) { //STM32H7 system file expects the ISR to be located at address 0x24000000 (D1_AXISRAM_BASE) and not at 0x20000000. var mainMemoryForRAMMode = layout.TryLocateMemory(MemoryType.RAM, MemoryLocationRule.ByAddress(0x24000000), MemoryLocationRule.ByName("RAM_D2")) ?? throw new Exception("Failed to locate main memory for RAM mode"); memorySubstitutionRulesForRAMMode = new Dictionary <string, string> { { FLASHMemoryName, mainMemoryForRAMMode.Name }, { FLASHMemoryName2, mainMemoryForRAMMode.Name }, { ram.Name, mainMemoryForRAMMode.Name }, }; } if (ram == null) { report.ReportMergeableError("Could not locate primary RAM for the MCU(s)", MCU.Name, true); } if (layout.TryLocateAndMarkPrimaryMemory(MemoryType.FLASH, MemoryLocationRule.ByName(FLASHMemoryName, FLASHMemoryName2)) == null) { throw new Exception("No FLASH found"); } return(new MemoryLayoutAndSubstitutionRules(layout, memorySubstitutionRulesForRAMMode)); }