From: mallu.... on
I am using the TMS320F2812 , DSP and when i run my program from the RAM
it works well , however when i try to port it in the Flash it runs out
of space as .text is referenced to FLASH A in the F2812.cmd file (as
attached).The error is as mentioned in the compilation report.txt
file.My error report excerpt
=================================================
[Timer0_ISR.c] "J:\TI\C2000\cgtools\bin\cl2000" -g -q -pdr -fr"./Debug"
-fs"./Debug" -i"../../DSP281x_headers/include"
-i"../../DSP281x_headers/cmd" -i"../../DSP281x_common/include"
-i"./include" -d"_DEBUG" -d"LARGE_MODEL" -ml -mt -v28 -@"Debug.lkf"
"Timer0_ISR.c"

[Linking...] "J:\TI\C2000\cgtools\bin\cl2000" -@"Debug.lkf"
<Linking>
>> error: can't allocate .text, size 00001ff2 (page 0) in FLASHA (avail:
00001f80)
>> error: errors in input - ./Debug/Example_281xFlash.out not built

>> Compilation failure
======================================================
TO address this issue...
Do i have to reduce my size of the text file to fit in the constraints
of FLASHA or
can i reference another FLASH having larger length ?I tired using
FLASHE but it gave me errors that some portion could not be written.

=========================================== excerpt from F2812.cmd
/* Allocate program areas: */
.cinit : > FLASHD PAGE = 0
.pinit : > FLASHA, PAGE = 0
.text : > FLASHA PAGE = 0 ( can we modify here
???)
codestart : > BEGIN PAGE = 0
ramfuncs : LOAD = FLASHD,
=============================================
Kindly revert with your valuable suggestions ...

From: "William C Bonner wbonner@wimsworld.com>" on
While I don't know the answer, I'm interested in details of how to run
a program from flash, or be able to simply leave the cinit section on
the flash.

My guess is that you are running into an issue where the program loader
is trying to initialize the .text section at load time, but since it's
in flash it can't be written to in the same way ram can be written to.

If I have large arrays of data that need to be available occasionally,
it seems to me that I might want them to be left in the flash ram,
instead of loaded at boot time into either the DSP ram, or the external
static ram that I've got. My current build sequence has me build a
linker command file, compile the program into a .out file, and then run
a hex converter to create a hex file that then is loaded into the
flash. I know that the linker command file specifies what regions of
memory things are laid out in, and I'm currently not using flash in the
linker command file. The hex converter specifies a starting location
in flash. Then the bios boot loader starts from that location in
flash. I'm currently using flash like a file system, but I believe
that I should be able to address it for reading like it was ram.

mallu.... wrote:
> I am using the TMS320F2812 , DSP and when i run my program from the RAM
> it works well , however when i try to port it in the Flash it runs out
> of space as .text is referenced to FLASH A in the F2812.cmd file (as
> attached).The error is as mentioned in the compilation report.txt
> file.My error report excerpt
> =================================================
> [Timer0_ISR.c] "J:\TI\C2000\cgtools\bin\cl2000" -g -q -pdr -fr"./Debug"
> -fs"./Debug" -i"../../DSP281x_headers/include"
> -i"../../DSP281x_headers/cmd" -i"../../DSP281x_common/include"
> -i"./include" -d"_DEBUG" -d"LARGE_MODEL" -ml -mt -v28 -@"Debug.lkf"
> "Timer0_ISR.c"
>
> [Linking...] "J:\TI\C2000\cgtools\bin\cl2000" -@"Debug.lkf"
> <Linking>
> >> error: can't allocate .text, size 00001ff2 (page 0) in FLASHA (avail:
> 00001f80)
> >> error: errors in input - ./Debug/Example_281xFlash.out not built
>
> >> Compilation failure
> ======================================================
> TO address this issue...
> Do i have to reduce my size of the text file to fit in the constraints
> of FLASHA or
> can i reference another FLASH having larger length ?I tired using
> FLASHE but it gave me errors that some portion could not be written.
>
> =========================================== excerpt from F2812.cmd
> /* Allocate program areas: */
> .cinit : > FLASHD PAGE = 0
> .pinit : > FLASHA, PAGE = 0
> .text : > FLASHA PAGE = 0 ( can we modify here
> ???)
> codestart : > BEGIN PAGE = 0
> ramfuncs : LOAD = FLASHD,
> =============================================
> Kindly revert with your valuable suggestions ...

