Include compile errors, CW ver 5.1

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

Include compile errors, CW ver 5.1

Jump to solution
1,538 Views
jsingh
Contributor I

Hello,

 

I am fairly new to CW Dev suite (V5.1) for HSC12.

 

A)

I have an include statement in the assembly file I am using, (main.asm). The statement is

#include      reg9s12.h     ; include register equates

 

I cannot get this to compile. Other variations also don't compile, (i.e. without the #, or with the file name in "" and with/or without file file path) and I get errors related to this line in the asm file.

If I comment this line out, I get compile errors for code further down the file, as that part of the core requires constants, declared in the above include file. 

 

Please note that I am using a stationary for C projects, with 'main.c' file as the top file.

 

B)

The above reg9s12.h starts with

;*  HC12 I/O Register locations (MC9S12DP256B)

and ends with

;* end registers

 

For the first line, the compiler gives C1018 error, (illegal type composition)

 

C)

Lastly could someone explain the diff between include statements with file name in <f_name> or in "f_name" ?

 

Thank you!

 

  

Labels (1)
0 Kudos
1 Solution
1,021 Views
BlackNight
NXP Employee
NXP Employee

Hello,

as a general note on assembler, have a look at C:\Freescale\CWS12v5.1\Help\PDF\Assembler_HC12.pdf

A) if using assembly, use INCLUDE to include a file (#include is for C/C++ language) (page 278)

B) I think you want to include an assembly include file (located in C:\Freescale\CWS12v5.1\lib\hc12c\include)

C) To my knowlede, the assembler only allows "...". <..> is used by the compiler for 'library' files.

I hope this helps,

Erich

View solution in original post

6 Replies
1,021 Views
tommiller
Contributor I

I believe the file you are looking for is mc9s12dp256.inc, located in the CWS12v5.1\lib\hc12c\include directory.

You will also notice that the ATD result registers are named ATD0DR0H. You can either change all of the ADR05H style names to the correct name, or use an equate to make them the same e.g. ADR05H equ ATD0DR5H.

Hope this helps.

1,021 Views
jsingh
Contributor I

Thank you Tom,

That helped.

However it seems that the Assembler expects the 'case' to match also. mc9s12dp256.inc has all declarations / equates in Caps, where as my main.asm has them in lower case. (And also in the *.h file pasted in my previous post, which I was 'including' earlier).

Isn't assembly case-insensitive? Then why does the assembler complain, when the case don't match, but does not whine when I match the case?

Is there is flag to be set in CW for it to ignore case. If so then where?

Thanks again.

0 Kudos
1,022 Views
BlackNight
NXP Employee
NXP Employee

Hello,

as a general note on assembler, have a look at C:\Freescale\CWS12v5.1\Help\PDF\Assembler_HC12.pdf

A) if using assembly, use INCLUDE to include a file (#include is for C/C++ language) (page 278)

B) I think you want to include an assembly include file (located in C:\Freescale\CWS12v5.1\lib\hc12c\include)

C) To my knowlede, the assembler only allows "...". <..> is used by the compiler for 'library' files.

I hope this helps,

Erich

1,021 Views
jsingh
Contributor I

Hi Erich, Thank you for your reply. Using your A) point and after using an Assembler stationary (previously I was using a C stationary) I got the file compiled further till...

1) It hit another 'undeclared user defined symbol', (ADR05H, ADR04H, ADR07H etc.. related to the ADC on the chip?)

I am targeting a 9S12DP256 device. Under the 'CWS12v5.1\lib\hc12c\include' folder I searched and found a 'mc68hc912dg128a.h' file (no dp256 file with such declarations).

However this file is using C syntax and I get compile error on the very first line (containing comments only). Where could I find a file with above declarations, which the ASM flow would support?

2) As I am new to this Dev, I would have really liked a single document outlining the flow (ASM, C/C++..), with info on required / supported libraries etc. rather than painstakingly figuring my way out, using different manuals (Assembler, Compiler, Linker etc..). Is there something like that? I have searched online a lot and have not found something yet.

Thank you,

0 Kudos
1,021 Views
BlackNight
NXP Employee
NXP Employee

You cannot include normal C header (*.h) files in assembler files.You need to include assembler header (*.inc) files.

Erich

0 Kudos
1,021 Views
jsingh
Contributor I

Thanks, but it does not really help.

I do have an *.h file (pasted below) which is going through fine with the Assembler. It just equates values to registers..

1) Where could I find an 'inc' or an 'h' file, with the mentioned declarations above (adr05h etc..) which would hopefully compile/assemble the code? Wouldn't it be in one of the libraries?

2) Is there any Freescale document on codewarrior flows? Online there is too much info, but it is all scattered in bits/pieces and just gets confusing.

(PS: I found 8_16bit_IDE_Users_Guide.pdf under C:\Program Files\Freescale\CWS12v5.1\Help\PDF ) I am going through that. Is this a good enough doc, or is there a better one too?

Thanks

;*  HC12 I/O Register locations (MC9S12DP256B)

porta        equ    $0000        ;porta

portb        equ    $0001        ;portb

ddra        equ    $0002        ;porta - data direction register

ddrb        equ    $0003        ;portb - data direction register

0 Kudos