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.

Memory alocation

Other Parts Discussed in Thread: OMAP3530

Hello to everyone!!

I use e igepv2 board (like beagleboard). Arm and DSP communicate using dsplink. In the DSP-side locally I want to allocate  large region of memory about 720x480 bytes. Can someone explain me how to do that because I have no idea. I try malloc but this return me zero. I have enabled the option for dynamic allocation. My problem is that I do not know how to allocate this region in a specific memory of the board.

Thanks

George

  • George,

    It would help to tell us which processor this is, and it sounds like it does not belong in the C64x Single Core Forum. In fact, it sounds like a CodeGen question so we will have it moved to the Compiler forum for the best chance at a good and complete answer.

    If malloc returns 0, then your -heap specification does not give you enough memory space. If your heap is 0x08000 (32KB), for example, and you try to allocate 0x54600 (345KB), then you should expect malloc to fail. Make -heap large enough for all the buffers you might allocate, and you should get better results. But make sure it is in external memory unless you have a very large internal memory block in the device you are using.

    DSP/BIOS and SYS/BIOS have additional heap-creation features and heap-usage functions. Look into those if you would like to have a fast heap in L2 and a large heap in external memory.

    You can allocate an array to use, but be careful to place it in a memory section that has enough room. You have three choices for a static allocation:

    char FrmBuf[480][720];  // this works if aggregate objects are allocated in .far and .far is in external memory

    far char FrmBuf[480][720];  // this works if .far is in external memory

    #pragma DATA_SECTION( FrmBuf, "mySection" );
    char FrmBuf[480][720];  // this requires you to add mySection to your linker command file so this buffer will be allocated in external memory

    Regards,
    RandyP

     

    If you need more help, please reply back. If this answers the question, please click  Verify Answer  , below.

  • Thanks for the answer.

    I do not understand how to change my tcf file and add mySection to the linker command file and then buffer[480][720] allocated to the external memory. I have no idea how to change this.Could you help me ? I post the tcf file. Thanks

    Regards

    George

     

    /** ============================================================================
     *  @file   FireDetect.tcf
     *
     * 
     *  ============================================================================
     */


    /*  ============================================================================
     *  Load generic DSP/BIOS Link configuration
     *  ============================================================================
     */
    utils.importFile("dsplink-omap3530-base.tci") ;
    utils.importFile("dsplink-iom.tci") ;
    utils.importFile("dsplink-zcpydata-swi.tci");
    utils.importFile("dsplink-dio.tci") ;
    utils.importFile("FireDetect.tci") ;

    /*  ============================================================================
     *  Set all code and data sections to use DDR2
     *  ============================================================================
     */
    bios.setMemCodeSections(prog, DDR2) ;
    bios.setMemDataNoHeapSections(prog, DDR2) ;
    bios.setMemDataHeapSections(prog, DDR2) ;

    /*  ============================================================================
     *  MEM : Global
     *  ============================================================================
     */
    prog.module("MEM").BIOSOBJSEG = DDR2 ;
    prog.module("MEM").MALLOCSEG  = DDR2 ;

    /*  ============================================================================
     *  TSK : Global
     *  ============================================================================
     */
    prog.module("TSK").STACKSEG = DDR2 ;

    /*  ============================================================================
     *  Generate cdb file...
     *  ============================================================================
     */
    if (config.hasReportedError == false) {
        prog.gen() ;
    }

  • We need more information in order to point you in the right direction:

    Which device are you using?
    Which version of CCS are you using?
    Which version of DSP/BIOS are you using?

    Regards,
    RandyP

  • Thanks for the answer!!

    I am not using CCS.  I compile my code under linux ubuntu 11.10 using the appopriate make files and the Texas Instrument  tools. Then my application run in a igepv2 board which has an ARM Cortex A8 OMAP3530 processor (GPP) and TMS320C64x DSP processor. In addition , the DSP/BIOS I am using is 5.xx (bios_5_41_04_18) version.

    Regards

    George

     

  • The OMAP3530 DSP is a C64x+ core, which has significant upgrades from the C64x core (no +).

    The Compiler User's Guide describes a #pragma DATA_SECTION, which is what you need to use. Between the Compiler User's Guide and the Assembly Language Tools Reference Guide and the BIOS User's Guide, the instructions for creating a user-defined section are found.

    You should be able to do what you want by using the far modifier for you array declaration. If this works for you, then you will not need to worry about the other stuff with the linker.

    You cannot do it all with just the tcf file, unless there are specific use-case situations like the placement of the heap section, .sysmem.

    Try the far declaration and see if it works for you.

    Let us know how it turns out.

    Regards,
    RandyP