Compiling for PIC with C18

nobody wrote on Friday, December 17, 2004:

I am getting follwing error while compiling
example project for  pic18  using c18 compiler
pl help me
--------------------------------------------------------Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\mcc18\bin\mcc18.exe" -p=18F452 "main1.c" -fo="main1.o"
/i"F:\rtos\Source\include" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
F:\rtos\Source\include\portable.h:95:Error: syntax error
Halting build on first failure as requested.
BUILD FAILED: Fri Dec 17 05:30:40 2004
--------------------------------------------------------

rtel wrote on Friday, December 17, 2004:

It looks like your problem is that the definition MPLAB_PIC18F_PORT is not defined.  If this is not defined then the correct portmacro.h file will not get included, the type portSTACK_TYPE will not get defined, and you will get the error as per your post.

The demo projects should have this defined already.  Below is the sample command line I get when building the demo exactly as downloaded.

Executing: "D:\DEVTOOLS\mcc18\bin\mcc18.exe" -p=18F452 "tasks.c" -fo="tasks.o" /i"D:\DevTools\mcc18\h" /i"e:\dev\freertos\demo\common\include" /i"e:\dev\freertos\source\include" /i"e:\dev\freertos\source\portable\mplab\PIC18F" -DMPLAB_PIC18F_PORT -Ls -Opa-

Note the -DMPLAB_PIC18F_PORT option.

The paths require changing in the project file unfortunately.  Have you changed anything else other than this?  With most ports it is important that the compiler switches and definitions are all set up correctly.  The demo project files should be used as examples.

Regards.

nobody wrote on Saturday, December 18, 2004:

ok  DEMO projects sets all setting wrongly all files many files r missing  i find for all 3 like this

rtel wrote on Saturday, December 18, 2004:

I suggest you download a clean version and try again.  Open the workspace that contains the threee projects - all the settings are correct.

nobody wrote on Sunday, December 19, 2004:

same is  the problem.SO i created  makefile and run using nmake in window environment . everything ok
All files r in F:\ drive
here is the make file

########## Path for uCOS-II core source files #################################
RTOS_SOURCE=f:\rtos\source
RTOS_SOURCE_INCLUDE=f:\rtos\source\include
RTOS_SOURCE_PORT=f:\rtos\source\portable\mplab\pic18f
RTOS_DEMO_PIC=F:\RTOS\Demo\PIC
RTOS_DEMO_COMMON_INCLUDE= F:\RTOS\Demo\Common\include
RTOS_MEM=F:\RTOS\Source\portable\MemMang
RTOS_SERIAL=F:\RTOS\Demo\PIC\serial
RTOS_POLLQ= F:\RTOS\Demo\Common\full
RTOS_POLLQ_INCLUDE=F:\RTOS\Demo\Common\include
RTOS_PARA  =F:\RTOS\Demo\PIC\ParTest
all:   
          @mcc18 -p=18F452    /I$(RTOS_SOURCE) /I$(RTOS_SOURCE_INCLUDE) /I$(RTOS_SOURCE_PORT) $(RTOS_SOURCE)\tasks.c  -DMPLAB_PIC18F_PORT -Ls -Opa+
              @mcc18 -p=18F452   /I$(RTOS_SOURCE) /I$(RTOS_SOURCE_INCLUDE) /I$(RTOS_SOURCE_PORT) $(RTOS_SOURCE)\queue.c  -DMPLAB_PIC18F_PORT -Ls -Opa+
             @mcc18 -p=18F452   /I$(RTOS_SOURCE) /I$(RTOS_SOURCE_INCLUDE) /I$(RTOS_SOURCE_PORT) $(RTOS_SOURCE)\list.c  -DMPLAB_PIC18F_PORT -Ls -Opa+
              @mcc18 -p=18F452    /I$(RTOS_SOURCE) /I$(RTOS_SOURCE_INCLUDE) /I$(RTOS_SOURCE_PORT) $(RTOS_SOURCE_PORT)\port.c  -DMPLAB_PIC18F_PORT -Ls -Opa+
              @mcc18 -p=18F452    /I$(RTOS_SOURCE) /I$(RTOS_SOURCE_INCLUDE) /I$(RTOS_SOURCE_PORT) /I$(RTOS_DEMO_COMMON_INCLUDE) $(RTOS_DEMO_PIC)\main1.c  -DMPLAB_PIC18F_PORT -Ls -Opa+
              @mcc18 -p=18F452    /I$(RTOS_SOURCE) /I$(RTOS_SOURCE_INCLUDE) /I$(RTOS_SOURCE_PORT) $(RTOS_MEM)\heap_1.c  -DMPLAB_PIC18F_PORT -Ls -Opa+
              @mcc18 -p=18F452    /I$(RTOS_SOURCE) /I$(RTOS_SOURCE_INCLUDE) /I$(RTOS_SOURCE_PORT) /I$(RTOS_DEMO_COMMON_INCLUDE) $(RTOS_SERIAL)\serial.c  -DMPLAB_PIC18F_PORT -Ls -Opa+
              @mcc18 -p=18F452    /I$(RTOS_SOURCE) /I$(RTOS_SOURCE_INCLUDE) /I$(RTOS_SOURCE_PORT) /I$(RTOS_POLLQ_INCLUDE) $(RTOS_POLLQ)\pollq.c  -DMPLAB_PIC18F_PORT -Ls -Opa+
              @mcc18 -p=18F452    /I$(RTOS_SOURCE) /I$(RTOS_SOURCE_INCLUDE) /I$(RTOS_SOURCE_PORT) /I$(RTOS_POLLQ_INCLUDE) $(RTOS_POLLQ)\integer.c  -DMPLAB_PIC18F_PORT -Ls -Opa+
               @mcc18 -p=18F452    /I$(RTOS_SOURCE) /I$(RTOS_SOURCE_INCLUDE) /I$(RTOS_SOURCE_PORT) /I$(RTOS_POLLQ_INCLUDE) $(RTOS_PARA)\partest.c  -DMPLAB_PIC18F_PORT -Ls -Opa+
                 @mcc18 -p=18F452    /I$(RTOS_SOURCE) /I$(RTOS_SOURCE_INCLUDE) /I$(RTOS_SOURCE_PORT) /I$(RTOS_POLLQ_INCLUDE) $(RTOS_POLLQ)\print.c  -DMPLAB_PIC18F_PORT -Ls -Opa+
          
          mplink /l c:\mcc18\lib f:\rtos\demo\pic\18f452.lkr  tasks.o list.o port.o queue.o main1.o heap_1.o  serial.o  pollq.o integer.o partest.o  print.o  /o main.cof 

    erase  *.o
   
   
M.kathiresan M.SC
SUB DIVISIONAL ENGINEER
MOBILE COMMUNICATION
BSNL
INDIA