ldhx @address allowed in 6.3 but not 10.2

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

ldhx @address allowed in 6.3 but not 10.2

Jump to solution
1,408 Views
cab
Contributor III

I am porting code from HC908 (CW 6.3) to HC9S08 (CW 10.2).  The original author uses statements like

  • ldhx @location

within embedded asm, with no problems.  But 10.2 flags the @'s with a simple ? (Bad character) at the edge of the line, but generates no other complaint--for example, the Problem window remains blank--"0 items."

.

It appears that the document HC(S)08/RS08 Assembler Manual for Microcontrollers http://cache.freescale.com/files/soft_dev_tools/doc/ref_manual/HC08ASMRM.pdf

should cover both controllers, but there is no mention of this @ notation.  Which is not to say that CW 6.3 had to follow it--however, I cannot find the @ used this way in any Freescale documentation.

 

The two problems I have are: 1) it doesn't generate a real error and 2) what does it mean?

1) I'll take the first problem to another post because it appears that all 10.2 asm errors are treated the same way.

2) I expect it indicates Direct Page Addressing and the @ should be replaced by a $, but I do not have hardware yet so I cannot verify.  Is it that simple to fix?

.

Labels (1)
Tags (1)
0 Kudos
1 Solution
914 Views
BlackNight
NXP Employee
NXP Employee

The 'syntax errors' are flagged by the eclipse indexer and syntax parser. The normal eclipse one is not aware of any language extensions or inline assembly specific things which are vendor defined.

Anyway, MCU10.2 has many of them fixed/improved, and the MCU10.1 update 1.0.0 (see MCU10.2 Update 1.0.0 released) has a few more fixed. I tried your example in 10.2 with the update 1.0.0, and it shows up properly without syntax errors.

I did not check it with MCU10.1, but it is very likely that in that version it is showing what you see.

 

Another thing is: it seems that eclipse stores some cached information in the workspace .metadata folder. If the syntax error is showing up for you in 10.2, then you might try it out with a new workspace. Then you have settings still cached in the workspace setting.

 

Hope this helps,

BK

View solution in original post

0 Kudos
11 Replies
914 Views
cab
Contributor III

I found this problem mentioned in the release notes in my 10.2 installation.  This is pretty much the consensus here:

http://cache.freescale.com/files/soft_dev_tools/doc/support_info/CW_MCU_v10.2_RN.pdf

    Appendix A: Known issues and Workarounds

    MTWX46503 Description: The Eclipse IDE’s Syntax parser reports a syntax error for lines using
    the construct “@(address)”
   Workaround:
   1) Ignore Syntax errors for constructs with this format. The compiler will confirm if
   there is an actual error in your code.

   [..]

 

But it looks like there is a fix (in update 1.0.0):

http://cache.freescale.com/files/soft_dev_tools/doc/support_info/CW_MCU10_2_UP1.0.0_RN.pdf

Bug Fixes
• MTWX46503 - The Eclipse IDE’s Syntax parser reports a syntax error for lines
using the construct “@(address)”

 

So I will update with 1.0.0 and look forward to this problem gone.

Thanks, BK and others

0 Kudos
914 Views
cab
Contributor III

After installing 1.0.0 update the @-errors are gone from the editor--as well as another editor-only error for

interrupt VectorNumber_Viic void Viic_isr(void)

 

0 Kudos
914 Views
bigmac
Specialist III

Hello,

 

The manual that you reference is that applicable to an assembly program (with .asm files).  It is not applicable to inline assembler within C files.  The rules are somewhat different for the latter, and should be found within the compiler manual.

 

The use of @ symbol is valid for inline assembly, but not for an assembly program.

 

I do not know the cause of your CW 10.2 problems, versus CW 6.3.

 

Regards,

Mac

 

0 Kudos
914 Views
CompilerGuru
NXP Employee
NXP Employee

In addition to Macs answer. The meaning should be described in the HLI chapter of the S08 compiler manual. Don't have 10.2 here, so I did not check, was in there in the past.

Basically LDHX @xyz mean to load the address of xyz into the H:X register pair.

 

Also note that the compiler does support LDHX for more addressing modes than the plain LDHX assembly instruction in the pdf you referred to. If necessary the compiler uses multiple assembly instructions to perform the operation. For example a LDHX @local could get translated to a TSX, AIX #4 /* stackoffset offset of local */.

 

