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.

关于AM335X starterware 中CP15MMUEnable();的问题



在AM335X的StarterWare 的mmu.c中有使能MMU的函数:其中CP15MMUEnable();的源代码我没有找到,有没有大侠可以提供一下,并且知道一下这个CP15MMUEnable();是干什么的???mmu.c文件见附件

void MMUEnable(unsigned int *masterPt)
{
/* Set TTB0 register */
CP15Ttb0Set((unsigned int)masterPt);

/* Enable MMU */
CP15MMUEnable();
}

  • 使能MMU单元的。这块东西的作用,可以简单理解成增加你进行读写寄存器的效率。

    所有的AM335x都是一样的,其实你完全照搬就可以了,不需要做任何改动。

  • 您好,我通过CMD文件把数据由DDR3改到片内SRAM之后,程序跑到这个CP15MMUEnable(),就跑飞了,请问这是怎么回事?CP15MMUEnable:的汇编如下:

    CP15MMUEnable:
    MRC p15, #0, r0, c1, c0, #0
    ORR r0, r0, #0x001
    MCR p15, #0, r0, c1, c0, #0 ; Set MMU Enable bit
    DSB
    BX lr

    CMD文件如下:

    -stack 0x0008 /* SOFTWARE STACK SIZE */
    -heap 0x2000 /* HEAP AREA SIZE */
    -e Entry
    /* Since we used 'Entry' as the entry-point symbol the compiler issues a */
    /* warning (#10063-D: entry-point symbol other than "_c_int00" specified: */
    /* "Entry"). The CCS Version (5.1.0.08000) stops building from command */
    /* line when there is a warning. So this warning is suppressed with the */
    /* below flag. */

    --diag_suppress=10063

    /* SPECIFY THE SYSTEM MEMORY MAP */

    MEMORY
    {
    IRAM_MEM : org = 0x402F0400 len = 0x0FC00 /* RAM */
    L3OCMC0: o = 0x40300000 l = 0x00010000 /* 64kB L3 OCMC SRAM */
    DDR_MEM : org = 0x80000000 len = 0x7FFFFFF /* RAM */
    }

    /* SPECIFY THE SECTIONS ALLOCATION INTO MEMORY */

    SECTIONS
    {
    .init : load > IRAM_MEM
    //{
    // bl_init.obj (.text)
    //} load > 0x402F0400

    .text :Entry : load > IRAM_MEM /* CODE */
    .data : load > IRAM_MEM /* INITIALIZED GLOBAL AND STATIC VARIABLES. */
    .bss : load > IRAM_MEM /* UNINITIALIZED OR ZERO INITIALIZED */
    /* GLOBAL & STATIC VARIABLES. */
    RUN_START(bss_start)
    RUN_END(bss_end)
    .const : load > IRAM_MEM /* GLOBAL CONSTANTS */
    .cinit : load > IRAM_MEM
    .stack : load > L3OCMC0 /* SOFTWARE SYSTEM STACK */

    }

  • 你现在是跑在片内ram上面的?这个空间很小的,印象中小于128K,你的.out文件中带有调试信息,很容易就超了吧。把cache和MMU的这部分配置去掉,你能正常跑你的程序吗?.out有多大?

    再PS一下:如果跑在内部RAM上面干嘛还要启用MMU?

    MMU本身就是为了应对DDR的巨大空间,进行内存管理的,你跑在片内RAM上面再用这个不是多此一举?我刚翻到篇文章,讲MMU的,share给你:

    http://blog.csdn.net/ylyuanlu/article/details/5990780

  • 把cache和mmu注销掉,,程序能够在片内RAM中跑下来,但是mmu中有CP15MMUEnable()这个函数,其中有打开协处理器,如果注销掉的话速度就会满很多,达不到要求,而且昨天排查出错原因,程序跑飞的原因就是这个CP15MMUEnable()函数:

    CP15MMUEnable:
    MRC p15, #0, r0, c1, c0, #0
    ORR r0, r0, #0x001
    MCR p15, #0, r0, c1, c0, #0 ; Set MMU Enable bit
    DSB
    BX lr

    CMD文件如下:

    -stack 0x0008 /* SOFTWARE STACK SIZE */
    -heap 0x2000 /* HEAP AREA SIZE */
    -e Entry
    /* Since we used 'Entry' as the entry-point symbol the compiler issues a */
    /* warning (#10063-D: entry-point symbol other than "_c_int00" specified: */
    /* "Entry"). The CCS Version (5.1.0.08000) stops building from command */
    /* line when there is a warning. So this warning is suppressed with the */
    /* below flag. */

    --diag_suppress=10063

    /* SPECIFY THE SYSTEM MEMORY MAP */

    MEMORY
    {
    IRAM_MEM : org = 0x402F0400 len = 0x0FC00 /* RAM */
    L3OCMC0: o = 0x40300000 l = 0x00010000 /* 64kB L3 OCMC SRAM */
    DDR_MEM : org = 0x80000000 len = 0x7FFFFFF /* RAM */
    }

    /* SPECIFY THE SECTIONS ALLOCATION INTO MEMORY */

    SECTIONS
    {
    .init : load > IRAM_MEM
    //{
    // bl_init.obj (.text)
    //} load > 0x402F0400

    .text :Entry : load > IRAM_MEM /* CODE */
    .data : load > IRAM_MEM /* INITIALIZED GLOBAL AND STATIC VARIABLES. */
    .bss : load > IRAM_MEM /* UNINITIALIZED OR ZERO INITIALIZED */
    /* GLOBAL & STATIC VARIABLES. */
    RUN_START(bss_start)
    RUN_END(bss_end)
    .const : load > IRAM_MEM /* GLOBAL CONSTANTS */
    .cinit : load > IRAM_MEM
    .stack : load > L3OCMC0 /* SOFTWARE SYSTEM STACK */

    }