How to suppress 'six NOP' warning when disabling interrupts

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to suppress 'six NOP' warning when disabling interrupts

1,978 Views
spacedog
Contributor I

I've created some 'asm static ...' functions that do certain tasks for the DSC 56f800ex under Code Warrior 10.6. Some of these need to disable interrupts and I get the following warning:

 

>Six NOP(s) required after instruction masking the interrupts. NOP(s) may be

>replaced with instructions located prior to the start of the critical section

>to save code space. Check that the instructions take at least six

>cycles.[INTRWRN_001]

 

However I've checked the code and the instructions following the masking of the interrupts -- they are all safe as intended and the critical section happens six cycles after the interrupts are masked. For example in one function I disable interrupts immediately, then spend several cycles preparing for the actual functionality and only access the shared memory after six cycles.

 

I don't really want to insert the NOPs just to get rid of the warning because there is useful work I can do in that time and these routines are already longer than I'd like. How can I suppress the warning just for these functions that I have been reviewed and checked? I tried to put #pragma supress_warnings on before the code but it had no effect.

 

Ideally I just want to suppress just that warning for just that file and to do so in the source code rather than a build setting.

Labels (1)
0 Kudos
Reply
4 Replies

1,673 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Colin,

Sorry for the delay. Regarding your question, if you just enable or disable interrupt by setting/clearing the I0 and I1 bits in SR, it is UNNECESSARY to insert the NOP instruction. For example, if you use the instructions: asm(bfclr #$300, SR) to enable interrupt or asm(bfset #$300,SR) to disable interrupt, NOP instruction is not needed.

But for the fast interrupt, you have to use RTID at the end of ISR, two or three NOP instructions are needed after the RTID in the end of ISR.

If the CW tools requires NOP after enable/disable interrupt instruction, just ignore the warning.

Hope it can help you.

BR

XiangJun Rong

0 Kudos
Reply

1,673 Views
spacedog
Contributor I

Hi,

Are you sure about the no need for the NOP? I thought it was required due to the pipelining -- all the examples in the programmers reference manual put the NOPs in.

Sadly all our code is supposed to compile without warnings, so I'd really like a way to be able to disable the warning (and *just* that warning, and ideally just for that one file). I don't understand why `#pragma supress_warnings on` doesn't do it.

0 Kudos
Reply

1,673 Views
johnlwinters
NXP Employee
NXP Employee

The NOPS are needed to assure that the critical section functions correctly.

The warning is always given, regardless of the code content, as it cannot determine what is critical about your code.

0 Kudos
Reply

1,673 Views
spacedog
Contributor I

Hi John,

Your answer conflicts with XiangJun which is not too helpful but given the other evidence I'm sure you're correct about the need for NOPs.

I understand why the warning is there, but there needs to be a way to turn it off (or at least downgrade it to an info). Essentially saying 'I know what I'm doing'. We have a very commonly used piece of code that uses this construct which generates a lot of warnings, the concern is that these will drown out other warnings that may be important. I know I could just add the NOPs but, as I said, it's used a lot and the extra cycles will make a difference.

I'm going to say this is a compiler bug, it should be possible to compile code without warnings by adding some construct to say 'I acknowledge the warning, don't warn me again about this code'. If CodeWarrior for MCU doesn't allow this I would say that's a bug in the compiler that should be addressed in a future version. I don't understand why I can't #pragma the warnings off as described in the manual.

0 Kudos
Reply