This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS/AM5746: MMU setting policy of sample projects in PROCESSOR-SDK-RTOS-AM57X

Guru 10235 points
Part Number: AM5746
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

Hello, TI Experts,

 

Our customer sent us questions about "MMU setting" with PROCESSOR-SDK-RTOS-AM57X.

They would like to know the recommended way of integrating multiple sample projects including driver software by referring to the MMU setting.

 

Question:

- Could you tell us the MMU setting policy of the sample project including driver software (for AM574x and AM335x)?

- Are there any fundamental rule or basic concept of those sample project including driver software?

- Could you tell us MMU setting policy of the each project including MAIRn registers setting?

 

Best regards,

  • Matusan,

    Is the question related to bare-metal or TI RTOS examples ?  The MMU settings for both the setups is done differently.

    For bare-metal code:

    The MMU settings for bare-metal A15 applications is done using the CSL Init library (ti.csl.init.aa15fg). The source code and setting of the MMU is part of the A15 core initialization which you can find in the source files mmu_a15.c and mmu_a15_gcc.asm in folder pdk_am57xx_x_x_xx\packages\ti\csl\arch\a15\v1.  The MMU settings typically need to be done when the device is in SVC (supervisor state). This initialization of the core is designed to run before executing application main. the device reset vector will start execution of the intiialization code and then branch to main to allow execution.

    For TI RTOS application:

    The code that performs MMU configuration is in the MMU.c file for the appropriate ARM core in question. For example for A15, refer to the MMU source file here:

    bios_6_73_01_01\packages\ti\sysbios\family\arm\a15

    User can update/override the MMU settings applied as part of BIOS configuration using .cfg file 

    Example:

    /* ================ Cache and MMU configuration ================ */

    var Cache1 = xdc.useModule('ti.sysbios.family.arm.a15.Cache');
    var Mmu = xdc.useModule('ti.sysbios.family.arm.a15.Mmu');

    /* Enable cache */
    Cache1.enableCache = true;

    /* Enable the MMU (Required for L1 data caching) */
    Mmu.enableMMU = true;

    var attrs = new Mmu.DescriptorAttrs();
    Mmu.initDescAttrsMeta(attrs);
    attrs.type = Mmu.DescriptorType_BLOCK;
    attrs.noExecute = true;
    attrs.accPerm = 0; // R/W at PL1
    attrs.attrIndx = 7; // Use MAIR0 Byte7
    Mmu.setMAIRMeta(7, 0x04);

    Mmu.setSecondLevelDescMeta(0x43200000, 0x43200000, attrs);
    Mmu.setSecondLevelDescMeta(0xA0000000, 0xA0000000, attrs); /* APP_UNCACHED_DATA_BLK3_MEM */

    to confirm that the MMU setting is applied, in debug view you can enable the ROV view and look at the page tables setup and the attributes setup. CCS REgister view also alllows users to read the core supervisor registers to read back the MMU setup and hte attributes setup for each region but doesn`t have a way to interpret them.  Code composer studio may not have the best of features to debug MMU related issues. You look at other trace tools like LAuterbach/Trace32 to optimize the MMU settings.

    We also recommend the Cortex A Programmers guide to understand more about setting MMU And cache :

    https://www.macs.hw.ac.uk/~hwloidl/Courses/F28HS/Docu/DEN0013D_cortex_a_series_PG.pdf 

  • Following tools are available for application developers to check on MMU status:

    ARM Advanced Tools:

    Under Tools-> ARM Advanced tools , you can check if MMU is enabled or disabled but translation information is not available. You can check out the screen shot below:

    CCS Register View to check ARM CP15 Registers:


    ROV Classic tool for RTOS:

    For RTOS developers the Level 1 and Level 2 setup can be read back using the ROV Classic View as shown bellow

  • Hi,



    Thank you very much for your detail explanation.

    I really appreciate your help.



    The question related to TI RTOS examples.



    And we understand like below from your answer of TI RTOS part;

    - MMU fundamental configuration is in the MMU.c file.

    - MMU addtional configuration is in the .cfg file.

    - So, there are sometime MAIRn configuration difference in each project .cfg file of PROCESSOR-SDK-RTOS-AM57X.



    Is this understanding correct?



    And they sent us additional an question about MMU setting of various driver in PROCESSOR-SDK-RTOS-AM57X.



    Question:

    Are there any MMU setting specification of various driver?

    - If there is any MMU setting specification of various driver, please tell us.



    <Back ground of this question>

    They did not notice until they saw the below cfg file that they needed to set MMU by separating the cache effective space and the cache invalid space section with the USB driver resource.

    So they would like get the clue/advice from TI to prevent same issue.

    "ti\pdk_am57xx_1_0_11\packages\ti\drv\usb\example\bios\am57xx\usb_arm_am574x_idk.cfg"



    Best regards,
  • In majority of the cases the additional MMU settings that are requires in the examples is to turn the cache off on regions like where peripheral configuration MMR registers are defined or for buffers used by EDMA to move data in and out for the cores to access. This is completely application use case specific and not really a driver requirement.

    For example: If customer wants to use GPMC or QSPI on the device for execute in place, then the peripheral direct access memory will need to be configured as read/write execute with cache and bufferable settings enabled on that region to get better performance.

    Again, typically MMU is set as cache-able for DDR, OCRAM and any other device memory that RTOS assumes is on the chip or on the board from where the drivers. However if there are application specific requirement to disable the cache for certain memory then the application needs to inform the OS to do so. In example of USB drivers, The configuration for pinmux data buffers in OCRAM to be non-cache able can be reused across all platforms. The data/code sections/ data buffers get used only once so they need to be non-cached while the region at 0xA00000000 is used by the USB device driver for storing global usbXHCI data so we need to indicate to RTOS to make this region non-cached.

    Regards,
    Rahul

  • Hi,

    Thank you very much for your detail explanation.
    I really appreciate your help.
    I will send the answer to the customer.

    Best regards,