Forums

Code size problem on TigerSHARC

Started by Carlos March 10, 2004
Hi,
I've been asked to look at a problem where developed DSP code will not fit
on the target (TigerSharcs, i.e. TS101). What are my options:

1. Rewrite code!! (Not an option I believe)
2. Use memory overlays. OK, I've seen ADI's docs on this.  The concept
sounds simple, but the examples look "scary". All their examples are in
assembler, which I'm not too au fait with.  Can you do this in C using
VisualDSP?  Any hints, tips or experiences?
3. Other options?

Cheers,
Carlos


A simple option, which may have already been tried, is to turn on
Optimization.
Another option on the same lines is to check the code for ineffciencies in
matching the code to the compiler (I believe there are examples on ADI's web
site that illustrate this) and then turn on optimization again. Typically,
'optimization' is expected to get a speed boost - in most cases you gain a
little in code size as well.

Cheers
Bhaskar

"Carlos" <carlos.sarno_REMOVE@baesystems.com> wrote in message
news:404f76fc$1@baen1673807.greenlnk.net...
> Hi, > I've been asked to look at a problem where developed DSP code will not fit > on the target (TigerSharcs, i.e. TS101). What are my options: > > 1. Rewrite code!! (Not an option I believe) > 2. Use memory overlays. OK, I've seen ADI's docs on this. The concept > sounds simple, but the examples look "scary". All their examples are in > assembler, which I'm not too au fait with. Can you do this in C using > VisualDSP? Any hints, tips or experiences? > 3. Other options? > > Cheers, > Carlos > >
Hi Carlos, 

did you check the libraries which are included.
Can you avoid using some of them. 

Especially the float library for double precision math costs a lot. 
Changing double math to float math might help if this is an option.

If you use VisualDSP and maybe VDK, check the kernel page:
There's an instrumentation feature which eats away lots of memory,
and which can be switched off without effect on the user code.

Bernhard
Bernhard Holzmayer wrote:
> Hi Carlos, > > did you check the libraries which are included. > Can you avoid using some of them. >
I haven't started on this job yet (next week) so I don't know the answer. All I know at the mo is that the boards are made by Transtec and Transtec libraries are used and (I presume) ADI libraries too. The code is something like 3k words too big for the Sharcs (which have 64k words of memory) and is likely to increase.
> > Especially the float library for double precision math costs a lot. > Changing double math to float math might help if this is an option. >
Something to check, ta.
> If you use VisualDSP and maybe VDK, check the kernel page: > There's an instrumentation feature which eats away lots of memory, > and which can be switched off without effect on the user code. >
Where do I find this kernel page? The instrumentation feature is a compiler option I guess? Cheers, Carlos
Carlos,

You can map non time-critical functions to external SDRAM memory and execute
them directly from the SDRAM. Also, take a look at your data structures.
Perhaps you can move some of the data to SDRAM too and either access it
directly or DMA portions of it to internal memory as needed. This may free
some internal memory space for your program.

Regards,
-- Georgi

"Carlos" <carlos.sarno_REMOVE@baesystems.com> wrote in message
news:404f76fc$1@baen1673807.greenlnk.net...
> Hi, > I've been asked to look at a problem where developed DSP code will not fit > on the target (TigerSharcs, i.e. TS101). What are my options: > > 1. Rewrite code!! (Not an option I believe) > 2. Use memory overlays. OK, I've seen ADI's docs on this. The concept > sounds simple, but the examples look "scary". All their examples are in > assembler, which I'm not too au fait with. Can you do this in C using > VisualDSP? Any hints, tips or experiences? > 3. Other options? > > Cheers, > Carlos > >
Carlos wrote:

> Bernhard Holzmayer wrote:
...
>> If you use VisualDSP and maybe VDK, check the kernel page: >> There's an instrumentation feature which eats away lots of >> memory, and which can be switched off without effect on the user >> code. >> > > Where do I find this kernel page? The instrumentation feature is > a compiler option I guess? > > Cheers, > Carlos
VDK is the RTOS which is provided thru VisualDSP++. If you launch a new project and include VDK when you're asked by the template wizard, you'll find a tab in the project window. The entries which are listed there, are a visual representation of the files VDK.h and VDK.cpp which the wizard provides. If your project has no VDK support, there's no such instrumentation feature. If you use VDK, it's a very useful means to watch threads and their control mechanisms like semaphores, eventbits etc. Bernhard
Georgi Beloev wrote:
> Carlos, > > You can map non time-critical functions to external SDRAM memory and > execute them directly from the SDRAM.
Is this just a simple case of modifying the linker Definition File to define segments in SDRAM for containing the application code, e.g.: MEMORY { ... .. MyCode {Type(RAM) START(0x05000000) END(0x059FFFFF) WIDTH(32) } MyData {Type(RAM) START(0x05A00000) END(0x05FFFFFF) WIDTH(32) } } PROCESSOR p0 { OUTPUT( $COMMAND_LINE_OUTPUT_FILE) SECTIONS { ... ... mycode { INPUT_SECTIONS( $COMMAND_LINE_OBJECTS(program)) } >MyCode mydata { INPUT_SECTIONS( $COMMAND_LINE_OBJECTS(data1)) } >MyData etc... } } Cheers, Carlos
"Carlos" <carlos.sarno_REMOVE@baesystems.com> wrote in message
news:40573278$1@baen1673807.greenlnk.net...
> Georgi Beloev wrote: > > Carlos, > > > > You can map non time-critical functions to external SDRAM memory and > > execute them directly from the SDRAM. > > Is this just a simple case of modifying the linker Definition File to
define
> segments in SDRAM for containing the application code, e.g.:
Yes, and you can also define your own sections, e.g., "sdram_program". Then you use the section() and .SECTION placement keywords in your C and assembly files to specify which functions should go to the SDRAM section. You also need corresponding section mapping in the LDF file. Regards, -- Georgi
> > MEMORY > { > ... > .. > MyCode {Type(RAM) START(0x05000000) END(0x059FFFFF) WIDTH(32) } > MyData {Type(RAM) START(0x05A00000) END(0x05FFFFFF) WIDTH(32) } > } > > PROCESSOR p0 > { > OUTPUT( $COMMAND_LINE_OUTPUT_FILE) > > SECTIONS > { > ... > ... > mycode > { > INPUT_SECTIONS( $COMMAND_LINE_OBJECTS(program)) > } >MyCode > > mydata > { > INPUT_SECTIONS( $COMMAND_LINE_OBJECTS(data1)) > } >MyData > > etc... > } > } > > Cheers, > Carlos > > >