Forums

PE Question:

Started by Johnson, Jerry June 28, 2004
PE Question:

While using Metrowerks CW6.1.1  processor expert tool, to generate code for the 56F8357EVM, I am having a problem with the automatically generated code.  When I use the stationary to create a project, the tool builds a file "pe_types.h".  Within this file there is a definition of "SaveStatusReg" which saves the status register, masks interrupts, and inserts 2 nop's.  This definition is later used in the same file in another definition of "EnterCritical" which is used by the SCI bean, and others I believe.

The problem comes when running the SCI0 peripheral, in that it appears that there needs to be 3 nop's following the setting of the interrupt masks to prevent the serial interrupt code from being interrupted after the first instruction of the "critical region of execution."

Of course I cannot legitimately "edit" these files sci bean or pe_types.h without losing the edits every time processor expert runs.

Has anyone else seen this "bug" or found a switch or file to modify to insert 3 nops following the masking of interrupts?

Jerry.


________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information visit http://www.messagelabs.com
________________________________________________________________________

Couple of notes here:

First, when disabling interrupts on 56F83xx devices, you may need as
many as 6 NOPs after the instruction that sets SR to disable
interrupts, due to pipeline.

Second, it is very easy to modify PE generated code and to preserve
your changes. You can:
1. Generate initial code and suspend PE completely. This option
will remove PE functionality from your project, but it will keep all
generated code, so you can modify any file without PE overwriting
it. To do that, go to "Processor Expert" menu and select "Suspend
Processor Expert".
2. Generate initial code and "freeze" PE code generation. This
option will keep PE functionality in your project with exception of
code generation. To do that, go to "Processor Expert" menu and
select "Freeze generated code".
3. Suspend code generation for selected beans only. This option
will "freeze" code generation for a user specified beans, while
generating code for the rest of the project. To do that, go
to "Edit/??????_setting" menu (located just under Edit/Preferences
menu). In Settings window go to "Processor Expert/Project options"
panel (this is very last on the list). Select "Preserve User
Changes" check box. Now in your project, right mouse click on SCI
bean and make sure that "Code Generation/ Preserve User Changes"
option is selected.
4. Enable "track changes" option in PE, which will inform you
which files have been changed during code generation and if you want
to keep old or new file. It also provides visual diff on old and new
version of changed file. To do that, go to "Edit/??????_setting"
menu (located just under Edit/Preferences menu). In Settings window
go to "Processor Expert/Project options" panel (this is very last on
the list). Select "Track/Review Changes" check box.

In your case, I suggest to use options 1, 2, or 4 above. Option 3
will not work for you if you modify pe_types.h file, because it is
not part of the bean. However, you can modify SCI bean code itself,
and place NOPs after call to EnterCritical() function. If you do
that, you can use option 3 above and preserve your bean code changes.

There will be update or patch for the PE in near future to correct
this NOP issue.

Sincerely,

Leonard

--- In , "Johnson, Jerry"
<jljohnson@g...> wrote:
> While using Metrowerks CW6.1.1 processor expert tool, to generate
code for
> the 56F8357EVM, I am having a problem with the automatically
generated code.
> When I use the stationary to create a project, the tool builds a
file
> "pe_types.h". Within this file there is a definition
of "SaveStatusReg"
> which saves the status register, masks interrupts, and inserts 2
nop's.
> This definition is later used in the same file in another
definition of
> "EnterCritical" which is used by the SCI bean, and others I
believe.
>
> The problem comes when running the SCI0 peripheral, in that it
appears that
> there needs to be 3 nop's following the setting of the interrupt
masks to
> prevent the serial interrupt code from being interrupted after the
first
> instruction of the "critical region of execution."
>
> Of course I cannot legitimately "edit" these files sci bean or
pe_types.h
> without losing the edits every time processor expert runs.
>
> Has anyone else seen this "bug" or found a switch or file to
modify to
> insert 3 nops following the masking of interrupts?
>
> Jerry. >
_____________________________________________________________________
___
> This email has been scanned for all viruses by the MessageLabs
SkyScan
> service. For more information visit http://www.messagelabs.com
>
_____________________________________________________________________
___