Reply by Jacob Christ November 15, 20022002-11-15
Wim,

I tried it, it doesn't work, although the maunal says that the ALIGN
command will align to the byte, it only aligns to the word.

Borland C++ Builder has a compiler pragma to do this, but I could
find no such pragma in my Metorwerk DSP Compiler manual. Might be a
good feature in the future, I'm not out of space (yet) so I can wait
but you might start contacting MW.

Jacob
www.pontech.com
Motorola DSP Developemt Tools

--- In motoroladsp@y..., "Jacob Christ" <jacob@p...> wrote:
> It appears that you can change the alingment boundary in the linker
> by using the . = ALIGN(bytes) command. This would require that you
> create a special section for you compressed strings,
> say .compressed_strings. It looks like that you will then need to
> have a seprate file just for your constant data that can be
assigned
> in the linker file to the .compressed_strings section.
>
> If I have time later today I'll try it out myself.
>
> Jacob Christ
> www.pontech.com
> Motorola DSP Developemt Tools
>
> --- In motoroladsp@y..., Wim de Haan <w.d.haan@e...> wrote:
> > Hello,
> >
> > I'm looking for a method to store 2 characters in 1 word, because
I
> have not
> > enough data flash memory.
> >
> > Normally you use:
> > char *line1={"AaBbCc"}; // 1 character in 1 word
> >
> > This is possible:
> > struct bytes {
> > unsigned low_byte: 8;
> > unsigned high_byte: 8;} ;
> > struct bytes line2[3]={'A','a','B','b','C','c'};// 2 characters
in
> 1 word
> >
> > However this makes text not so well legible and time consuming to
> program.
> > Does somebody have a solution to store "AaBbCc" with 2 characters
> in 1 word?
> >
> > Thanks in advance!
> >
> >
> > Wim de Haan
> >
> >
> > Exendis B.V.
> > W.J. de Haan
> > P.O.box 56, 6710 BB Ede
> > Keesomstraat 4, 6716 AB Ede
> > The Netherlands.
> > Tel: +31-(0)318 - 676305
> > mailto:w.d.haan@e...
> > URL: http://www.exendis.com




Reply by Jacob Christ November 14, 20022002-11-14
It appears that you can change the alingment boundary in the linker
by using the . = ALIGN(bytes) command. This would require that you
create a special section for you compressed strings,
say .compressed_strings. It looks like that you will then need to
have a seprate file just for your constant data that can be assigned
in the linker file to the .compressed_strings section.

If I have time later today I'll try it out myself.

Jacob Christ
www.pontech.com
Motorola DSP Developemt Tools

--- In motoroladsp@y..., Wim de Haan <w.d.haan@e...> wrote:
> Hello,
>
> I'm looking for a method to store 2 characters in 1 word, because I
have not
> enough data flash memory.
>
> Normally you use:
> char *line1={"AaBbCc"}; // 1 character in 1 word
>
> This is possible:
> struct bytes {
> unsigned low_byte: 8;
> unsigned high_byte: 8;} ;
> struct bytes line2[3]={'A','a','B','b','C','c'};// 2 characters in
1 word
>
> However this makes text not so well legible and time consuming to
program.
> Does somebody have a solution to store "AaBbCc" with 2 characters
in 1 word?
>
> Thanks in advance! > Wim de Haan > Exendis B.V.
> W.J. de Haan
> P.O.box 56, 6710 BB Ede
> Keesomstraat 4, 6716 AB Ede
> The Netherlands.
> Tel: +31-(0)318 - 676305
> mailto:w.d.haan@e...
> URL: http://www.exendis.com





Reply by Simon Lightbody November 14, 20022002-11-14
I think you can go 'Aa' (Ie., use single quotes around two characters)

-----Original Message-----
From: Wim de Haan [mailto:]
Sent: Thursday, November 14, 2002 7:47 AM
To:
Subject: [motoroladsp] Compressed characters for Metrowerks Codewarrior
for DSP56F807 Hello,

I'm looking for a method to store 2 characters in 1 word, because I have not
enough data flash memory.

Normally you use:
char *line1={"AaBbCc"}; // 1 character in 1 word

This is possible:
struct bytes {
unsigned low_byte: 8;
unsigned high_byte: 8;} ;
struct bytes line2[3]={'A','a','B','b','C','c'};// 2 characters in 1 word

However this makes text not so well legible and time consuming to program.
Does somebody have a solution to store "AaBbCc" with 2 characters in 1 word?

Thanks in advance! Wim de Haan Exendis B.V.
W.J. de Haan
P.O.box 56, 6710 BB Ede
Keesomstraat 4, 6716 AB Ede
The Netherlands.
Tel: +31-(0)318 - 676305
mailto:
URL: http://www.exendis.com _____________________________________
Note: If you do a simple "reply" with your email client, only the author of this
message will receive your answer. You need to do a "reply all" if you want your
answer to be distributed to the entire group.

