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

[SOLVED] CCS places string handler outside of #ORG range

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



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

[SOLVED] CCS places string handler outside of #ORG range
PostPosted: Mon Oct 18, 2010 10:29 am     Reply with quote

So I've been playing with the CCS bootloader and I noticed that the printf handler in the bootloader code is being placed OUTSIDE the range the bootloader is supposed to live in.

If I define the application to take up all the space that isn't bootloader space, I get a compiler error that says there's no space available (when there is). If I back off the application zone definition, those items are inserted right after the "end" of application space and the compile succeeds.

It's obvious what it is as the "CALL PSTRINGC_115200_31764_31765" points to:

Code:

  FC00    0009     TBLRD*+  (label is  @PSTRINGC_115200_31764_31765)
  FC02    52F5     MOVF 0xff5, F, ACCESS
  FC04    E00D     BZ 0xfc20
  FC06    CFF6     MOVFF 0xff6, 0x4f
  FC0A    CFF7     MOVFF 0xff7, 0x50
  FC0E    50F5     MOVF 0xff5, W, ACCESS
  FC10    A8A4     BTFSS 0xfa4, 0x4, ACCESS
  FC12    D7FE     BRA 0xfc10
  FC14    6EA9     MOVWF 0xfa9, ACCESS
  FC16    C04F     MOVFF 0x4f, 0xff6
  FC1A    C050     MOVFF 0x50, 0xff7
  FC1E    D7F0     BRA 0xfc00
  FC20    0C00     RETLW 0


I also noticed #USE RS232 with the ERRORS argument places the error handler out in the same space (after the pp) before the string handler when there's PLENTY of room in the bootloader's defined range.

Has anyone else noticed this and found a way to control it? (I've already emailed CCS about it as well)
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D


Last edited by bkamen on Mon Oct 18, 2010 2:13 pm; edited 1 time in total
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Mon Oct 18, 2010 10:42 am     Reply with quote

Because there may be various misunderstandings about the exact way, you are defining the said code locations, I would prefer to see an example, and also know about the compiler type and version.
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Mon Oct 18, 2010 10:51 am     Reply with quote

FvM wrote:
Because there may be various misunderstandings about the exact way, you are defining the said code locations, I would prefer to see an example, and also know about the compiler type and version.


Shoot. I thought I typed the version.

PCH 4.112 on PIC18F26J11

I'll have to write an example. (since posting the bootloader would be a no-no).

Let me get that in a bit.

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Mon Oct 18, 2010 2:15 pm     Reply with quote

Nevermind... I talked with Mark and it's just a matter of the #ORG placement.

In front of the #USE RS232, it does what I'd expect, BEHIND the #USE RS232 it was doing what I didn't expect.

Some of the pre-processor commands are really kinda location specific when it comes to some other pre-processor commands.

-Ben

EDIT: As it turns out though, strings (like printf("HELLO!\r\n"); ) are actually reserved in space OUTSIDE a controlling #ORG for a given function. I'm still looking into this with CCS.

So in the bootloader where I have #ORG 0x100 (where 0x100, 0x7FF) is the previously defined range, inside a function a PRINTF() and it's constant string can be found OUTSIDE 0x100-0x7FF someplace. Ouch.)

UPDATE: Ok, so where I was going wrong was the use of default with #ORG. I was following the CCS example which had a final #ORG default at the end of the bootloader.c followed by a #int_global.

I thought the #int_global needed the #org for whatever reason. But being the last #org WITH a DEFAULT seen by the compiler, it told the compiler that anyplace outside my bootloader region was ok to place constants and code which was undesired.

So I removed the #org, #int_global still went to 0x0008/18 and other stuff of concern got properly stuffed into the loader defined segment as desired.

Cheers -- Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
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