use of net.praqma.jenkins.memorymap.util.MemoryMapMemorySelectionError in project memory-map-plugin by Praqma.
the class GccMemoryMapParser method parseConfigFile.
@Override
public MemoryMapConfigMemory parseConfigFile(File f) throws IOException {
// Collect sections from both the MEMORY and the SECTIONS areas from the command file.
// The memory are the top level components, sections belong to one of these sections
CharSequence stripped = stripComments(createCharSequenceFromFile(f));
MemoryMapConfigMemory memConfig = getMemory(stripped);
memConfig.addAll(getSections(stripped));
for (MemoryMapGraphConfiguration g : getGraphConfiguration()) {
for (String gItem : g.itemizeGraphDataList()) {
for (String gSplitItem : gItem.split("\\+")) {
// We will fail if the name of the data section does not match any of the named items in the map file.
if (!memConfig.containsSectionWithName(gSplitItem)) {
throw new MemoryMapMemorySelectionError(String.format("The memory section named %s not found in map file%nAvailable sections are:%n%s", gSplitItem, memConfig.getItemNames()));
}
}
}
}
return memConfig;
}
use of net.praqma.jenkins.memorymap.util.MemoryMapMemorySelectionError in project memory-map-plugin by Praqma.
the class TexasInstrumentsMemoryMapParser method parseMapFile.
@Override
public MemoryMapConfigMemory parseMapFile(File f, MemoryMapConfigMemory config) throws IOException {
CharSequence sequence = createCharSequenceFromFile(f);
for (MemoryMapConfigMemoryItem item : config) {
Matcher matcher = MemoryMapMapParserDelegate.getPatternForMemorySection(item.getName()).matcher(sequence);
boolean found = false;
while (matcher.find()) {
item.setUsed(matcher.group(8));
item.setUnused(matcher.group(10));
found = true;
}
if (!found) {
logger.logp(Level.WARNING, "parseMapFile", AbstractMemoryMapParser.class.getName(), String.format("parseMapFile(File f, MemoryMapConfigMemory configuration) non existing item: %s", item));
throw new MemoryMapMemorySelectionError(String.format("Linker command element %s not found in .map file", item));
}
}
return config;
}
use of net.praqma.jenkins.memorymap.util.MemoryMapMemorySelectionError in project memory-map-plugin by Praqma.
the class TexasInstrumentsMemoryMapParser method parseConfigFile.
@Override
public MemoryMapConfigMemory parseConfigFile(File f) throws IOException {
MemoryMapConfigMemory config = new MemoryMapConfigMemory();
CharSequence sequence = createCharSequenceFromFile(f);
for (MemoryMapGraphConfiguration graph : getGraphConfiguration()) {
String[] split = graph.getGraphDataList().split(",");
for (String s : split) {
String[] multiSections = s.trim().split("\\+");
for (String ms : multiSections) {
Matcher m = MemoryMapConfigFileParserDelegate.getPatternForMemoryLayout(ms.replace(" ", "")).matcher(sequence);
MemoryMapConfigMemoryItem item = null;
while (m.find()) {
item = new MemoryMapConfigMemoryItem(m.group(1), m.group(3), m.group(5));
config.add(item);
}
if (item == null) {
logger.logp(Level.WARNING, "parseConfigFile", AbstractMemoryMapParser.class.getName(), String.format("parseConfigFile(List<MemoryMapGraphConfiguration> graphConfig, File f) non existing item: %s", s));
throw new MemoryMapMemorySelectionError(String.format("No match found for program memory named %s", s));
}
}
}
}
return config;
}
Aggregations