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.

内存申请问题



专家,您好!

我的平台是DM8148,是C674x + Cortex A8核,在项目时我遇到个内存问题,我一个工程在初始化时malloc申请一个内存指针

short *pBuffer;

size = 64*64;

pBuffer = (short*) malloc(sizeof(short) * size);

但根据我的调试发现申请的内存并没有成功,因为我通过watch和设置断点CCS发现pBuffer在调用的过程中是指向0x00000001类的地址,不存在

我的cmd文件是:

MEMORY {
  /* CACHE_L2RAM : origin = 0x11800000,  len = 0x40000
   CACHE_L1P   : origin = 0x11e00000,  len = 0x8000
   CACHE_L1D   : origin = 0x11f00000,  len = 0x8000
   L3RAM       : origin = 0x80000000,  len = 0x20000*/
   SDRAM       : origin = 0x80000000,  len = 0x8000000
   VECS        :     o = 0x00800000     l = 0x00000300
   L2MEM       :     o = 0x00800300     l = 0x0003ffff  
}

SECTIONS
{
    vectors            :> SDRAM
    .vecs       >       VECS
    .cinit             :> L2MEM
    .text              :> L2MEM
    .const             :> L2MEM
    .far               :> L2MEM   
    .stack             :> SDRAM
    .bss               :> SDRAM
    .data              :> SDRAM
    .switch            :> SDRAM
    .sysmem            :> SDRAM
    .tables            :> SDRAM
    .cio               :> SDRAM
    .fardata           :> SDRAM

 

请专家看下我是哪里出错了,非常感谢!