Reputation: 1184
We are doing a project and using p30f3013 microchip (PIC30 family of chips). Right now we are writing a software for our chip. The operation system we are using is Linux Ubuntu 12.04. Below there is a small file with some functions.
#include "p30f3013.h"
#include "hardware.h"
//SPI connects the display with the U2A1
void init_lcd()
{
//after any reset wait 500 milliseconds
SPI1BUF = 0; //buffer displayed
SPI1STATbits.SPIEN = 1; //SPI enable
SPI1CONbits.MSTEN = 1;
SPI1CONbits.SSEN = 1;
SPI1CONbits.PPRE = 0;
}
void write_char(char character)
{
//wait 5 milliseconds between writing two successive char in first row
//wait 250 microseconds between writing two successive char in second row
SPI1BUF=character;
}
void write_int(int num)
{
//wait 5 milliseconds between writing two successive char in first row
//wait 250 microseconds between writing two successive char in second row
if (num >= '0' && num <= '9')
{
SPI1BUF = '0' + num;
}
else
{
SPI1BUF = '!';
}
}
void move_cursor(int hexadecimal)
{
//first row: from 0x80 to 0x8F
//first row: from 0xC0 to 0xCF
//wait 250 microseconds before writing an address byte
//cannot move cursor and write a char in the same cycle
SPI1BUF=hexadecimal;
}
void init_led()
{
_TRISB0=0;
_TRISB1=0;
}
We add p30f3013.h header which contains some macroses, buffers, register and so on. Here is a short part of this header:
#ifndef __dsPIC30F3013__
#error "Include file does not match processor setting"
#endif
#ifndef __30F3013_H
#define __30F3013_H
/* ------------------------- */
/* Core Register Definitions */
/* ------------------------- */
/* W registers W0-W15 */
extern volatile unsigned int WREG0 __attribute__((__sfr__,__deprecated__,__unsafe__));
extern volatile unsigned int WREG1 __attribute__((__sfr__,__deprecated__,__unsafe__));
extern volatile unsigned int WREG2 __attribute__((__sfr__,__deprecated__,__unsafe__));
extern volatile unsigned int WREG3 __attribute__((__sfr__,__deprecated__,__unsafe__));
extern volatile unsigned int WREG4 __attribute__((__sfr__,__deprecated__,__unsafe__));
extern volatile unsigned int WREG5 __attribute__((__sfr__,__deprecated__,__unsafe__));
extern volatile unsigned int WREG6 __attribute__((__sfr__,__deprecated__,__unsafe__));
extern volatile unsigned int WREG7 __attribute__((__sfr__,__deprecated__,__unsafe__));
extern volatile unsigned int WREG8 __attribute__((__sfr__,__deprecated__,__unsafe__));
extern volatile unsigned int WREG9 __attribute__((__sfr__,__deprecated__,__unsafe__));
extern volatile unsigned int WREG10 __attribute__((__sfr__,__deprecated__,__unsafe__));
extern volatile unsigned int WREG11 __attribute__((__sfr__,__deprecated__,__unsafe__));
extern volatile unsigned int WREG12 __attribute__((__sfr__,__deprecated__,__unsafe__));
extern volatile unsigned int WREG13 __attribute__((__sfr__,__deprecated__,__unsafe__));
extern volatile unsigned int WREG14 __attribute__((__sfr__,__deprecated__,__unsafe__));
extern volatile unsigned int WREG15 __attribute__((__sfr__,__deprecated__,__unsafe__));
......
When we try to compile the code we get we following error:
#error "Include file does not match processor setting"
Which apperas because of this preprocessor derectives:
#ifndef __dsPIC30F3013__
#error "Include file does not match processor setting"
#endif
We are using simple gcc compiler without any options yet. I suppose that we need to use something like pic30-gcc with -mcpu key. But we are using qtcreator and we don't know how to specify this options there or how change the compiler. We installed pic30-coff-gcc-4.0.3 compiller into the system.
Any suggestions?
Upvotes: 0
Views: 670
Reputation: 225082
You're getting that message because your compiler doesn't define the __dsPIC30F3013__
preprocessor symbol for you. You need to find out what flag you need from reading the compiler documentation. To set it, you need to read the documentation for your IDE. You can use:
gcc -dM -E - < /dev/null
To print the predefined macros that your compiler is generating.
Upvotes: 0