• 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 » should HeapBufMP_create be in Thread ? why not in main() ?
Share
BIOS
  • Forum
  • Announcements
Options
  • Subscribe via RSS

should HeapBufMP_create be in Thread ? why not in main() ?

should HeapBufMP_create be in Thread ? why not in main() ?

This question is answered
RCReddy
Posted by RCReddy
on Apr 26 2012 12:30 PM
Genius3265 points

Hi All,

             Should HeapBufMP_create be in a thread. I see when i have two cores with core0 doing HeapBufMP_create in main() and after that one of the cores is not crossing the BIOS_start() in the main().

The same HeapBufMP_create if i do in Thread [NOT WITHIN while(1) loop], the core control flow is crossing BIOS_start()

Ti doesn't mention about HeapBufMP_create but it does mention about HeapBufMP_open()

My idea is to not take the headache of HeapBufMP_create in Tasks as i want it to be done once at start [i.e.main()]

please let me know on this

Thanks

R C Reddy

Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Chad Courtney
    Posted by Chad Courtney
    on Apr 27 2012 10:19 AM
    Mastermind22595 points

    RC Reddy,

    Please post BIOS related questions in the BIOS section of the forum.  I've moved this one as I've moved others before.  Postings need to be in the correct place to insure the correct audience and quicker response.

    Best Regards,

    Chad

    ------------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • RCReddy
    Posted by RCReddy
    on Apr 27 2012 12:02 PM
    Genius3265 points

    Thanks Chad,

                            I will stick to this protocol from now on. Actually i was under impression that all IPC questions should be to multicore forum, now i understand that they stand with BIOS forums.

    Regards

    RC Reddy

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Chad Courtney
    Posted by Chad Courtney
    on Apr 27 2012 13:29 PM
    Mastermind22595 points

    Thanks for understanding, I appreciate it.  It's often hard to determine where the support should be from the customer side of things.  Basically if it's BIOS related it needs to go to BIOS, Linux related to Linux, CCS/Emulator Related to CCS, etc.  Even though the device may be C66xx it still goes to those other forums if the question is specific to that area of support for the device.

    Best Regards,

    Chad

    ------------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Steven Connell
    Posted by Steven Connell
    on Apr 27 2012 19:19 PM
    Suggested Answer
    Mastermind20580 points

    Hi R C Reddy,

    I hunted through the code a bit and didn't see anything stand out that made me think you couldn't do this at main.  I can ask my colleague about it on Monday for a more concrete answer.  In the meantime ...

    Taking a quick look at the IPC examples, I see that HeapBufMP_create() is called from within task context, but that still doesn't answer your question, as we can't conclude that from this that you can't call it from main().

    For now you may want to assume that it must be called after BIOS_start().  What you can do is try putting your HeapBufMP_create() code into a BIOS startup function.  You can configure a start up function to be called in your *.cfg file with code similar to the following:

    /* get handle to BIOS module */
    var BIOS = xdc.useModule('ti.sysbios.BIOS');
    /* install a BIOS startup function */
    BIOS.addUserStartupFunction('&myBiosStartup');

    "myBiosStartup()" would contain the HeapBufMP_create() call

    Steve

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • RCReddy
    Posted by RCReddy
    on May 02 2012 23:54 PM
    Genius3265 points

    Sorry for late reply,

                                    i will provide you the code shortly, please try it at your end and let me know.

    Thanks

    RC Reddy

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • judahvang
    Posted by judahvang
    on May 03 2012 10:36 AM
    Genius16715 points

    RC,

    The short answer to your question is that HeapBufMP_create() can be called from main() only after Ipc_start()/Ipc_attach().  In fact, you can't call any IPC APIs until you have called Ipc_start();

    Note:  HeapBufMP_open() must be called from a thread because it requires interrupts to be enabled.

    Judah

    If my reply answers your question please mark the thread as answered

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • RCReddy
    Posted by RCReddy
    on May 03 2012 12:22 PM
    Genius3265 points

    Hi Judah,

                    i see a contradiction in your statement to what Ti mentions in the Ipc.h file. It says IPC_attach has to be in Task() and you say HeapBufMP_create can occur only after IPC_attach, so it boils down to "HeapBufMP to be created in Task()". 

    Please clarify 

    ==================================================================

    /*!
    * @brief Attach to remote processor
    *
    * This function uses shared memory to synchronize self with the remote
    * processor. Both processors must call this function to attach to each
    * other. Ipc_start() must be called before calling Ipc_attach().
    * A processor must attach to the owner of SharedRegion zero before
    * it can successfully attach to another processor. Attempting to
    * attach to another processor first returns #Ipc_E_FAIL.
    *
    * This function opens the default GateMP and SharedRegion zero heap.
    * The Notify, NameServerRemoteNotify, and MessageQ transport
    * instances are created for communicating with the specified remote
    * processor in SharedRegion zero heap. The user's Ipc attach function
    * is called.
    *
    * For BIOS, this function should be called within a 'while' loop
    * within a Task. A Task_sleep() or Task_yield() should be called
    * within the loop to allow other threads in the system to execute.
    * This function needs to be called in a loop because the remote
    * processor may not be in a ready state.
    *
    * Note: For BIOS, if the config parameter Ipc.procSync is set to
    * Ipc.ProcSync_ALL, there is no need to call this function as it is
    * internally called by Ipc_start().
    *
    * @code
    * while (Ipc_attach(remoteProcId) < 0) {
    * Task_sleep(1);
    * }
    * @endcode
    *
    * @param remoteProcId remote processor's MultiProc id
    *
    * @return Status
    * - #Ipc_S_SUCCESS: attach was successful
    * - #Ipc_S_ALREADYSETUP: already attached
    * - #Ipc_E_MEMORY: operation failed due to a memory error
    * - #Ipc_E_FAIL: General failure
    * - #Ipc_E_NOTREADY: remote processor not ready
    *
    * @sa Ipc_detach Ipc_isAttached
    */
    Int Ipc_attach(UInt16 remoteProcId);

    =======================================================

    Thanks

    RC Reddy

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • judahvang
    Posted by judahvang
    on May 03 2012 16:18 PM
    Suggested Answer
    Genius16715 points

    RC,

    If you are explicity calling Ipc_attach() then yes, it should be called in a Task.

    If you are simply calling Ipc_start() (this will call Ipc_attach() for you) and synchronizing all the processors then you can call this in main().

    That's why I said Ipc_start()/Ipc_attach().  Its really not a contradiction, it just depends on how you want to synchronize the processors.

    Judah 

    If my reply answers your question please mark the thread as answered

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • RCReddy
    Posted by RCReddy
    on May 09 2012 23:56 PM
    Genius3265 points

    So i will conclude like this

    1. If its all cores, which has tobe synchronized then IPC_START (which is enoff for all cores to get synched), then i can do HeapBufMP_create in main() itself.

    2. if its only few cores [NOT ALL Cores] [synching through IPC_attach only], then HeapBufMP_create HAS to be CREATED in a task.

    Thanks

    RC Reddy

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • judahvang
    Posted by judahvang
    on May 10 2012 11:51 AM
    Verified Answer
    Verified by David Friedland
    Genius16715 points

    Sure that sounds correct.

    If my reply answers your question please mark the thread as answered

    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