This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

MMU and Cache configuration

Hello there,

I want to enable MMU and Cache to improve the performance of my arm cortex-A5 core.

I have gone through the Reference manual of arm cortex a5 and found the below step to enable mmu and cache

Steps :

1.Disable cache, branch predictors

2. Invalidate cache and TLB

3. set translation table entries , point ttbr register to translation table.

4.enable cache, branch predictor

5. enable MMU.

Queries

1. I need help to understand how the translation table entries are defined.. If i choose 1MB section option then

how can i make entry for External flash memory which is of 16MB. 

Here we have different memory regions, internal Ram(1MB), internal flash(4MB), External flash(16MB) and so on..

How can i define translation table entries for the above mentioned memory regions.

2.  Translation tables are stored in main memory, here main memory is RAM ???

3 How can we check all the above steps working or not in trace32 ??

by executing the command cache.view i am able to see the cache content but i am unable to understand it.

Thanks in Advance.

ZbinAhmed

Parents
  • First of all, read ARM Cortex-A series programmer's guide for ARMv7, chapter "The Memory Management Unit".

    1) External flash memory directly or indirectly addressed (via flash controller)? First level translation table occupies 4096 32-bit entries in memory, one 32-bit entry for 1MB section. For 16MB of memory you have to configure 16 entries in the 1-level translation table. In the chapter "The Memory Management Unit" you can find examples of translation and entry configuration.

    For example, code fragments (for Cortex A5 Atmel Sama5d2):

    ...

    ALIGNED(16384) static uint32_t tlb[4096]; // translation table allocated in main memory

    ...

    uint32_t addr;

    /* Reset table entries */
    for (addr = 0; addr < 4096; addr++)
    tlb[addr] = 0;

    ...

    /* 0x00000000: ROM */
    tlb[0x000] = TTB_SECT_ADDR(0x00000000)
    | TTB_SECT_AP_READ_ONLY
    | TTB_SECT_DOMAIN(0xf)
    | TTB_SECT_EXEC
    | TTB_SECT_CACHEABLE_WB
    | TTB_TYPE_SECT;

    /* 0x00100000: NFC SRAM */
    tlb[0x001] = TTB_SECT_ADDR(0x00100000)
    | TTB_SECT_AP_FULL_ACCESS
    | TTB_SECT_DOMAIN(0xf)
    | TTB_SECT_EXEC
    | TTB_SECT_SHAREABLE_DEVICE
    | TTB_TYPE_SECT;

    /* 0x00200000: SRAM */
    tlb[0x002] = TTB_SECT_ADDR(0x00200000)
    | TTB_SECT_AP_FULL_ACCESS
    | TTB_SECT_DOMAIN(0xf)
    | TTB_SECT_EXEC
    | TTB_SECT_CACHEABLE_WB
    | TTB_TYPE_SECT;

    ...

    2) Yes, RAM is main memory.

Reply
  • First of all, read ARM Cortex-A series programmer's guide for ARMv7, chapter "The Memory Management Unit".

    1) External flash memory directly or indirectly addressed (via flash controller)? First level translation table occupies 4096 32-bit entries in memory, one 32-bit entry for 1MB section. For 16MB of memory you have to configure 16 entries in the 1-level translation table. In the chapter "The Memory Management Unit" you can find examples of translation and entry configuration.

    For example, code fragments (for Cortex A5 Atmel Sama5d2):

    ...

    ALIGNED(16384) static uint32_t tlb[4096]; // translation table allocated in main memory

    ...

    uint32_t addr;

    /* Reset table entries */
    for (addr = 0; addr < 4096; addr++)
    tlb[addr] = 0;

    ...

    /* 0x00000000: ROM */
    tlb[0x000] = TTB_SECT_ADDR(0x00000000)
    | TTB_SECT_AP_READ_ONLY
    | TTB_SECT_DOMAIN(0xf)
    | TTB_SECT_EXEC
    | TTB_SECT_CACHEABLE_WB
    | TTB_TYPE_SECT;

    /* 0x00100000: NFC SRAM */
    tlb[0x001] = TTB_SECT_ADDR(0x00100000)
    | TTB_SECT_AP_FULL_ACCESS
    | TTB_SECT_DOMAIN(0xf)
    | TTB_SECT_EXEC
    | TTB_SECT_SHAREABLE_DEVICE
    | TTB_TYPE_SECT;

    /* 0x00200000: SRAM */
    tlb[0x002] = TTB_SECT_ADDR(0x00200000)
    | TTB_SECT_AP_FULL_ACCESS
    | TTB_SECT_DOMAIN(0xf)
    | TTB_SECT_EXEC
    | TTB_SECT_CACHEABLE_WB
    | TTB_TYPE_SECT;

    ...

    2) Yes, RAM is main memory.

Children