_____________________________________
About this discussion group:

To Join:

To Post:

To Leave:

Archives: http://www.yahoogroups.com/group/motoroladsp

More Groups: http://www.dsprelated.com/groups.php3 ">http://docs.yahoo.com/info/terms/


Reply by Art Johnson November 14, 20022002-11-14
You can use either of the assembler directives 'DCB' or 'DCBR' (note that 'DCBR'
only applies to the 56800E processor). This will do what you want, but you
should be aware that the standard C library functions like strcpy(), strlen(),
strcat(), strcmp(), etc. will NOT work with these "packed" strings. If you want
to have functions that perform these operations, you will have to write them
yourself in assembler. Here is the section about the assembler directive 'DCB' from the CodeWarrior
on-line manual:

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

DCB

Define constant byte.

[label] DCB arg[,arg,...,arg]

Remarks
The DCB directive allocates and initializes a byte of memory for each arg
argument. The arg may be a byte integer constant, a single- or
multiple-character string constant, a symbol, or a byte expression. The DCB
directive may have one or more arguments separated by commas. Multiple arguments
are stored in successive byte locations. If multiple arguments are present, one
or more of them can be null (two adjacent commas), in which case the
corresponding byte location will be filled with zeros.

If label is present, it will be assigned the value of the runtime location
counter at the start of the directive processing.

Integer arguments are stored as is, but must be byte values (e.g. within the
range 0-255); floating-point numbers are not allowed. Single- and
multiple-character strings are handled in the following manner:

Single-character strings are stored in a word whose lower seven bits represent
the ASCII value of the character.
Multiple-character strings represent words whose bytes are composed of
concatenated sequences of the ASCII representation of the characters in the
string (unless the NOPS option is specified; see the OPT directive). If the
number of characters is not an even multiple of the number of bytes per DSP
word, then the last word will have the remaining characters left-aligned and the
rest of the word will be zero-filled. If the NOPS option is given, each
character in the string is stored in a word whose lower seven bits represent the
ASCII value of the character.
Example
TABLE DCB 'two',0,'strings',0
CHARS DCB 'A','B','C','D'

------------------------------- Here is the section about the assembler directive 'DCBR' from the CodeWarrior
on-line manual:

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

DCBR

Define constant with byte-order flip.

DCBR expression

Remarks
The DCBR directive is useful for defining byte strings with byte-order flip. The
byte-order flip allows C code to properly address the byte strings. This
directive applies to the 56800E processor.

------------------------------- I hope this information is helpful for you.

Regards,

Art Johnson
Senior Systems Analyst
PMC Prime Mover Controls Inc.
3600 Gilmore Way
Burnaby, B.C., Canada
V5G 4R8
Phone: 604 433-4644
FAX: 604 433-5570
Email:
http://www.pmc-controls.com
-----Original Message-----
From: Wim de Haan [mailto:]
Sent: Thursday, November 14, 2002 7:47 AM
To:
Subject: Compressed characters for Metrowerks Codewarrior for DSP56F807 Hello,

I'm looking for a method to store 2 characters in 1 word, because I have not
enough data flash memory.

Normally you use:
char *line1={"AaBbCc"}; // 1 character in 1 word

This is possible:
struct bytes {
unsigned low_byte: 8;
unsigned high_byte: 8;} ;
struct bytes line2[3]={'A','a','B','b','C','c'};// 2 characters in 1 word

However this makes text not so well legible and time consuming to program.
Does somebody have a solution to store "AaBbCc" with 2 characters in 1 word?

Thanks in advance! Wim de Haan Exendis B.V.
W.J. de Haan
P.O.box 56, 6710 BB Ede
Keesomstraat 4, 6716 AB Ede
The Netherlands.
Tel: +31-(0)318 - 676305
mailto:
URL: http://www.exendis.com



Reply by Wim de Haan November 14, 20022002-11-14
Hello,

I'm looking for a method to store 2 characters in 1 word, because I have not
enough data flash memory.

Normally you use:
char *line1={"AaBbCc"}; // 1 character in 1 word

This is possible:
struct bytes {
unsigned low_byte: 8;
unsigned high_byte: 8;} ;
struct bytes line2[3]={'A','a','B','b','C','c'};// 2 characters in 1 word

However this makes text not so well legible and time consuming to program.
Does somebody have a solution to store "AaBbCc" with 2 characters in 1 word?

Thanks in advance! Wim de Haan Exendis B.V.
W.J. de Haan
P.O.box 56, 6710 BB Ede
Keesomstraat 4, 6716 AB Ede
The Netherlands.
Tel: +31-(0)318 - 676305
mailto:
URL: http://www.exendis.com