• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Embedded Software » BIOS » BIOS forum » MEM_alloc using DSP/BIOS
Share
BIOS
  • Forum
  • Announcements
Options
  • Subscribe via RSS

Forums

MEM_alloc using DSP/BIOS

  • Penny9692
    Posted by Penny9692
    on Jul 13 2009 12:27 PM
    Prodigy120 points

    Dear Sir:

    I want to use MEM_alloc or malloc in my program like this

    char *a = (char*)malloc(10);

    First, when I didn't choose "No Dynamic Memory Heaps", of course I got return a=0x0.

    Next, I disable "No Dynamic Memory Heaps" and make DDR2 "create a heap in this memory" as "True" and set the heap size as 0x400, enable "usr defined heap identifier label".

    But I got serious result because after entering the function malloc, the program never return and hang in this function.

    I try MEM_alloc(DDR2, 10, 0) too but still has this problem.

     

    How can I suppose to resolve this?

    Thank you very much.

     

     

    DSP/BIOS
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • desouza
    Posted by desouza
    on Jul 13 2009 13:42 PM
    Guru56775 points

    Penny,

    Calls to malloc() or MEM_alloc() are usually safe as long as you have enough memory and no other higher priority threads are locking the same memory.

    Assuming that your external memory is working (i.e., the EMIF is properly configured by your custom code or via a GEL file), the most common root for this problem is calling MEM_alloc() or malloc() either from a SWI or from a HWI - this can cause lockup problems given these APIs have a memory lock mechanism to protect against data overwrite.

    To explore this further I would suggest to verify the following references:

    This question at the DSP/BIOS FAQ that talks about the RTS functions that use the LCK mechanism;

    MEM_alloc() and LCK_pend() descriptions at the DSP/BIOS API Guide (SPRU403 for C6000);

    Section A.1 - Function Callability Table of the DSP/BIOS API Guide (SPRU403 for C6000)

    Section 5.1 of the DSP/BIOS User's Guide that talks about general memory configuration (SPRU423);

    For an usage example check the supplied DSP/BIOS example project mem_management typically located at

    C:\CCStudio_v3.3\bios_5_33_05\packages\ti\bios\examples\basic\mem_management

    Hope this information helps,

    Rafael

     


    If my reply answers your question please click on the green button "Verify Answer".
    Search the wiki or go to useful pages for SDOWP, CGT, BIOS, CCSv3, CCSv4, CCSv5
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Penny9692
    Posted by Penny9692
    on Jul 14 2009 02:35 AM
    Prodigy120 points

    I have tried mem_management sample before.

    It can really work when allocating memory in IRAM

    However, when I change to DDR2 it will fail.

    I add extern Int SEG1 as DDR2 heap identifier label, change the malloc()/free() memory to DDR2.

    I check the trace memory and got some message:

    2 seg0: segment size 0x2000
    3       number of MADUs used in seg0: 0x2000
    4       size of the largest free contiguous block of memory in seg0:    A 0x0
    5   allocating memory blocks in seg0 ...
    6   memory block 0 allocated at address = 00000000
    7   memory block 1 allocated at address = 00000000
    8   after allocating ...
    9   seg0: segment size 0x2000
    10       number of MADUs used in seg0: 0x2000
    11       size of the largest free contiguous block of memory in seg0:    A 0x0

    I wonder why there's no contiguous memory.

    Thank you very much.

     

    Penny

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Penny9692
    Posted by Penny9692
    on Jul 14 2009 05:31 AM
    Prodigy120 points

    I check out the Kernel Object View window and found that

    the MEM object describes two memory segment status.

    The IRAM is normal but the another one is "PRD_STARTPRD Memory Heap Full".

    Once the program beginning, the memory heap is full no matter how I set the DDR2 size and heap size.

    How to resolve this problem?

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use