Sign in

username:

password:



Not a member?

Search motoroladsp



Search tips

Subscribe to motoroladsp



motoroladsp by Keywords

56303 | 563xx | 5680 | 56805 | 5680x | 56F80 | 56F800DEMO | 56F805 | 56f807 | 56F830 | ADC | Bootloader | Codec | CodeWarrior | CW5 | CW6 | Debugger | DSP56303 | DSP56303EVM | DSP563xx | DSP5680 | DSP56800 | DSP56807 | DSP56858 | DSP56858EVM | DSP56F803 | DSP56F805 | DSP56F807 | DSP56F80x | DSP56F826 | DSP56F827 | DSP56F8xx | EVM | FFT | Flash_over_jtag | GPIO | Interrupt | Interrupts | JTAG | LCD | Linker | MCF5307 | Metrowerks | Modulus | MSCAN | PCMaster | PWM | Quad | Rif | RTOS | SDK | SPI

Discussion Groups

Discussion Groups | Freescale DSPs | Re: strings in p-ROM for 56F8300/E

Technical discussions about Freescale (Motorola) DSPs (including the DSP56000, DSP56300, DSP56600, 56800 DSPs).

  

Post a new Thread

strings in p-ROM for 56F8300/E - ra - Sep 22 6:49:00 2004



Hello again

The previously posted advice works fine for non-string data, and by
defining a separate linker section one can place constants in P-ROM:

in the C source file, define the section and open it:

> #pragma define_section mysection ".mysection.text" RX
>
> #pragma section mysection begin

> const int SomeIntegers[] = {0,1,5,3}

> #pragma section mysection end

And in the linker command file add that section to the p-code:

> * (.mysection.text) But when I try this with strings, only their pointers go into p-rom,
and the string space itself still gets placed in the data.char section
in data flash.

I.e., putting this between the "mysection" pragmas,
> const char * ErrorMessages [] =
> {
> "Welcome to Wind Genie DSP",
> "TRBLE MODE ERR",
> "DATA ERROR",
> "DATA CORRUPTED",
> "DISPLAY ERROR",
> "MEMORY ERROR",
> "INVALID PARAMETER"
> };

only a seven-word array "ErrorMessages" with pointers to the strings
goes into p-rom, whereas the data.char still goes into data-rom.

Is there any trick to move the strings into p-rom, too?

This is for a 56F8346 processor, which doesn't use the "rodata"
described in app note AN1952.

Many thanks in advance for advice!
Robert Imhoff





(You need to be a member of motoroladsp -- send a blank email to motoroladsp-subscribe@yahoogroups.com )

Re: strings in p-ROM for 56F8300/E - H. Stuart Brooks - Sep 22 14:00:00 2004

You also need to declare the data as constants

const char * const ErrorMessages[] = {"Error string 1", "Error string 2",
..., "Error string N"}

----- Original Message -----
From: "ra" <>
To: <>
Sent: Wednesday, September 22, 2004 2:49 AM
Subject: [motoroladsp] strings in p-ROM for 56F8300/E > Hello again
>
> The previously posted advice works fine for non-string data, and by
> defining a separate linker section one can place constants in P-ROM:
>
> in the C source file, define the section and open it:
>
>> #pragma define_section mysection ".mysection.text" RX
>>
>> #pragma section mysection begin
>
>> const int SomeIntegers[] = {0,1,5,3}
>
>> #pragma section mysection end
>
> And in the linker command file add that section to the p-code:
>
>> * (.mysection.text) > But when I try this with strings, only their pointers go into p-rom,
> and the string space itself still gets placed in the data.char section
> in data flash.
>
> I.e., putting this between the "mysection" pragmas,
>> const char * ErrorMessages [] =
>> {
>> "Welcome to Wind Genie DSP",
>> "TRBLE MODE ERR",
>> "DATA ERROR",
>> "DATA CORRUPTED",
>> "DISPLAY ERROR",
>> "MEMORY ERROR",
>> "INVALID PARAMETER"
>> };
>
> only a seven-word array "ErrorMessages" with pointers to the strings
> goes into p-rom, whereas the data.char still goes into data-rom.
>
> Is there any trick to move the strings into p-rom, too?
>
> This is for a 56F8346 processor, which doesn't use the "rodata"
> described in app note AN1952.
>
> Many thanks in advance for advice!
> Robert Imhoff >
>
> _____________________________________
> /groups.php3
>
> Yahoo! Groups Links