Daniel

 

PS: In MCU 10.0 (old version) it is documented in C:\Program Files (x86)\Freescale\CW MCU v10.0\MCU\Help\pdf\MCU_HCS08_Compiler.pdf, chapter "High-Level Inline Assembler for the HC(S)08", "Special Features", "H:X Instructions".

0 Kudos
914 Views
cab
Contributor III

Thanks Mac, thanks Daniel-

 

I found the Compiler manual on my system--I didn't know it was so easy to get: CodeWarrior Development Studio for Microcontrollers V10.x HC(S)08 Build Tools Reference Manual, at C:\Freescale\CW MCU v10.2\MCU\Help\PDF\MCU_HCS08_Compiler.pdf.  It agrees with Daniel (p.468): 

  • Register Indirect Addressing Mode
    The offset must be constant for the register indirect addressing modes. This constant may be an immediate or a variable address relocated by the linker.
    Example:
    STA @Variable_Name,X

So why does the syntax checker in the 10.2 editor flag these usages of @ as illegal (see my related post about "CW10.2 does not list errors for embedded asm")?  There are about 30 of them and the editor flags precisely these.  Build links and makes a .s19 file, but I do not yet have hardware to check it out.   The code is essentially identical to code that CW6.3 builds without a complaint.

 

>>This should be moved to the CW forum, but I do not see how to do it myself.

 

 

0 Kudos
914 Views
CompilerGuru
NXP Employee
NXP Employee

For me it does not flag the @ in HLI code.

 

char Variable_Name[100];char testFunction(int index) { asm {     LDX index     LDA @Variable_Name,X     RTS   }}

 

Could it be that you have some special setup, for example where the eclipse parser fails to detect that the @ is in inline assembly code? Can you provide a full sample showing the issue?

 

Anyhow, it in the end, as long as the compiler understands the syntax properly, the parsing done inside of eclipse is irrelevant to the generated code. Still it is annoying if the IDE shows such warnings.

 

Daniel

0 Kudos
914 Views
cab
Contributor III

Thanks for the test case.  The result is attached.  It flags -precisely- these (and leaves everything else alone) so that explanation is unlikely.  Also I have re-installed CW many times, and the project is just newly created so it is unlikely that some kind of attrition is to blame.

 

Are you using10.2?

0 Kudos
914 Views
CompilerGuru
NXP Employee
NXP Employee

Yes, used 10.2. Installed it yesterday and it did not show the markers for the @, might have been fixed in this release.

 

 

Daniel

 

0 Kudos
915 Views
BlackNight
NXP Employee
NXP Employee

The 'syntax errors' are flagged by the eclipse indexer and syntax parser. The normal eclipse one is not aware of any language extensions or inline assembly specific things which are vendor defined.

Anyway, MCU10.2 has many of them fixed/improved, and the MCU10.1 update 1.0.0 (see MCU10.2 Update 1.0.0 released) has a few more fixed. I tried your example in 10.2 with the update 1.0.0, and it shows up properly without syntax errors.

I did not check it with MCU10.1, but it is very likely that in that version it is showing what you see.

 

Another thing is: it seems that eclipse stores some cached information in the workspace .metadata folder. If the syntax error is showing up for you in 10.2, then you might try it out with a new workspace. Then you have settings still cached in the workspace setting.

 

Hope this helps,

BK

0 Kudos
914 Views
cab
Contributor III

Thanks for the many tries with 10.2.  so it appears that there is something wrong with my installation.  I did re-install many times but always from my existing download--that was dated last Tues 4-24.  Perhaps I should pull another download but Help->Check-forUpdates reports "none."  My build is


Installed Products:
 - CodeWarrior for MCU
     Version: 10.2
     Build Id:120126

 

Thanks to BlackNight I got the software  running (another  post) so it appears that the code compiles correctly.

BlackNight- You are saying that downloading the latest 10.2 is not enough--I still may need to download update 1.0.0?

-Cab-

 

0 Kudos
914 Views
BlackNight
NXP Employee
NXP Employee

Hi cab,

your example works fine for me in the 10.2 without the 1.0.0 update. See attached screenshot.

But 1.0.0 comes with additional fixes in this area, that's why I thought it might be useful.

But it should work for you in plain 10.2.

If not, could you try with a new workspace and a new project created by the wizard?

 

BK

0 Kudos