EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

pragma directives on Codewarrior

Started by cmth2004 January 26, 2004
Hi

Basically, I am exploring the possibility of using pragma directives
to regulate compile-time warning messages. The Codewarrior C-compiler
reference manual clearly lists several pragma directives which would
allow me to do this.

However, most of these pragma directives are not being recognised by
the CW IDE.

Any help in this regard would be much appreciated.

Regards,
Chamath.



The XIRQ pin is shared with PE0. We don't clear the X bit and want to
use it as a input pin (read Port E and mask off all bits except PE0).
Is anyone aware of any problems with doing this? Rod Niner
GSE Scales
42860 Nine Mile Road
Novi, MI 48375-4122
ph: 248.596.3350 The information contained in this electronic mail transmission is intended
by SPX Corporation for the use of the named individual or entity to which
it is directed and may contain information that is confidential or
privileged. If you have received this electronic mail transmission in
error, please delete it from your system without copying or forwarding it,
and notify the sender of the error by reply email so that the sender's
address records can be corrected.



Hi
I have used #pragmas extensively in my project and
all the directives are recognised by CW IDE.
The rule is if used a pragma with a name, that name
must be defined in the linker file (linker.prm). Just
check this out. I guess you have not configured the
linker settings first.

Regards
Bharath
--- cmth2004 <> wrote:
> Hi
>
> Basically, I am exploring the possibility of using
> pragma directives
> to regulate compile-time warning messages. The
> Codewarrior C-compiler
> reference manual clearly lists several pragma
> directives which would
> allow me to do this.
>
> However, most of these pragma directives are not
> being recognised by
> the CW IDE.
>
> Any help in this regard would be much appreciated.
>
> Regards,
> Chamath. >
--------------------To
> learn more about Motorola Microcontrollers, please
> visit
> http://www.motorola.com/mcu
> o learn more about Motorola Microcontrollers, please
> visit
> http://www.motorola.com/mcu >


__________________________________




Hi Bharath

Thanks for the reply.

Just to let you know... I am using CW IDE 5.1 and some of the pragma
directives seem to be working fine. Unfortunately, pragma
suppress_warnings comes-up as illegal during preprocess/compilation.
I believe its to do with the preprocessor/compiler not being able to
recognize the pragma rather than the linker. What do you think ?

Regards
Chamath
--- In , bharath kumar <bharatkumarm@y...>
wrote:
> Hi
> I have used #pragmas extensively in my project and
> all the directives are recognised by CW IDE.
> The rule is if used a pragma with a name, that name
> must be defined in the linker file (linker.prm). Just
> check this out. I guess you have not configured the
> linker settings first.
>
> Regards
> Bharath
> --- cmth2004 <cmth2004@y...> wrote:
> > Hi
> >
> > Basically, I am exploring the possibility of using
> > pragma directives
> > to regulate compile-time warning messages. The
> > Codewarrior C-compiler
> > reference manual clearly lists several pragma
> > directives which would
> > allow me to do this.
> >
> > However, most of these pragma directives are not
> > being recognised by
> > the CW IDE.
> >
> > Any help in this regard would be much appreciated.
> >
> > Regards,
> > Chamath.
> >
> >
> >
> --------------------To
> > learn more about Motorola Microcontrollers, please
> > visit
> > http://www.motorola.com/mcu
> > o learn more about Motorola Microcontrollers, please
> > visit
> > http://www.motorola.com/mcu
> >
> >
> >
> >
> > __________________________________
>



Hi Chamath,

can you more exactly explain what you try, get and expect?
Controlling the messages works like this:

#pragma MESSAGE DISABLE C5702 /*: Local variable declared but not referenced */
void test1(void) {
int i;
}
#pragma MESSAGE WARNING C5702 /*: Local variable declared but not referenced */
void test2(void) {
int i;
} Note the restrictions mentioned in the manual that this message does
not control preprocessor messages like "Warning : C4443: Undefined Macro 'i' is taken as 0".
They can only be disabled in the HC12 Compiler preference panel.

Bye

Daniel

PS: Use the manual named "Manual_Compiler_HC12.pdf" which is delivered with the HC12 and not any Metrowerks generic
"C_Compilers_Reference_X.Y.Z.pdf".

> -----Original Message-----
> From: cmth2004 [mailto:]
> Sent: Monday, January 26, 2004 16:46
> To:
> Subject: [68HC12] pragma directives on Codewarrior > Hi
>
> Basically, I am exploring the possibility of using pragma directives
> to regulate compile-time warning messages. The Codewarrior C-compiler
> reference manual clearly lists several pragma directives which would
> allow me to do this.
>
> However, most of these pragma directives are not being recognised by
> the CW IDE.
>
> Any help in this regard would be much appreciated.
>
> Regards,
> Chamath. > --------------------To learn more about Motorola Microcontrollers, please visit
> http://www.motorola.com/mcu
> o learn more about Motorola Microcontrollers, please visit
> http://www.motorola.com/mcu





