// please, look this simple code, I have
extracted and simplified it from a large proyect:
short t; short *ptr1;
void Init(short ta);
void Init(short param){
short i; short *ptr; if(param == 0){
for(i=0, ptr=ptr1; i<8; i++) *ptr++ = i+1; } else{ t = 0; } }
// if you compile it with some optimization level (say Level 1, for speed)
and
// mark "allow DO instructions" in settings->M56800 Processor, Codewarrior // crashes. // The only way to compile it is without optimization or not allowing DO // instructions. // I am working with version 5.0.5 // Can somebody tell me if this bug is corrected in a posterior version of codewarrior ? // Thanks. |
|
Codewarrior 5.0.5 bug ?
Message
I just used CW 6.0 and
it handled it very well. Here is the generated .asm
file:
include "asmdef.h"
SECTION allowdo ; declarations
global Fmain ENDSEC SECTION allowdo ; declarations
xref ARTMAIN ENDSEC SECTION allowdo ; declarations
global Fptr1 global Ft ENDSEC SECTION
allowdo
ORG P:
;
; 37: ; 38: void main(short param){ ; 39: short i; ; 40: short *ptr; ; 41: if(param == 0){ ; subroutine "Fmain",Fmain,end_Fmain-Fmain Fmain: tst.w Y0 bne <_L6_0 ; *+11 ; ; 42: for(i=0, ptr=ptr1; i<8; i++) ; move.w #<0,B moveu.w X:>Fptr1,R0 ; ; 43: *ptr++ = i+1; ; 44: } ; 45: else{ ; do #<8,>_L6_1 move.w B1,A add.w #<1,A move.w A1,X:(R0)+ add.w #<1,B _L6_1: bra <_L6_2 ; *+3 ; ; 46: t = 0; ; 47: } ; _L6_0: move.w #<0,X:>Ft ; ; 48: } ; _L6_2: rts end_Fmain: ENDSEC
SECTION
allowdo
ORG X:
; *** UNINITIALIZED DATA (.bss) *** align 2
Fptr1: ds 1 ENDSEC
SECTION
allowdo
ORG X:
; *** UNINITIALIZED DATA (.bss) *** align 2
Ft: ds 1 ENDSEC
END ----------------------------------- Motorola General Business Information
|
Message
The difference might be in the context!!! Nested do loops can
create an overflow of the hardware loop stack during interrupt operations.
Allowing do loops may create other loops in interrupt code.
Jerry.
________________________________________________________________________ This email has been scanned for all viruses by the MessageLabs SkyScan service. For more information visit http://www.messagelabs.com ________________________________________________________________________ |
|