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 Problem

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



Joined: 19 Jul 2005
Posts: 8

View user's profile Send private message

# ORG Problem
PostPosted: Tue Jul 19, 2005 7:32 am     Reply with quote

I am using the bootloader and Quick Programmer P1618QP to download a c file for 18F6621 pic microcontroller. The boot block is from 0x0000 to 0x0800.
When I use # org 0x0800 the compiler gives me an error message INVALID ORG RANGE. Is there a solution to this?
Code:

# org 0x0800
void main(void)
Ttelmah
Guest







PostPosted: Tue Jul 19, 2005 9:52 am     Reply with quote

Look at how it is done in the example files, bootload.c, and bootloader.h.
#ORG, _must_ have an 'end' address, as well as a start address. You can only use it with a single variable, where you have already defined a segment, and put the extra code after this.
So the syntax to move 'main' (remember it'll still put the reset vector at address 0, and the interrupt vector code just above this - if you need to move these, the #build command is needed) is:

#ORG 0x800, getenv("PROGRAM_MEMORY")-1 DEFAULT

This will then ensure that this becomes the 'default' location for the remaining code as well.

Best Wishes
shital



Joined: 19 Jul 2005
Posts: 8

View user's profile Send private message

PostPosted: Wed Jul 20, 2005 8:26 am     Reply with quote

Thank You for your reply

I tried using #ORG 0x800, getenv("PROGRAM_MEMORY")-1 DEFAULT
before main but the compiler gives me the following error messages.


-- Info 300 "C:\V3\test.c" Line 4018(40,41): More info: Segment at 00000-0FBFE (0000 used)
--- Info 300 "C:\V3\test.c" Line 4018(40,41): More info: Segment at 0FC00-0FC1E (0000 used) Priv
--- Info 300 "C:\V3\test.c" Line 4018(40,41): More info: Segment at 0FC20-0FFFE (0000 used)
--- Info 300 "C:\V3\test.c" Line 4018(40,41): More info: Attempted to create: 00800-0FFFE for #org
*** Error 126 "C:\V3\test.c" Line 4018(40,41): Invalid ORG range

Can you help please?
shital



Joined: 19 Jul 2005
Posts: 8

View user's profile Send private message

still having org problems
PostPosted: Wed Jul 20, 2005 8:43 am     Reply with quote

I tried using a start addr and end addr and used # org like it is used in bootloader.c

#org 0x40,0x7F
void main(void)
{
if(!input(PIN_B5))
load_program();
}

#org default
void load_program(void)
{
int i;
i = 1;
return;
}

but I still get an error message as follows when I try to compile.

main
Seg 00040-0007E, 0040 left, need 00CC
0000

*** Error 71 "C:\trial\test.c" Line 4148(0,1): Out of ROM, A segment or the program is too large. I tried increasing the org range but i still get the same error.


I am using the PIC18f6621 and actually want to start my main at 800h and my interrupt code at 808h and 818h. The reset vector can be at 0.

I am trying to use the Quick Programmer P1618QP to download the code.
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