Hi Daniel,

Thanks for the reply.
Basically, I need to prevent warning messages during compilation of
certain source files. As an simple example, take a simple CW project
which has two source files src1.c and src2.c with src1.c starting-off
with the following pragma definition

#pragma suppress_warnings on

I imagine this way, all warning messages issued during compilation of
src1.c will be suppressed while src2.c will undergo normal
compilation which means that warning messages will not be suppressed
during compilation of src2.c

Although this is what I intend doing, the compiler does not seem to
recognize the pragma "suppress_warnings". I am issued with the
following message:

Warning : illegal #pragma
src1.c line 4 #pragma suppress_warnings on Thanks & Regards
Chamath --- In , "Daniel Friederich" <dfriederich@m...>
wrote:
> Hi Chamath,
>
> can you more exactly explain what you try, get and expect?
> Controlling the messages works like this:
>
> #pragma MESSAGE DISABLE C5702 /*: Local variable declared but not
referenced */
> void test1(void) {
> int i;
> }
> #pragma MESSAGE WARNING C5702 /*: Local variable declared but not
referenced */
> void test2(void) {
> int i;
> } > Note the restrictions mentioned in the manual that this message does
> not control preprocessor messages like "Warning : C4443: Undefined
Macro 'i' is taken as 0".
> They can only be disabled in the HC12 Compiler preference panel.
>
> Bye
>
> Daniel
>
> PS: Use the manual named "Manual_Compiler_HC12.pdf" which is
delivered with the HC12 and not any Metrowerks generic
> "C_Compilers_Reference_X.Y.Z.pdf".
>
> > -----Original Message-----
> > From: cmth2004 [mailto:cmth2004@y...]
> > Sent: Monday, January 26, 2004 16:46
> > To:
> > Subject: [68HC12] pragma directives on Codewarrior
> >
> >
> > Hi
> >
> > Basically, I am exploring the possibility of using pragma
directives
> > to regulate compile-time warning messages. The Codewarrior C-
compiler
> > reference manual clearly lists several pragma directives which
would
> > allow me to do this.
> >
> > However, most of these pragma directives are not being recognised
by
> > the CW IDE.
> >
> > Any help in this regard would be much appreciated.
> >
> > Regards,
> > Chamath.
> >
> >
> > --------------------To learn
more about Motorola Microcontrollers, please visit
> > http://www.motorola.com/mcu
> > o learn more about Motorola Microcontrollers, please visit
> > http://www.motorola.com/mcu
> >
> >
> >
> >
> >