From: adrian on
hi,

you try to place 0x1ff2 words (page 0) in FLASHA but 0x1f80 words are
avalaible!


mallu.... wrote:
> I am using the TMS320F2812 , DSP and when i run my program from the RAM
> it works well , however when i try to port it in the Flash it runs out
> of space as .text is referenced to FLASH A in the F2812.cmd file (as
> attached).The error is as mentioned in the compilation report.txt
> file.My error report excerpt
> =================================================
> [Timer0_ISR.c] "J:\TI\C2000\cgtools\bin\cl2000" -g -q -pdr -fr"./Debug"
> -fs"./Debug" -i"../../DSP281x_headers/include"
> -i"../../DSP281x_headers/cmd" -i"../../DSP281x_common/include"
> -i"./include" -d"_DEBUG" -d"LARGE_MODEL" -ml -mt -v28 -@"Debug.lkf"
> "Timer0_ISR.c"
>
> [Linking...] "J:\TI\C2000\cgtools\bin\cl2000" -@"Debug.lkf"
> <Linking>
> >> error: can't allocate .text, size 00001ff2 (page 0) in FLASHA (avail:
> 00001f80)
> >> error: errors in input - ./Debug/Example_281xFlash.out not built
>
> >> Compilation failure
> ======================================================
> TO address this issue...
> Do i have to reduce my size of the text file to fit in the constraints
> of FLASHA or
> can i reference another FLASH having larger length ?I tired using
> FLASHE but it gave me errors that some portion could not be written.
>
> =========================================== excerpt from F2812.cmd
> /* Allocate program areas: */
> .cinit : > FLASHD PAGE = 0
> .pinit : > FLASHA, PAGE = 0
> .text : > FLASHA PAGE = 0 ( can we modify here
> ???)
> codestart : > BEGIN PAGE = 0
> ramfuncs : LOAD = FLASHD,
> =============================================
> Kindly revert with your valuable suggestions ...

From: Brad Griffis on
mallu.... wrote:
> I am using the TMS320F2812 , DSP and when i run my program from the RAM
> it works well , however when i try to port it in the Flash it runs out
> of space as .text is referenced to FLASH A in the F2812.cmd file (as
> attached).The error is as mentioned in the compilation report.txt
> file.My error report excerpt
> =================================================
> [Timer0_ISR.c] "J:\TI\C2000\cgtools\bin\cl2000" -g -q -pdr -fr"./Debug"
> -fs"./Debug" -i"../../DSP281x_headers/include"
> -i"../../DSP281x_headers/cmd" -i"../../DSP281x_common/include"
> -i"./include" -d"_DEBUG" -d"LARGE_MODEL" -ml -mt -v28 -@"Debug.lkf"
> "Timer0_ISR.c"
>
> [Linking...] "J:\TI\C2000\cgtools\bin\cl2000" -@"Debug.lkf"
> <Linking>
>>> error: can't allocate .text, size 00001ff2 (page 0) in FLASHA (avail:
> 00001f80)
>>> error: errors in input - ./Debug/Example_281xFlash.out not built
>
>>> Compilation failure
> ======================================================
> TO address this issue...
> Do i have to reduce my size of the text file to fit in the constraints
> of FLASHA or
> can i reference another FLASH having larger length ?I tired using
> FLASHE but it gave me errors that some portion could not be written.
>
> =========================================== excerpt from F2812.cmd
> /* Allocate program areas: */
> .cinit : > FLASHD PAGE = 0
> .pinit : > FLASHA, PAGE = 0
> .text : > FLASHA PAGE = 0 ( can we modify here
> ???)
> codestart : > BEGIN PAGE = 0
> ramfuncs : LOAD = FLASHD,
> =============================================
> Kindly revert with your valuable suggestions ...
>

