Thursday 15 September 2011

compiler construction - How to build PIC controller program on Linux? -


We are doing a project and using p30f3013 microchip (PIC 30 family of chips). Right now we are writing a software for our chip. The operating system we are using is Linux Ubuntu 12.04. Below is a small file containing some functions.

  #include "p30f3013.h" #include "hardware.h" // init_lcd (with SP1) with U2A1 zero {// after any reset 500 milliseconds SPI1BUF = 0; // Buffer SPI1STATbits. SPIEN = 1 was displayed; // Enable SPI SPI1CONbits. MSTEN = 1; SPI1CONbits.SSEN = 1; SPI1CONbits.PPRE = 0; } Zero write_char (char character) {// wait in between two consecutive four writing in the first row 5 milliseconds / second row SPI1BUF = between two continuous axis in character wait 250 microsounds; } To write zero (integer number) {// Wait for 5 milliseconds to write in two consecutive letters on the first line / Wait 250 metric seconds between two consecutive moves in the second line if (num> = 0 '& amp; amp; amp; amp; amp; =' 9 ') {SPI1BUF =' 0 '+ number; } And {SPI1BUF = '!'; }} Void move_cursor (int hexadecimal) {// The first row: 0x80 to 0x8F // The first row: Waiting for 250 microseconds before writing 0xC0 to 0xCF / byte byte // before writing the cursor can not move and one in the same cycle The characters can write SPI1BUF = hexadecimal; } Zero init_led () {_TRISB0 = 0; _TRISB1 = 0; }   

We add the p30f3013.h header which contains some macros, buffers, registers, etc. This is a small part of the header:

  #ifndef __dsPIC30F3013__ # panic file "does not match processor setting" #endif #ifndef __30F3013_H #define __30F3013_H / * --- ---- ------------------ * / / * Core Registration 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__)); External volatile unsigned int WREG4 __ distributed (__ sfr __, __ dislikes __, __ insecure__)); External volatile unsigned interval WREG5 __tat __ ((__ sfr __, __ dislikes __, __ insecure__)); External volatile unsigned int WREG6 __ content (__ sfr __, __ dislikes __, __ insecure__)); External volatile unsigned int WREG7 __attribute __ ((__ sfr __, __ dislikes __, __ insecure__)); External volatile unsigned int WREG8 __attribute __ ((__ sfr __, __ dislikes __, __ insecure__)); External volatile unsigned int WREG9 __attribute __ ((__ sfr __, __ dislikes __, __ insecure__)); External volatile unsigned int WREG10 __attribute __ ((__ sfr __, __ dislikes __, __ insecure__)); Extern Volatile unsigned int WREG11 __attribute __ ((__ sfr __, __ deprecated __, __ unsafe__)); External volatile unsigned int WREG12 __attribute __ ((__ sfr __, __ dislikes __, __ insecure__)); Extern Volatile unsigned int WREG13 __attribute __ ((__ sfr __, __ deprecated __, __ insecure__)); 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 an error:

  #error "include the file Processor setting does not match ".   

Which APRs are due to this preprocessor defect:

  #ifndef __dsPIC30F3013__ # panic file" is included in the processor settings No account "#endif"   

We are using simple GCC compiler without any options, I think we like pic30-gcc -mcpu key Is required to use but we are using qtcreator and we do not know how to specify this option or how to change the compiler. We have installed the pic30-coff-gcc-4.0.3 compiller in the system.

Any suggestions?

You are receiving that message because your compiler will be sent to you __ dsPIC30F3013 __ Preprocessor does not define icons. You need to know what flag you need to read from the compiler document. To set this up, you have to read the documentation for your IDE. You can use it:

  GCC-DM-E - & lt; / Dev / null   

To print predefined macros that is your compiler is created.

No comments:

Post a Comment