Hello Chamath,
Have a look into the compiler manual (#pragma MESSAGE), page 389 of
Manual_Compiler_HC12.pdf (located in help\pdf).

Syntax:
"#pragma" "MESSAGE" {("WARNING" | "ERROR" | "INFORMATION" | "DISABLE" |
"DEFAULT") {<CNUM>}}

Example from there:
/* treat C1412: Not a function call, */
/* address of a function, as error */
#pragma MESSAGE ERROR C1412
void f(void);
void main(void) {
f; /* () is missing, but still legal in C */
/* ERROR because of pragma MESSAGE */
}

Erich

> -----Original Message-----
> From: cmth2004 [mailto:]
> Sent: Montag, 26. Januar 2004 16:46
> To:
> Subject: [68HC12] pragma directives on Codewarrior > Hi
>
> Basically, I am exploring the possibility of using pragma directives
> to regulate compile-time warning messages. The Codewarrior C-compiler
> reference manual clearly lists several pragma directives which would
> allow me to do this.
>
> However, most of these pragma directives are not being recognised by
> the CW IDE.
>
> Any help in this regard would be much appreciated.
>
> Regards,
> Chamath. > --------------------To
> learn more about Motorola Microcontrollers, please visit
http://www.motorola.com/mcu o learn more about Motorola Microcontrollers,
please visit http://www.motorola.com/mcu




Does anyone know why the comment "nops required for bug in initial
silicon" is present?
( about nine lines after the MoveMore label). I am assuming it has to
do with locking the PLL which we don't use but
I appreciate if someone can confirm it.

Rod Niner
GSE Scales
42860 Nine Mile Road
Novi, MI 48375-4122
ph: 248.596.3350 The information contained in this electronic mail transmission is intended
by SPX Corporation for the use of the named individual or entity to which
it is directed and may contain information that is confidential or
privileged. If you have received this electronic mail transmission in
error, please delete it from your system without copying or forwarding it,
and notify the sender of the error by reply email so that the sender's
address records can be corrected.




Rod,

The extra NOPs are indeed required for the PLL.

After changing the PLL registers of the HCS12, there is a delay before the
LOCK bit correctly reflects that the PLL is not locked. The NOPs are meant
to generate a short delay after changing the PLL registers and before
testing the LOCK bit, in order to make sure the LOCK bit will initially
reflect the correct not-locked condition, so the code won't continue
forward before the PLL is locked and the appropriate new operation
frequency has stabilized and is ready to be selected and fed to the HCS12
resources.

At Noahu we recommend to our customers an even more strict algorithm, that
waits for the LOCK bit to read as locked for 10 consecutive times, before
deciding the PLL is indeed locked, and it is safe to select it to feed the
new operation frequency to the HCS12 resources.

Hope this helps,
Doron
Nohau Corporation
HC12 In-Circuit Emulators
www.nohau.com/emul12pc.html

At 13:30 27/01/2004 -0500, you wrote:
>Does anyone know why the comment "nops required for bug in initial
>silicon" is present?
>( about nine lines after the MoveMore label). I am assuming it has to
>do with locking the PLL which we don't use but
>I appreciate if someone can confirm it.
>
>Rod Niner
>GSE Scales
>42860 Nine Mile Road
>Novi, MI 48375-4122
>ph: 248.596.3350 >The information contained in this electronic mail transmission is intended
>by SPX Corporation for the use of the named individual or entity to which
>it is directed and may contain information that is confidential or
>privileged. If you have received this electronic mail transmission in
>error, please delete it from your system without copying or forwarding it,
>and notify the sender of the error by reply email so that the sender's
>address records can be corrected. >
>
>--------------------To learn more
>about Motorola Microcontrollers, please visit
>http://www.motorola.com/mcu
>o learn more about Motorola Microcontrollers, please visit
>http://www.motorola.com/mcu >




Another approach is to fix whatever condition is causing the warning.

Gary Olmstead
Toucan Technology
Ventura CA At 03:06 PM 1/27/04 +0000, you wrote:
>Hi Daniel,
>
>Thanks for the reply.
>Basically, I need to prevent warning messages during compilation of
>certain source files. As an simple example, take a simple CW project
>which has two source files src1.c and src2.c with src1.c starting-off
>with the following pragma definition
>
>#pragma suppress_warnings on
>
>I imagine this way, all warning messages issued during compilation of
>src1.c will be suppressed while src2.c will undergo normal
>compilation which means that warning messages will not be suppressed
>during compilation of src2.c
>
>Although this is what I intend doing, the compiler does not seem to
>recognize the pragma "suppress_warnings". I am issued with the
>following message:
>
>Warning : illegal #pragma
>src1.c line 4 #pragma suppress_warnings on >Thanks & Regards
>Chamath >--- In , "Daniel Friederich" <dfriederich@m...>
>wrote:
>> Hi Chamath,
>>
>> can you more exactly explain what you try, get and expect?
>> Controlling the messages works like this:
>>
>> #pragma MESSAGE DISABLE C5702 /*: Local variable declared but not
>referenced */
>> void test1(void) {
>> int i;
>> }
>> #pragma MESSAGE WARNING C5702 /*: Local variable declared but not
>referenced */
>> void test2(void) {
>> int i;
>> }
>>
>>
>> Note the restrictions mentioned in the manual that this message does
>> not control preprocessor messages like "Warning : C4443: Undefined
>Macro 'i' is taken as 0".
>> They can only be disabled in the HC12 Compiler preference panel.
>>
>> Bye
>>
>> Daniel
>>
>> PS: Use the manual named "Manual_Compiler_HC12.pdf" which is
>delivered with the HC12 and not any Metrowerks generic
>> "C_Compilers_Reference_X.Y.Z.pdf".
>>
>> > -----Original Message-----
>> > From: cmth2004 [mailto:cmth2004@y...]
>> > Sent: Monday, January 26, 2004 16:46
>> > To:
>> > Subject: [68HC12] pragma directives on Codewarrior
>> >
>> >
>> > Hi
>> >
>> > Basically, I am exploring the possibility of using pragma
>directives
>> > to regulate compile-time warning messages. The Codewarrior C-
>compiler
>> > reference manual clearly lists several pragma directives which
>would
>> > allow me to do this.
>> >
>> > However, most of these pragma directives are not being recognised
>by
>> > the CW IDE.
>> >
>> > Any help in this regard would be much appreciated.
>> >
>> > Regards,
>> > Chamath.
>> >
>> >
>> > --------------------To learn
>more about Motorola Microcontrollers, please visit
>> > http://www.motorola.com/mcu
>> > o learn more about Motorola Microcontrollers, please visit
>> > http://www.motorola.com/mcu
>> >
>> >
>> >
>> >
>> >--------------------To learn more about
>Motorola Microcontrollers, please visit
>http://www.motorola.com/mcu
>o learn more about Motorola Microcontrollers, please visit
>http://www.motorola.com/mcu >
>





The 2024 Embedded Online Conference