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.

Compiler/TMS320F28379D: Linker command: 2 EXE can share const data

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Tool/software: TI C/C++ Compiler

Hello, 

I am using TMS320F28379D controller.

Currently i need to figure out if 2 executables are loaded on same core (CPU1) in different Flash memory location how can the constant data be shared from EXE2 to EXE1.

For Eg: EXE2 has a const data stored at memory 08000, the value of this memory should be avaliable in EXE1.

thanks

Nagesh

  • Nagesh,

    You can do that. exe1 copies the data in a section. In the linker command file for exe2, you create a section with type=NOINIT and place the variable in that section.

    /* C code */
    #pragma DATA_SECTION(var, "mysect:var")
    int var;


    /* Linker command file - inside SECTIONS directive */
    mysect:var > MEMORY_RANGE_NAME, type = NOINIT

  • Hello Santosh,

    Thank you for your reply. can you please elaborate how i can use it in exe2.

    If you can share example will be great for example.

    exe2.c : loading the exe in FLASH M

    //creating a const variable to be shared in exe1.c

    #pragma DATA_SECTION(var, "mysect:var")  //what would this be actually

    const int var = 10;

    exe2 loaded in FLASH M := addr := 0xBA000

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

    exe1.c will be loaded in FLASH E

    //want to use var here, what is the format to use here please explain

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

    also linker cmd file how it would look like for both exe1 and exe2

    thanks,

    Nagesh

  • Nagesh,

    In your first program, you will need to use FlashAPI to write the value to the flash. You can refer to C2000ware DriverLib Flash example. Let's say we write the value to FLASH_BANK0_SEC6 

    In the second program, in the linker command file, I added one section like below.

    mysect           : > FLASH_BANK0_SEC6, PAGE = 0, type = NOLOAD

    In the C, Program

    #pragma DATA_SECTION(var, "mysect")
    int var;

    //
    // Main
    //
    void main(void)
    {
        int x;

        x = var;
        while(x--)
        {
            NOP;
        }

    }

  • hello Santosh, 

    Thank you for your detailed explanation i was able to experiment as suggested by you. 

    I have one more clarification i am going to use 2 exe with Motorola S-record format for loading with exe1 (S2) and exe2 (S2).

    Exe2 will have only constants which will be used in Exe1 both executable will be in format exe1.s2 and exe2.s2

    I understood how to use it in exe1.s2 which i will load in FLASH E sector.

    In Exe2 executable should i call Flash api functions to store the required constant values or is there any method i can directly load the required constants in FLASH M sector

    Thanks,

    Nagesh

  • Nagesh,

    NAGESH RK said:
    In Exe2 executable should i call Flash api functions to store the required constant values or is there any method i can directly load the required constants in FLASH M sector

    Yes, you will need to use Flash API to store the constant values to the flash.

  • hello Santosh, 

    i tried to search for example code where flash Api is used to write into specific memory location, but was not successful in C2000 ware

    I got only a flash.c file in '\C2000Ware_2_01_00_00_Software\driverlib\f2837xd\driverlib' which has only Flash init module. 

    Can you share me some code if possible so that i can write constants in FLASH sector K  address (0xB8000)

    thanks,

    Nagesh

  • Nagesh,

    There are some examples which explains Flash API use at:

    C:\ti\C2000\C2000Ware_2_01_00_00\driverlib\f28004x\examples\flash

  • Santosh,

    Can i use 'f28004x' example in F28379D controller .

    Thanks,

    Nagesh

  • Nagesh,

    Flash API should be similar for both devices. Please refer to 

    C:\ti\C2000\C2000Ware_2_01_00_00\libraries\flash_api\f2837xd\docs for exact API's available for the device.

  • Nagesh,

    I see you created another thread on "write constants in FLASH sector K  address (0xB8000)". I will close this thread here.