2008-06-19 12:39 AM
2008-06-01 10:43 PM
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)2008-06-17 05:18 AM
It might be a bug.
Please send code (or excerpt) showing the problem. RJ2008-06-17 08:27 PM
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 ]2008-06-17 11:41 PM
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 Brian2008-06-18 12:02 AM
Please send me the code at the following address
robert.jamier@st.com2008-06-18 12:14 AM
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... EtaPhi2008-06-18 11:25 PM
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: E7FF2008-06-19 12:39 AM
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