Search in sources :

Example 1 with MemoryMapMemorySelectionError

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;
}
Also used : MemoryMapGraphConfiguration(net.praqma.jenkins.memorymap.graph.MemoryMapGraphConfiguration) MemoryMapMemorySelectionError(net.praqma.jenkins.memorymap.util.MemoryMapMemorySelectionError) MemoryMapConfigMemory(net.praqma.jenkins.memorymap.result.MemoryMapConfigMemory) HexifiableString(net.praqma.jenkins.memorymap.util.HexUtils.HexifiableString)

Example 2 with MemoryMapMemorySelectionError

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;
}
Also used : MemoryMapMemorySelectionError(net.praqma.jenkins.memorymap.util.MemoryMapMemorySelectionError) MemoryMapConfigMemoryItem(net.praqma.jenkins.memorymap.result.MemoryMapConfigMemoryItem) Matcher(java.util.regex.Matcher) AbstractMemoryMapParser(net.praqma.jenkins.memorymap.parser.AbstractMemoryMapParser)

Example 3 with MemoryMapMemorySelectionError

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;
}
Also used : MemoryMapGraphConfiguration(net.praqma.jenkins.memorymap.graph.MemoryMapGraphConfiguration) MemoryMapMemorySelectionError(net.praqma.jenkins.memorymap.util.MemoryMapMemorySelectionError) MemoryMapConfigMemoryItem(net.praqma.jenkins.memorymap.result.MemoryMapConfigMemoryItem) Matcher(java.util.regex.Matcher) MemoryMapConfigMemory(net.praqma.jenkins.memorymap.result.MemoryMapConfigMemory) AbstractMemoryMapParser(net.praqma.jenkins.memorymap.parser.AbstractMemoryMapParser)

Aggregations

MemoryMapMemorySelectionError (net.praqma.jenkins.memorymap.util.MemoryMapMemorySelectionError)3 Matcher (java.util.regex.Matcher)2 MemoryMapGraphConfiguration (net.praqma.jenkins.memorymap.graph.MemoryMapGraphConfiguration)2 AbstractMemoryMapParser (net.praqma.jenkins.memorymap.parser.AbstractMemoryMapParser)2 MemoryMapConfigMemory (net.praqma.jenkins.memorymap.result.MemoryMapConfigMemory)2 MemoryMapConfigMemoryItem (net.praqma.jenkins.memorymap.result.MemoryMapConfigMemoryItem)2 HexifiableString (net.praqma.jenkins.memorymap.util.HexUtils.HexifiableString)1