CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

#org error

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
pasini



Joined: 12 Dec 2005
Posts: 50
Location: Curitiba - Brazil

View user's profile Send private message Send e-mail

#org error
PostPosted: Mon Mar 27, 2006 8:11 am     Reply with quote

PIC18F8680 MPLAB 7.31 CCS 3.241

I created my own PIC18F8680 (PIC18F8680MEM) with extended memoru ap to 512288 program words.

I have a bootloader running in the internal memory of PIC and it is supposed to program the real app code to the external Flash program memory. External memory begins at 0x10000 and goes up to 0x80000 (19bits of address - 512kwords). The configuration I want is EMCU extended microcontroller mode, with internal and external program memories.

The problem is when I write the real code (that is supposed to begin at 0x10000) with #org directive.

Ok if I include only the #org 0x10000. If I try to include other #org´s the error appears again.

Code:
 
#include "18F8680MEM.h"
#device *=16 ADC=10
#fuses HS,NOWDT,NOPUT,NOPROTECT,BROWNOUT,NOLVP,NOCPD,NOWRT,EMCU#use delay(clock=20000000)
#use rs232(stream=RS232,baud=9600,xmit=PIN_C6,rcv=PIN_C7,parity=N,bits=8)
#case
#build(memory=0x10000:0x80000)

#define BASE 0x010000
#define BUZZER            PIN_C2
#define LigaBuzzer()      output_high(BUZZER)
#define DesligaBuzzer()      output_low(BUZZER)

#org 0x010000
void main(void)
{
   while(1)
   {   LigaBuzzer();
      delay_ms(150);
      DesligaBuzzer();
      delay_ms(50);       
   }
}

#org 0x010500,0x10600
void timer0(void)
{
}

#org 0x010700,0x010800
void timer2(void)
{
}


The error is
Quote:

--- Info 300 "teste.c" Line 125(1,9): More info: Attempted to create: 10700-10800 for #org
*** Error 126 "teste.c" Line 125(1,9): Invalid ORG range


Thanks
Pasini
Ttelmah
Guest







PostPosted: Mon Mar 27, 2006 9:02 am     Reply with quote

#build, puts the reset vector (start of the PIC code), at 0x10000. You can't then put main at the same spot (and in fact don't need to). The compiler will automatically put the 'code' into the area defined by 'build', with a jump to the 'main' at this point. If you define main far enough into memory to make room for the jump, it should compile without complaint.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group