I'm assuming that the MEMORY part of the linker command file declares
multiple sectors of flash, i.e. FLASHA, FLASHB, etc. There are several
ways to solve this problem:

1) Decrease the size of your code such that it fits in FLASHA.
2) Rewrite the MEMORY part of the linker command file such that FLASHA
and FLASHB are combined into a bigger memory area, FLASHAB, and then put
..text into FLASHAB.
3) If you're using CCS 3.1 and its corresponding codegen tools you can
use automatic section splitting by changing your .text allocation in the
SECTION part to look like:
..text >> FLASHA | FLASHB PAGE=0

For further information please refer to the section on the linker in the
28x Assembly Language Tools Reference Guide:

http://focus.ti.com/dsp/docs/dspsupporttechdocsc.tsp?sectionId=3&tabId=409&familyId=510&abstractName=spru513b

Brad
From: Brad Griffis on
Brad Griffis wrote:
> mallu.... wrote:
>> I am using the TMS320F2812 , DSP and when i run my program from the RAM
>> it works well , however when i try to port it in the Flash it runs out
>> of space as .text is referenced to FLASH A in the F2812.cmd file (as
>> attached).The error is as mentioned in the compilation report.txt
>> file.My error report excerpt
>> =================================================
>> [Timer0_ISR.c] "J:\TI\C2000\cgtools\bin\cl2000" -g -q -pdr -fr"./Debug"
>> -fs"./Debug" -i"../../DSP281x_headers/include"
>> -i"../../DSP281x_headers/cmd" -i"../../DSP281x_common/include"
>> -i"./include" -d"_DEBUG" -d"LARGE_MODEL" -ml -mt -v28 -@"Debug.lkf"
>> "Timer0_ISR.c"
>>
>> [Linking...] "J:\TI\C2000\cgtools\bin\cl2000" -@"Debug.lkf"
>> <Linking>
>>>> error: can't allocate .text, size 00001ff2 (page 0) in FLASHA (avail:
>> 00001f80)
>>>> error: errors in input - ./Debug/Example_281xFlash.out not built
>>
>>>> Compilation failure
>> ======================================================
>> TO address this issue...
>> Do i have to reduce my size of the text file to fit in the constraints
>> of FLASHA or
>> can i reference another FLASH having larger length ?I tired using
>> FLASHE but it gave me errors that some portion could not be written.
>>
>> =========================================== excerpt from F2812.cmd
>> /* Allocate program areas: */
>> .cinit : > FLASHD PAGE = 0
>> .pinit : > FLASHA, PAGE = 0
>> .text : > FLASHA PAGE = 0 ( can we modify here
>> ???)
>> codestart : > BEGIN PAGE = 0
>> ramfuncs : LOAD = FLASHD,
>> =============================================
>> Kindly revert with your valuable suggestions ...
>>
>
> I'm assuming that the MEMORY part of the linker command file declares
> multiple sectors of flash, i.e. FLASHA, FLASHB, etc. There are several
> ways to solve this problem:
>
> 1) Decrease the size of your code such that it fits in FLASHA.
> 2) Rewrite the MEMORY part of the linker command file such that FLASHA
> and FLASHB are combined into a bigger memory area, FLASHAB, and then put
> .text into FLASHAB.
> 3) If you're using CCS 3.1 and its corresponding codegen tools you can
> use automatic section splitting by changing your .text allocation in the
> SECTION part to look like:
> .text >> FLASHA | FLASHB PAGE=0
>
> For further information please refer to the section on the linker in the
> 28x Assembly Language Tools Reference Guide:
>
> http://focus.ti.com/dsp/docs/dspsupporttechdocsc.tsp?sectionId=3&tabId=409&familyId=510&abstractName=spru513b
>
>
> Brad

P.S. You should also see the app note Running an Application from
Internal Flash Memory on the TMS320F28xx DSP:

http://focus.ti.com/dsp/docs/dspsupporttechdocsc.tsp?sectionId=3&tabId=409&familyId=510&abstractName=spra958f

It has a lot of good information regarding what things need to be
allocated to flash, what needs to be allocated to RAM, and how to do
run-time relocation of code from flash to RAM.