First go throught this link https://www.pantechsolutions.net/tms320f2812/f2812cmd-vs-ram-lnkcmd.html
as you said that you successfully run the led code in RAM memory of TMS320F2812, to do the same code in flash memory follow the below steps:-
1. First remove the F2812_EzDSP_RAM_lnk.cmd from the project and add the F2812.cmd.
If you installed the Header file setup of TMS320F2812 then you may get the F2812.cmd file at this path C:\tidcs\c28\dsp281x\v100\DSP281x_common\cmd
2. Add additional following source code in the project
To add the machine code for the Flash entry point at address 0x3F 7FF6 we have to add an assembly instruction “LB _c_int00” and to link this instruction exactly to the given physical address. Instead of writing our own assembly code we can make use of another of TI’s predefined functions (“code_start”) which is part of the source code file “DSP218x_CodeStartBranch.asm”.
If you open the file “F2812.cmd” you will see that label “code_start” is linked to
“BEGIN” which is defined at address 0x3F 7FF6 in code memory page 0.
3. The function to speed up the internal Flash (“InitFlash()”) is also available from TI as
part of the source code file “DSP281x_SysCtrl.c”.
4. In main, after the function call “InitSystem()” we have to add code to speed up the
Flash memory. Speed up is done by “InitFlash” function.
The solution can be found in file “DSP281x_SysCtrl.c”. Open it and look at the beginning of this file. You will find a “#pragma CODE_SECTION” – line that defines a dedicated code section “ramfuncs” and connects the function “InitFlash()” to it. Symbol “ramfuncs” is used in file “F2812.cmd” to connect it to physical memory “FLASHD” as load-address and to memory “RAML0” as execution address.
The task of the linker command file “F2812.cmd” is it to provide the physical addresses to the rest of the project. The symbols “LOAD_START”, “LOAD_END” and “RUN_START” are used to define these addresses symbolically as “_RamfuncsLoadStart”, “_RamfuncsLoadEnd” and “_RamfuncsRunStart”.
Add the following line to your code:
memcpy(&RamfuncsRunStart, &RamfuncsLoadStart,&RamfuncsLoadEnd - &RamfuncsLoadStart);
Add a call of function “InitFlash()”, now available in RAML0:
5. At the beginning of c source code declare the symbols used as parameters for memcpy as
extern unsigned int RamfuncsLoadStart;
extern unsigned int RamfuncsLoadEnd;
extern unsigned int RamfuncsRunStart;
6. Rebuild the project.
If build was successful you’ll get:
0 Errors, 0 Warnings, 0 Remarks.
7. Before loading the code, Change the Boot mode to flash memory then power off and on the TMS320F2812 DSC kit.
You can also verify your Linker results in the map file of your project.
Before start the Flash programming its always good practice to verify the used sections of the project. This is done by inspecting the linker output file ‘projectfilename.map’ from subdirectory ..\Debug in the project location.
In ‘MEMORY CONFIGURATION’ column ‘used ‘ you will find the amount of
physical memory that is used by your project.
Verify that only the following four parts of PAGE 0 are used:
RAML0 00008000 00001000 00000016 RWIX
FLASHD 003ec000 00004000 00000016 RWIX
FLASHA 003f6000 00001f80 0000056b RWIX
BEGIN 003f7ff6 00000002 00000002 RWIX
The number of addresses used in FLASHA might be different in your source code.its depending on how efficient your code was programmed by you, you will end up with more or less words in this section.
Verify also that in PAGE1 the memory RAMH0 is not used.
In the SECTION ALLOCATION MAP you can see how the different portions of our projects code files are distributed into the physical memory sections.
the .text-entry shows all the objects that were enated into FLASHA.
Entry ‘codestart’ connects the object ‘CodeStartBranch.obj’ to physical address 0x3F7FF6 and occupies two words.