Search in sources :

Example 1 with MemoryMapGraphConfiguration

use of net.praqma.jenkins.memorymap.graph.MemoryMapGraphConfiguration 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 MemoryMapGraphConfiguration

use of net.praqma.jenkins.memorymap.graph.MemoryMapGraphConfiguration 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)

Example 3 with MemoryMapGraphConfiguration

use of net.praqma.jenkins.memorymap.graph.MemoryMapGraphConfiguration in project memory-map-plugin by Praqma.

the class GccMemoryMapParserIT method gcc432_testUsageValues.

@Test
public void gcc432_testUsageValues() throws Exception {
    MemoryMapGraphConfiguration graphConfiguration = new MemoryMapGraphConfiguration(".text+.rodata", "432");
    GccMemoryMapParser parser = createParser(graphConfiguration);
    parser.setMapFile("prom2_432.map");
    parser.setConfigurationFile("prom432.ld");
    HashMap<String, String> expectedValues = new HashMap<>();
    expectedValues.put(".text", "0x10a008");
    expectedValues.put(".rodata", "0x33fd7");
    TestUtils.testUsageValues(jenkins, parser, "gcc432.zip", expectedValues);
}
Also used : MemoryMapGraphConfiguration(net.praqma.jenkins.memorymap.graph.MemoryMapGraphConfiguration) HashMap(java.util.HashMap) GccMemoryMapParser(net.praqma.jenkins.memorymap.parser.gcc.GccMemoryMapParser) Test(org.junit.Test)

Example 4 with MemoryMapGraphConfiguration

use of net.praqma.jenkins.memorymap.graph.MemoryMapGraphConfiguration in project memory-map-plugin by Praqma.

the class GccMemoryMapParserIT method gcc482_testUsageValues.

@Test
public void gcc482_testUsageValues() throws Exception {
    MemoryMapGraphConfiguration graphConfiguration = new MemoryMapGraphConfiguration(".prom_text+.ram_data", "482");
    GccMemoryMapParser parser = createParser(graphConfiguration);
    parser.setMapFile("gcc482.map");
    parser.setConfigurationFile("prom482.ld");
    HashMap<String, String> expectedValues = new HashMap<>();
    expectedValues.put(".prom_text", "0x10cb70");
    expectedValues.put(".ram_data", "0x20c4");
    TestUtils.testUsageValues(jenkins, parser, "gcc482.zip", expectedValues);
}
Also used : MemoryMapGraphConfiguration(net.praqma.jenkins.memorymap.graph.MemoryMapGraphConfiguration) HashMap(java.util.HashMap) GccMemoryMapParser(net.praqma.jenkins.memorymap.parser.gcc.GccMemoryMapParser) Test(org.junit.Test)

Example 5 with MemoryMapGraphConfiguration

use of net.praqma.jenkins.memorymap.graph.MemoryMapGraphConfiguration in project memory-map-plugin by Praqma.

the class TexasInstrumentsMemoryMapParserIT method testUsageValues.

@Test
public void testUsageValues() throws Exception {
    MemoryMapGraphConfiguration graphConfiguration = new MemoryMapGraphConfiguration("RAMM0+RAML0_L3", "432");
    TexasInstrumentsMemoryMapParser parser = createParser(graphConfiguration);
    parser.setMapFile("TexasInstrumentsMapFile.txt");
    parser.setConfigurationFile("28069_RAM_lnk.cmd");
    HashMap<String, String> expectedValues = new HashMap<>();
    expectedValues.put("RAMM0", "00000195");
    expectedValues.put("RAML0_L3", "00001a8f");
    TestUtils.testUsageValues(jenkins, parser, "ti.zip", expectedValues);
}
Also used : MemoryMapGraphConfiguration(net.praqma.jenkins.memorymap.graph.MemoryMapGraphConfiguration) HashMap(java.util.HashMap) TexasInstrumentsMemoryMapParser(net.praqma.jenkins.memorymap.parser.ti.TexasInstrumentsMemoryMapParser) Test(org.junit.Test)

Aggregations

MemoryMapGraphConfiguration (net.praqma.jenkins.memorymap.graph.MemoryMapGraphConfiguration)11 AbstractMemoryMapParser (net.praqma.jenkins.memorymap.parser.AbstractMemoryMapParser)5 Test (org.junit.Test)5 HashMap (java.util.HashMap)4 GccMemoryMapParser (net.praqma.jenkins.memorymap.parser.gcc.GccMemoryMapParser)3 ArrayList (java.util.ArrayList)2 TexasInstrumentsMemoryMapParser (net.praqma.jenkins.memorymap.parser.ti.TexasInstrumentsMemoryMapParser)2 MemoryMapConfigMemory (net.praqma.jenkins.memorymap.result.MemoryMapConfigMemory)2 MemoryMapMemorySelectionError (net.praqma.jenkins.memorymap.util.MemoryMapMemorySelectionError)2 File (java.io.File)1 IOException (java.io.IOException)1 Matcher (java.util.regex.Matcher)1 MemoryMapMapParserDelegate (net.praqma.jenkins.memorymap.parser.MemoryMapMapParserDelegate)1 MemoryMapConfigMemoryItem (net.praqma.jenkins.memorymap.result.MemoryMapConfigMemoryItem)1 HexifiableString (net.praqma.jenkins.memorymap.util.HexUtils.HexifiableString)1