(You need to be a member of motoroladsp -- send a blank email to motoroladsp-subscribe@yahoogroups.com )

RE: strings in p-ROM for 56F8300/E - Yochum, William - Sep 22 16:25:00 2004

And if you want to use the PtoX() utilities that I previously emailed to this list, you'll also want the strcpy_iPtoX().
 
This function is an INDIRECT string copy for ARRAYS of STRINGS in P-memory, where both the pointer and the string data are both stored in P-memory.
 
void test( void )
{
    char    str[30];
 
    strcpy_iPtoX( str, &ErrorMessages[2] );
    ...
 
}
 
Regards,

William C. Yochum               Microwave Data Systems Inc.
Principal Eng./Software         175 Science Parkway
Phone: (585) 242-8319           Rochester, NY 14620
FAX:   (585) 241-5590           USA

 
 
-----Original Message-----
From: H. Stuart Brooks [mailto:s...@str-inc.com]
Sent: Wednesday, September 22, 2004 10:00 AM
To: m...@yahoogroups.com; ra
Subject: Re: [motoroladsp] strings in p-ROM for 56F8300/E

You also need to declare the data as constants

const char * const ErrorMessages[] = {"Error string 1", "Error string 2",
..., "Error string N"}

----- Original Message -----
From: "ra" <r...@gmx.net>
To: <m...@yahoogroups.com>
Sent: Wednesday, September 22, 2004 2:49 AM
Subject: [motoroladsp] strings in p-ROM for 56F8300/E> Hello again
>
> The previously posted advice works fine for non-string data, and by
> defining a separate linker section one can place constants in P-ROM:
>
> in the C source file, define the section and open it:
>
>> #pragma define_section mysection ".mysection.text" RX
>>
>> #pragma section mysection begin
>
>> const int SomeIntegers[] = {0,1,5,3}
>
>> #pragma section mysection end
>
> And in the linker command file add that section to the p-code:
>
>>               * (.mysection.text)> But when I try this with strings, only their pointers go into p-rom,
> and the string space itself still gets placed in the data.char section
> in data flash.
>
> I.e., putting this between the "mysection" pragmas,
>> const char * ErrorMessages [] =
>>     {
>>         "Welcome to Wind Genie DSP",
>>         "TRBLE MODE ERR",
>>         "DATA ERROR",
>>         "DATA CORRUPTED",
>>         "DISPLAY ERROR",
>>         "MEMORY ERROR",
>>         "INVALID PARAMETER"
>>     };
>
> only a seven-word array "ErrorMessages" with pointers to the strings
> goes into p-rom, whereas the data.char still goes into data-rom.
>
> Is there any trick to move the strings into p-rom, too?
>
> This is for a 56F8346 processor, which doesn't use the "rodata"
> described in app note AN1952.
>
> Many thanks in advance for advice!
> Robert Imhoff>
>
> _____________________________________
> /groups.php3
>
> Yahoo! Groups Links



_____________________________________
/groups.php3


// src = pointer to source char in P memory
// dst = pointer to destination char in X memory
asm void PtoX(char* dst, char* src)
{
//dst is in r2
//src is in r3
move P:(r3)+,r3
move r3,X:(r2)+
rts
}

// src = pointer to source string in P memory
// dst = pointer to destination string in X memory
void strcpyPtoX(char* dst, char* src)
{
do {
PtoX( (void *)dst, (void *)src);
src++;
} while (*dst++ != '\0');
}

// src = pointer to pointer to source string in P memory
// dst = pointer to destination string in X memory
//
// This function is useful for referencing ARRAYS of strings
// stored in Program Memory. It first copies obtains the pointer
// to the desired string, then copies the string itself.
//
void strcpy_iPtoX(char* dst, char** src)
{
char * tmp_ptr;

PtoX( (void *)&tmp_ptr, (void *)src );
strcpyPtoX( dst, tmp_ptr );
}




(You need to be a member of motoroladsp -- send a blank email to motoroladsp-subscribe@yahoogroups.com )