Other Parts Discussed in Thread: TMS320F28335, SYSBIOS, C2000WARE
Hi there,
I have some question related with memory allocation on an external memory using TMS320F28335's XINTF.
I've used the external memory by using the macro function "DATA_SECTION" which is offered by TI.
For now, I should use dynamic allocation on the external memory with SYS/BIOS.
The first issue is when ".esysmem" is placed on ZONE 6(which is connected with my external SRAM), it doesn't work.
I've been trying to set the section ".esysmem" on XINTF address "0x100000". BUT, it doesn't work.
AFAIK, C2000 compiler user guide note that COFF format should use its data region as ".ebss" and ".esysmem".
The guide also note that both of them could be placed any memory region beyond low 64K address.
When I put the ".ebss" and ".esysmem" to low 64k region and set BIOS.heapSection to ".ebss" or ".esysmem", it works.
But, when I put the one of those mem sections to Zone6 region, not working.
I already called InitXINTF() on the top of my code after InitSysCtrl(), so I reckon it's not fault.
The second issue is that the new heapMem module on ZONE 6 also doesn't work.
After I failed to resolve the first issue, I thought it'd be great alternative to create a new heapMem module on Zone 6 for dynamic allocation.
Then, I tried to create a new heap module "externalHeap" and add it to Program.global.externalHeap.
After it, I tried to allocate memory on my code in runtime by using Memory_alloc(externalHeap, size, align, error_block).
But, it DOESN'T work.... What I can get memory was just 0x0...
When I checked it by ROV, it showed that it placed correct address "0x100000" and total size "0x4000", but its totalFreeSize 0 and largestFreeSize 0.
In case of its default system heap, its totalFreeSize and largestFreeSize are not 0.
I cannot make sense why it works like it, and I don't know how to get more infos.
Is there anything wrong that I configured as below?
Could you give some advise for it?
Thanks & Best regards,
Larry Kim
/////////////CMD file///////////////
MEMORY
{
PAGE 0: /* Program Memory */
/* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE1 for data allocation */
RAMM0 : origin = 0x000050, length = 0x0003B0 /* on-chip RAM block M0 */
RAMM1 : origin = 0x000400, length = 0x000400 /* on-chip RAM block M1 */
RAML0 : origin = 0x008000, length = 0x001000 /* on-chip RAM block L0 0x004E00 */
FLASHH : origin = 0x300000, length = 0x008000 /* on-chip FLASH */
FLASHA : origin = 0x318000, length = 0x027F80 /* on-chip FLASH */
CSM_RSVD : origin = 0x33FF80, length = 0x000076 /* Part of FLASHA. Program with all 0x0000 when CSM is in use. */
BEGIN : origin = 0x33FFF6, length = 0x000002 /* Part of FLASHA. Used for "boot to Flash" bootloader mode. */
CSM_PWL : origin = 0x33FFF8, length = 0x000008 /* Part of FLASHA. CSM password locations in FLASHA */
OTP : origin = 0x380400, length = 0x000400 /* on-chip OTP */
ADC_CAL : origin = 0x380080, length = 0x000009 /* ADC_cal function in Reserved memory */
FPUTABLES : origin = 0x3FEBDC, length = 0x0006A0 /* FPU Tables in Boot ROM */
ROM : origin = 0x3FF27C, length = 0x000D44 /* Boot ROM */
RESET : origin = 0x3FFFC0, length = 0x000002 /* part of boot ROM */
VECTORS : origin = 0x3FFFC2, length = 0x00003E /* part of boot ROM */
PAGE 1 : /* Data Memory */
/* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE0 for program allocation */
/* Registers remain on PAGE1*/
M01SARAM : origin = 0x000040, length = 0x0007C0 /* on-chip RAM block M0, M1 */
PIEVECT : origin = 0xD00, length = 0x100
L17SARAM : origin = 0x009000, length = 0x007000
FLASHG : origin = 0x308000, length = 0x010000 /* on-chip FLASH */
ZONE6 : origin = 0x0100000, length = 0x40000 /* XINTF zone 6 */
ZONE7 : origin = 0x0200000, length = 0x100000
}
SECTIONS
{
/* Allocate program areas: */
.cinit : > FLASHA, PAGE = 0
.pinit : > FLASHA, PAGE = 0
.text : > FLASHA PAGE = 0
.cio : > RAML0 PAGE = 0
codestart : > BEGIN PAGE = 0
ramfuncs : LOAD = FLASHH,
RUN = RAMM1|RAML0,
LOAD_START(_RamfuncsLoadStart),
LOAD_END(_RamfuncsLoadEnd),
RUN_START(_RamfuncsRunStart),
PAGE = 0 csmpasswds : > CSM_PWL PAGE = 0
csm_rsvd : > CSM_RSVD PAGE = 0
/* Allocate uninitalized data sections: */
.stack : > L17SARAM PAGE = 1
.ebss : > L17SARAM PAGE = 1 // I tried to change it into ZONE6, but failed
.data : > L17SARAM PAGE = 1
.esysmem : > L17SARAM PAGE = 1 // I tried to change it into ZONE6, but failed
/* Initalized sections go in Flash */
/* For SDFlash to program these, they must be allocated to page 0 */
.econst : > FLASHG PAGE = 1
.switch : > FLASHG PAGE = 1
/* Allocate IQ math areas: */
FPUmathTables : > FPUTABLES, PAGE = 0, TYPE = NOLOAD
/* Allocate 0x400 of XINTF Zone 6,7 to storing data */
ZONE6DATA : > ZONE6, PAGE = 1
DataLoad : > ZONE6, PAGE = 1
ZONE7DATA : > ZONE7, PAGE = 1
/* .reset is a standard section used by the compiler. It contains the */
/* the address of the start of _c_int00 for C Code. /*
/* When using the boot ROM this section and the CPU vector */
/* table is not needed. Thus the default type is set here to */
/* DSECT */
.reset : > RESET, PAGE = 0, TYPE = DSECT
vectors : > VECTORS PAGE = 0, TYPE = DSECT
/* Allocate ADC_cal function (pre-programmed by factory into TI reserved memory) */
.adc_cal : load = ADC_CAL, PAGE = 0, TYPE = NOLOAD
}
/////////////app.cfg///////////////
...
BIOS.heapSize = 0x4000;
BIOS.heapSection = ".esysmem";var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
var heapMemParams1 = new HeapMem.Params;
heapMemParams1.size = 0x1000;
heapMemParams1.sectionName = "ZONE6DATA";
heapMemParams1.align = 16;
heapMemParams1.minBlockAlign = 4;
Program.global.externalHeap = HeapMem.create(heapMemParams1);
...