Serious ST7 Assembler BUG
Company  
ST Home | Microcontrollers

Index  »  ST7  »  Serious ST7 Assembler BUG
     
   Serious ST7 Assembler BUG
 Moderated by :   »  Jatin  -  laubey  -  Setler

Author
beginning argument    ( Replies received: 7 )
EtaPhi   Posted 02-06-2008 at 11:13   



Registered on :
07-12-2004

From Italy

Messages : 182

 OFF-Line

When I was debugging my code, I found a serious ST7 Assembler bug.
This STMicroelectronics assembler v4.49 bug deals with label constants.
Here an excerpt of the assembler listing:


135 E8A4 AEEB LD X,#Avvio_uWeb.H
136 E8A6 A648 LD A,#Avvio_uWeb.L
137 E8A8 81 RET


where Avvio_uWeb is defined later


653 .Avvio_uWeb
654 EB48 CDE124 CALL DetectIdle


If the listing was ok, the .sym file would contain an entry for Avvio_uWeb whose address should be $EB48.

The .sym file however contains:


'rom' CS

E310 main
E86F c_MasterKey
EB90 Avvio_uWeb



To my surprise, the $EB48 is now $EB90 (and in the final .s19 too)!

What went wrong?

EtaPhi



PS: My target is a ST7FLITE29 and I use the lastest version of ST Visual Develop (4.0.0)



 Profile   Quote  
RobertJ   Posted 17-06-2008 at 17:48   



Registered on :
06-24-2005

From France

Messages : 9

 OFF-Line

It might be a bug.
Please send code (or excerpt) showing the problem.

RJ




 Profile   Quote  
EtaPhi   Posted 18-06-2008 at 08:57   



Registered on :
07-12-2004

From Italy

Messages : 182

 OFF-Line

Robert,
can you provide me your private address so that I can send you the whole project and keep it undisclosed?

Thank you in advance,

EtaPhi


[ This message was edited by: EtaPhi on 18-06-2008 12:33 ]



 Profile   Quote  
BrianM   Posted 18-06-2008 at 12:11   



Registered on :
03-05-2003

From UK (United Kingdom)

Messages : 64

 OFF-Line

Hi EtaPhi

Could you let us know (forum users) the results of this problem i.e. is it a bug or a coding issue?

Helps us if we have a similar problem in what to look for!

Re Brian




 Profile   Quote  
RobertJ   Posted 18-06-2008 at 12:32   



Registered on :
06-24-2005

From France

Messages : 9

 OFF-Line

Please send me the code at the following address
robert.jamier@st.com




 Profile   Quote  
EtaPhi   Posted 18-06-2008 at 12:44   



Registered on :
07-12-2004

From Italy

Messages : 182

 OFF-Line

Don't worry Brian,
I'm going to tell everyone the condition that triggers this bug, and how to work around it (with the help of Robert, of course).
Just wait for a while...

EtaPhi




 Profile   Quote  
RobertJ   Posted 19-06-2008 at 11:55   



Registered on :
06-24-2005

From France

Messages : 9

 OFF-Line

The code is correct but the absolute listing, which is generated after, is wrong.

Here is a case where the listing bug appears and how to get round it.
The variable array1 is declared in one file and used in another.
Its address is decremented and used as part of an operand. The array address (0x100) is two-byte long but the decremented address (0x99) is only one-byte long, leaving a possibility for optimization.

mapping.asm
segment byte at 100-17F 'ram1'
file1.asm
WORDS
segment 'ram1'
.array1 DS.b 32
file2.asm
EXTERN array1.w
segment 'rom'
LD ({array1-1},X),A

--> code generated for LD ({array1-1},X),A:
- in executable: D700FF
- in absolute listing: E7FF
--> the assembler is called a second time but only to generate the absolute listing from the map file, and this time the code is optimized.

Solution 1:
To remove the bug, move the declaration of array1 from file1.asm to file2.asm

file1.asm

file2.asm
WORDS
segment 'ram1'
.array1 DS.b 32
segment 'rom'
LD ({array1-1},X),A

--> code generated for "LD ({array1-1},X),A" in executable and listing: D700FF

Solution 2:
or better add address range for ram1 in file2.asm

file1.asm

file2.asm
WORDS
segment byte at 100-17F 'ram1'
.array1 DS.b 32
segment 'rom'
LD ({array1-1},X),A

--> code generated for "LD ({array1-1},X),A" in executable and listing: E7FF




 Profile   Quote  
EtaPhi   Posted 19-06-2008 at 13:09   



Registered on :
07-12-2004

From Italy

Messages : 182

 OFF-Line

Robert,

I am very grateful to you for your help.

It is nice to have this kind of support from ST!

My best wishes

EtaPhi




 Profile   Quote  
On Top

Search in the forums
 
Jump To