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

Still having problems with # org

 
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

Still having problems with # org
PostPosted: Wed Jul 20, 2005 9:06 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. I want to start my main at 800h and my interrupt code at 808h and 818h. The reset vector can be at 0.

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

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. Please help and Thank You in advance
Ttelmah
Guest







PostPosted: Wed Jul 20, 2005 9:32 am     Reply with quote

The reason you are getting errors in the top syntax (which is the correct one), is that you have ICD enabled, and this requires space at the top of memory. You need to exclude the area used for the ICD. In your case it looks as if the stuff starts at 0FBFE. So you would need to use:

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

You are missing a lot of the org controls from bootloader. If you study what is being done, it always loads the 'bootloader.h' file, which assigns the space for the bootloader, then assigns the main code beyond this. You need to look at th complete code, not just the stuff in main.

Best Wishes
Guest








PostPosted: Fri Jul 22, 2005 9:23 am     Reply with quote

Thank you very much .
The solution worked when I dont use delay routines and interrupts.
I am still trying to figure out how to change that so that there is no code above 800h. Also since my code is very long I am trying to use different # org for all the functions so that it is not out of a ROM page.
Guest








PostPosted: Fri Jul 22, 2005 9:37 am     Reply with quote

" I am using an 18F6520. In the INI file, I changed (pmrangelow="000800"). The C init module I changed to (#pragma code _entry_scn=0x000800). "

I found this quote in an old message in a different forum. But when I tried to use # pragma the compiler gave me an error message . Can someone plz tell me how to use # pragma in this context
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

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

PostPosted: Fri Jul 22, 2005 10:56 am     Reply with quote

You need to read the CCS manual. The statement you posted is for the Microchip C18 compiler. It will not work with CCS.
Guest








PostPosted: Fri Jul 22, 2005 11:03 am     Reply with quote

Thank you for making me aware

Is there a statement in CCS C compiler which can be used in a similar way?
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

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

PostPosted: Fri Jul 22, 2005 11:10 am     Reply with quote

For one, you should register. Its too confusing to know who guest is.

The program that you have listed is for the Microchip Bootloader. I am not aware of anyone who has ported it to CCS.

The similar statements are #build and #org
shital



Joined: 19 Jul 2005
Posts: 8

View user's profile Send private message

PostPosted: Fri Jul 22, 2005 12:17 pm     Reply with quote

I am using #ORG 0x800, getenv("PROGRAM_MEMORY")-0x401 DEFAULT
as suggested on this forum ( and I am really grateful for that).

It works well for a small code. But when I try to use it for my actual code
I get this error message.

Error 71 "C:\Software\TX3 Code\Transmitter 3.c" Line 4129(0,1): Out of ROM, A segment or the program is too large
Halting build on first failure as requested.
BUILD FAILED: Fri Jul 22 13:48:33 2005

So I am trying to give several different ORG range for the functions before main. But I get error messages again.

Something like

Error 126 "C:\Software\TX3 Code\Transmitter 3.c" Line 181(21,22): Invalid ORG range
--- Info 300 "C:\Software\TX3 Code\Transmitter 3.c" Line 191(21,22): More info: Segment at 00000-0FBFE (0000 used)
--- Info 300 "C:\Software\TX3 Code\Transmitter 3.c" Line 191(21,22): More info: Segment at 0FC00-0FC1E (0000 used) Priv
--- Info 300 "C:\Software\TX3 Code\Transmitter 3.c" Line 191(21,22): More info: Segment at 0FC20-0FFFE (0000 used)
--- Info 300 "C:\Software\TX3 Code\Transmitter 3.c" Line 191(21,22): More info: Attempted to create: 0D000-00000 for #org
*** Error 126 "C:\Software\TX3 Code\Transmitter 3.c" Line 191(21,22): Invalid ORG range

I dont know what I am doing wrong .

All I want to do is start my code from 800h and map the interrupt vectors to 808h and 818h

I am trying to use P1618QP Quick Programmer from microchip to download the code.

Apparently it is working for me only if I start my code at 800h .
(I tested it using assembly)

I am using PIC18F6621 and added this device in the .ini file.

[DEVICELIST]

85="PIC18F6621"

[PIC18F6621]
writeblock=8
readblock=1
eraseblock=64
devicetype=1
maxpacketsize=128
bytesperaddr=1
pmrangelow="000800"
pmrangehigh="00FFFF"
eerangelow="000000"
eerangehigh="0003FF"
usrrangelow="200000"
usrrangehigh="20000F"
cfgrangelow="300000"
cfgrangehigh="30000F"
300001="CONFIG1H"
300002="CONFIG2L"
300003="CONFIG2H"
300004="CONFIG3L"
300005="CONFIG3H"
300006="CONFIG4L"
300008="CONFIG5L"
300009="CONFIG5H"
30000A="CONFIG6L"
30000B="CONFIG6H"
30000C="CONFIG7L"
30000D="CONFIG7H"

I assumed the Quick Programmer would load it from 800h since pmrangelow is 800. But no such luck.

Can someone plz help
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

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

PostPosted: Fri Jul 22, 2005 12:42 pm     Reply with quote

How large is your program?
shital



Joined: 19 Jul 2005
Posts: 8

View user's profile Send private message

PostPosted: Fri Jul 22, 2005 12:51 pm     Reply with quote

The program is about 40 k long .

from 0x0000 to 0x944e
shital



Joined: 19 Jul 2005
Posts: 8

View user's profile Send private message

PostPosted: Fri Jul 22, 2005 12:54 pm     Reply with quote

I had made a mistake which I corrected but I am still getting this error.
I am trying to change the range and see what happens.

>>> Warning 216 "C:\Software\TX3 Code\Transmitter 3.c" Line 4136(0,1): Interrupts disabled during call to prevent re-entrancy: @@DIV88
@@PRINTF_D_1072
Seg 0C000-0DFFE, 0038 left, need 00FA
0000
Seg 0E000-0FBFE, 1B2A left, need 00FA
0000
Seg 0FC00-0FC1E, 0020 left, need 00FA
0000

disp_tx3_settings

InitSystem

main

*** Error 71 "C:\Software\TX3 Code\Transmitter 3.c" Line 4136(0,1): Out of ROM, A segment or the program is too large
Halting build on first failure as requested.
BUILD FAILED: Fri Jul 22 14:51:50 2005
shital



Joined: 19 Jul 2005
Posts: 8

View user's profile Send private message

PostPosted: Fri Jul 22, 2005 1:20 pm     Reply with quote

It is still giving me the same error messages just with different numbers needed and left.

My origin range is not greater then 0xfff at any time

Can someone tell wht is the meaning of this message

Seg 0A000-0AFFE, 00AA left, need 00B6
0000
Seg 0B000-0FBFE, 4B2A left, need 00B6
0000
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