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.

Dynamic Linking Application on TMS570LS3137 with FreeRTOS

Other Parts Discussed in Thread: TMS570LS3137

We have a requirement the Firmware is divided in two parts, consisting of 1. Application and 2. Driver and FreeRTOS Kernel.

These two parts need to be created as a separate binary files from independent CCS projects and flashed in separate memory sections.

Application section of memory can be updated later on through a Bootloader.

As i understand, this may require Dynamically linking of application binary with the Driver/Kernal Binary.

Also FreeRTOS inherently does not support such a mechanism of loading applications.

What can be the best approach for the above problem statement ?

We need to achieve this on TMS570LS3137.

  • I will pass this question to people who are more familiar with FreeRTOS. I think that you can always define function pointer and dynamically assign value.

    Thanks and regards,

    Zhaohong
  • Thank you Zhaohong for prompt reply,

    I will elaborate more on what challenges I may face.

    1.There would be quite a few API's/Function calls that application will require from the Middle Ware, Driver and RTOS service layer. 

    2. There would some TASK creation information (such as Task Structure)  that RTOS may require from Application.

    3. There would few functions which will be independent of other section.

    As I have already noted, The RTOS/Middleware/Driver project will be compiled without any knowledge of the actual implementation of application.

    For the application project, I may be able to provide the Linking information for the RTOS/Middleware/Driver layer, although I have to figure out how exactly I will be doing it.

    The whole idea of this exercise is to provide a common software platform, with a customized application, to change functionality only Application binary needs to be reflashed.

    I am trying to define the exact workflow to achieve this target.

  • One of the solution I can think of to my problem is Creating a Jump table at a fixed location.
    and providing reference to that for API/Functions that would be shared.

    Any inputs on Jump tables? or any other method to achieve the required functionality ?
  • Since the dynamically linked functions are compiled separately from the system, you cannot have have any global variable in those functions. You need to make three data groups: input data, output data, constants/intermediate variables so that they can be accessed by pointers. Stack will be automatically handled by the system. In your linking table, you will need to have the following: address of the function, address of the input data, address of the output data, and address of the constants/intermediate variable used by the function. In your functions, you can defined those data pointers as register pointers (for example, register int *ptr) for more efficient execution.

    For the processing time with external memory, my estimation is that execution from EMIF take at least 5 times more time compared to the execution from internal Flash/RAM.

    Thanks and regards,

    Zhaohong
  • Thanks Zhaohong for your inputs,

    I was also thinking on similar lines, where I cannot use Global Variables.
    May be I can use RTOS provided mechanism such as Queues and buffers for interaction with other parts.

    I have not been able to figure out what happens to C initialization routine in startup for application project.
    As far as i understand that code is used to initialize any RAM variables as required by the application,
    But my implementation will have entry point in Platform code which will spawn tasks for various platform related functionality beside one for application.


    My platform code structure would be as follows

    void __cinit00_(void)
    {
    ...
    __ti_cinit();
    ...
    ...
    main();
    }


    void main(void)
    {
    ...
    ...
    ...

    initApplication(); // this function is from Application Binary

    ..
    ..

    CreateThread(Platformthread1);
    ...
    ...
    CreateThread(Platformthreadn);

    CreateThread(ApplicationThread);//Thread Function will be from Application Binary
    ...
    ...

    StartRTOSScheduler();
    }

    I am now trying to figure out how my application project will be created in CCS?
  • C initialization only initializes global variables that require an default value. If you application is dynamically linked, you can build then as "library".

    Thanks and regards,

    Zhaohong