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.

Running NDK code, not library

Other Parts Discussed in Thread: OMAPL138

Hi,

  I need to bring in the NDK code into my project instead of just using the library.  When I call NC_NetStart, it returns a value of zero and then deletes the configuration.  I also get the console message:

00000.000 FATAL: NDK_hookInit() must be set in DSP/BIOS Task module config

What do I need to do to my config file to fix this issue?

  • Will,

    If You are working with OMAPL138, need to configue for NDK in cfg file,as per below sequence.

    /*
     * ======== NDK configuration ========
     */

    var Global = xdc.useModule('ti.ndk.config.Global');

    Global.networkOpenHook = '&netOpenHook';
    Global.networkCloseHook = '&netCloseHook';

    var Ip = xdc.useModule('ti.ndk.config.Ip');

    /*
     * Use the OMAPL138 Emac module.  This will cause the dirver library to link
     * into the program.
     */
    xdc.useModule('ti.drv.omapl138.Emac');

  • Hi Will Rensick,

    Moving your post to BIOS forum as the query is about NDK. But however you have to provide the following information to help you better.

    1. Which processor you use? ( From the tag you linked, I hope, it is C6748. but still not sure whether it is OMAPL138 or just the C6748).

    2. What are the versions of NDK, CCS and DSP/BIOS being used?

    3. Here, you mentioned that you are bringing in the NDK code into your project. Why there is a need to do this instead of using it as library. If possible, do a brief explanation on what your project does and how it would want to use the NDK code?

    A relative query given below has discussed about this error. Please check whether it has an answer for you.

    http://e2e.ti.com/support/embedded/bios/f/355/t/207027.aspx

     

    Regards,

    Shankari.

     

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

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

  • Hi Shankari,

     

    I am using the C6748, not the OMAP.

    I am using Bios 6.34.2.18, CCS 5.3 and NDK 2.20.6.35

    I am trying to bring the NDK code into my project because we now have custom hardware which means a different phy so the NDK code needs to change for the phy.  Also, I need to put all the NDK code into external memory to run in debug mode, but have my application code in internal memory on the 6748.  So I have to able to pragma most of the files into external memory.  Once we get a solid NDK code base, we don't plan to change it unless we want to add a webpage or something into the application and I felt it would be easier to just port all the NDK code into our application.  I do not want to use any libraries if possible just so I can have more control over the code.

    Will

  • Hi Will,

    will Resnick said:
    I am trying to bring the NDK code into my project because we now have custom hardware which means a different phy so the NDK code needs to change for the phy. 

    Was there a specific problem you encountered regarding this? The NDK core stack is h/w independent.  You shouldn't need to change any C code in the NDK for new hardware.

    All of the h/w dependent code is in the driver (NSP product).  This is brought into your app by the following code in your *.cfg file:

    /*
     * Use the OMAPL138 Emac module.  This will cause the dirver library to link
     * into the program.
     */
    xdc.useModule('ti.drv.omapl138.Emac');

    You would want to modify the NSP driver files for the different PHY on your custom h/w.

    will Resnick said:
    Once we get a solid NDK code base, we don't plan to change it unless we want to add a webpage or something into the application and I felt it would be easier to just port all the NDK code into our application.  I do not want to use any libraries if possible just so I can have more control over the code.

    You should be able to do this.  However, I must state that if you go down the path of picking and choosing parts of the stack and leaving others out, etc., this will make it difficult to support you if you run into problems.

    Having said that, what I think you want to do is remove all use of the modules from the 'ti.ndk.config' package from your application.

    Specifically, the following statement in your *.cfg file:

    var Global = xdc.useModule('ti.ndk.config.Global');

    Causes the NDK runtime configuration code to be generated and the appropriate NDK stack libraries to be linked into your application.  This includes the Task function "ti_ndk_config_global_stackThread()" that you can find in the generated .c file for your project (for example, it's deep in your project's Debug or Release folder after you build. Look for the .c file under "Debug\configPkg\package\cfg" in your project).  This is the function that creates the NDK run time configuration object and calls NC_NetStart, etc.

    So, if you don't want that and wish to handle the NDK yourself, you should remove that above mentioned line from your configuration as well as all other NDK module configurations (any 'useModule(ti.ndk.config*' type lines).

    You would need to implement the main NDK task thread in you app yourself, as well as the NDK heart beat clock, then build in the NDK sources into your app.

    I assume you are using the NSP product for your 6748 device?  If so, please have a look at the "cfgdemo" example.  It still uses "the old style of configuration" and is similar to what you want to do.  See the function "StackTest" in the cfgdemo.c file.

    Note that this example still uses the ti.ndk.config package but just to link in the NDK libraries (it sets Global.enableCodeGeneration = false).

    In your case you will need to remove all of the ti.ndk.config references, bring in the code for the NDK stack thread (and create a task for it) and also create the NDK heart beat clock.  Lastly, instead of linking the libraries you will build the NDK sources into your project.

    Also, I want to make sure that you're aware you can rebuild the NDK libraries.  You can make whatever changes you like, additions/ommisions, then rebuild them and link them into your application.  If you went this way, you could follow the cfgdemo example approach and just use the configuration to create the heartbeat for you and link in the (rebuilt) libraries.  This could be a better alternative.

    Steve

  • Hi Steve,

     

      I brought in the cfgdemo software and everything seems to be running fine.  I did not create the heart beat clock and things still seem fine.  What does the heartbeat clock do?  Can I find an example of the heartbeat clock if I call var Global = xdc.useModule('ti.ndk.config.Global'); in the cfg file and look at "ti_ndk_config_global_stackThread()"

    Will

  • Hi Steve,

      1 other question, is there an easy way to put all the NDK stack code, data, etc into DDR.  For our application the NDK is for debugging only.  When not in debug mode, our code runs out of internal memory.  I want the ability to be able to have a debug mode which enables the xmc on the 6748 which allows access to the NDK stack.  Do I have to use pragmas for every file and then rebuild the library?

    Will

  • Sorry about all the questions.

    I am looking at

    var Global = xdc.useModule('ti.ndk.config.Global');

     Using this in the .cfg file, how do I set up my own IP address, subnet, gateway etc.  I am able to do this using the cfgdemo, but then I can't easily put the Global variable into DDR.

    Will

  • Will,

    will Resnick said:
    I did not create the heart beat clock and things still seem fine.  What does the heartbeat clock do? 

    You're going to want the heart beat clock.  It will do things like call TcpTimeoutCheck, which does all things related to TCP timeouts (retransmit time, round trip time...).

    will Resnick said:
    Can I find an example of the heartbeat clock if I call var Global = xdc.useModule('ti.ndk.config.Global'); in the cfg file and look at "ti_ndk_config_global_stackThread()"

    Yes.  That function will be in the generated .c file (mentioned in previous post) after you build the app.

    Steve

  • Will,

    will Resnick said:
      1 other question, is there an easy way to put all the NDK stack code, data, etc into DDR.  For our application the NDK is for debugging only.  When not in debug mode, our code runs out of internal memory.  I want the ability to be able to have a debug mode which enables the xmc on the 6748 which allows access to the NDK stack.  Do I have to use pragmas for every file and then rebuild the library?

    You can specify where code and data is placed in the BIOS settings of the *.cfg file.

    For example, to place .text into DDR:

    Program.sectMap[".text"] = "DDR";

    Please see the SYS/BIOS user guide, "Chapter 6 Memory" for more details on placing memory sections.

    By default, I think the client example in the 6748 NSP ("ndk_evm6748_elf_client") has everything running out of DDR.

    Steve

  • will Resnick said:

    I am looking at

    var Global = xdc.useModule('ti.ndk.config.Global');

     Using this in the .cfg file, how do I set up my own IP address, subnet, gateway etc.  I am able to do this using the cfgdemo, but then I can't easily put the Global variable into DDR.

    You should use the Ip module:

    var Ip = xdc.useModule('ti.ndk.config.Ip');

    Ip.address = "192.168.1.22";

    etc.

    Then you can again use the generated *.c file to see the actual NDK run time C configuration code equivalent.

    Steve