Searching \ for '[PIC] Re: Can't include p32xxxx.h on C32' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'Re: Can't include p32xxxx.h on C32'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] Re: Can't include p32xxxx.h on C32'
2012\06\05@072501 by Electron

flavicon
face

PS: it appears that:

#include <p32xxxx.h>

is not even included, as # is used for comments (!).. but if I open the p32xxxx.h
file with a text editor I can see that is full of such #include's .. this is puzzling:
different assembler is in use, options, or what?

Thanks,
Mario


{Quote hidden}

>Mario

2012\06\05@080425 by Ruben Jönsson

flavicon
face
What does the build output say?

I just tried one of the assembly examples and it does include p32xxxx.h but then fails to include the correct processor header (from p32xxxx.h) since it isn't in the proc subdirectory in the include directory.

/Ruben


{Quote hidden}

> -

2012\06\05@082353 by Isaac Marino Bavaresco

flavicon
face
At first it seemed that you were using C, but now it is clear that you
are using assembly.

The files with extension ".h" are intended for the C language, the
assembler will not understand them.


Isaac


Em 5/6/2012 08:24, Electron escreveu:
{Quote hidden}

>> Mario

2012\06\05@083023 by Harold Hallikainen

face
flavicon
face
#include <p32xxxx.h>
SHOULD work! Make sure the project settings for directories for include
files includes the actual location of these files. That seems to work for
me.

One thing that caused me problems recently is the location of prodefs.ld .
To get my files away from all the object files in the project directory, I
put the source files (including linker script) in a subdirectory. The
linker script worked fine, but the include in it went to the project
directory instead of the subdirectory. When the procdefs.ld was not there,
it used the default file. This put my interrupt vector table in boot flash
instead of application flash, totally messing stuff up. So, I've now put
both the linker script and procdefs.ld in the project directory. I've also
renamed my version of procdefs.ld (both the filename and the include in
the linker script) so that if it is not found, it doesn't use something
else.

Good luck!

Harold



{Quote hidden}

>

2012\06\05@090209 by Ruben Jönsson
flavicon
face
My thought first too but then I looked in the assembler examples in the MPLAB C32 Suite which indeed does include ".h" files.

/Ruben

{Quote hidden}

> -

2012\06\05@091515 by Electron

flavicon
face
At 15.02 2012.06.05, you wrote:
>My thought first too but then I looked in the assembler examples in the MPLAB
>C32 Suite which indeed does include ".h" files.

Yes, there are A LOT of defines in the ASM sources of PIC32.

{Quote hidden}

>> --

2012\06\05@092409 by Electron

flavicon
face
At 15.02 2012.06.05, you wrote:
>My thought first too but then I looked in the assembler examples in the MPLAB
>C32 Suite which indeed does include ".h" files.

Yes, there are A LOT of defines in the ASM sources of PIC32.

PS: for example, take a look at the assembly source crt0.S

It #include <p32xxxx.h> (but that # is a comment for the assembler!!) then uses
e.g. register k0 and _CP0_STATUS (just to name two) which without p32xxxx.h will
generate errors (k0 doesn't exist natively for the assembler, it's either $k0 or
$26, and _CP0_STATUS either, it's a macro that expands to $11,0).

So in order to use the assembly sources for the PIC32 you see around, or even
crt0.S, p32xxxx.h must be really included.. yes I now see it's a C source, this
is really puzzling. :(

However, are you able to assemble lines of code like this? (not in C inline asm,
but in a separed asm source file that you like with your other C object files):

mfc0    k0,_CP0_STATUS

if you do, then p32xxxx.h has been someway included, else the only syntax that
works for the assembler would be either:

mfc0    $k0,$11,0

or

mfc0    $26,$11,0

that's "native" (i.e. without defines or macros) MIPS32 assembly. ;)

NOTE: SREGs are linked as memory locations, they are not part of the include's.

With kind regards,
Mario


{Quote hidden}

>> --

2012\06\05@095144 by Isaac Marino Bavaresco

flavicon
face
Microchip's assembler uses a C-like preprocessor since a long time, but
traditionally assemblers didn't use C's preprocessor.
Now it seems that some assemblers have an option to use it.
".h" files can be used with said assemblers only if the file uses only
constructs that the assembler can understand or preprocessor directives.

The fact that the assembler is treating "#" as a comment suggests that
it has the C preprocessor turned off.


Best regards,

Isaac


Em 5/6/2012 10:02, Ruben Jönsson escreveu:
{Quote hidden}

>> --

More... (looser matching)
- Last day of these posts
- In 2012 , 2013 only
- Today
- New search...