public void GetMemoryMcu(MCUFamilyBuilder pfam)
{
if (pfam.FamilyFilePrefix.StartsWith("STM32W1"))
{
string kvStr = "STM32W108HB";
MemoryLayout layoutW1 = new MemoryLayout { DeviceName = "STM32W108xx", Memories = new List<Memory>() };
layoutW1.Memories.Add(new Memory
{
Name = "FLASH",
Access = MemoryAccess.Undefined,// Readable | MemoryAccess.Writable | MemoryAccess.Executable
Type = MemoryType.FLASH,
Start = 0x08000000,
Size = 128 * 1024
});
layoutW1.Memories.Add(new Memory
{
Name = "SRAM",
Access = MemoryAccess.Undefined,// MemoryAccess.Writable,
Type = MemoryType.RAM,
Start = 0x20000000,
Size = 8 * 1024
});
_SpecialMemoryLayouts.Add(new KeyValuePair<Regex, MemoryLayout>(new Regex(kvStr.Replace('x', '.') + ".*"), layoutW1));
}
else {
string aDirIcf = pfam.Definition.StartupFileDir;
if (!aDirIcf.EndsWith("gcc"))
throw new Exception("No Gcc sturtup Tamplate");
aDirIcf = aDirIcf.Replace("\\gcc", "\\iar\\linker");
if (!Directory.Exists(aDirIcf))
throw new Exception("No dir " + aDirIcf);
foreach (var fnIcf in Directory.GetFiles(aDirIcf, "stm32*_flash.icf"))
{
string kvStr = Path.GetFileName(fnIcf).Replace("_flash.icf", "");
_SpecialMemoryLayouts.Add(new KeyValuePair<Regex, MemoryLayout>(new Regex(kvStr.Replace('x', '.') + ".*", RegexOptions.IgnoreCase), GetLayoutFromICF(fnIcf, kvStr)));
}
}
}