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

Application not at the address where it should be (#org)

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



Joined: 02 Mar 2015
Posts: 19

View user's profile Send private message

Application not at the address where it should be (#org)
PostPosted: Mon Mar 16, 2015 3:43 am     Reply with quote

Hello forum, I got a little problem. I'm using a pic24hj256gp610 and ccs compiler 5.040

I managed to get the bootloader (CCS example bootloader) to run with no problems. I have modified the bootloader and made the code easier, because I didn't need all of those #if codes etc.

When I define the LOADER_SIZE and LOADER_END to for example 0xFBFF and include the header file into my application it locates it just fine. The first address which is in the .lst file of the application is 0xFC00.
This is a part the code of the header file.

Code:
.
.
.
#define LOADER_SIZE 0x0FBFF
#define LOADER_END 0x0FBFF
#define LOADER_ADDR (LOADER_END - LOADER_SIZE)
.
.
.
#ifndef _bootloader
 #ifdef BOOTLOADER_AT_START
  #build (reset=LOADER_END+1,interrupt=LOADER_END+5)
  #org 0, LOADER_END {}
#endif
#endif


But as soon as I define the Bootloader size to 0xFFFF or above, the application doest start at the desired address anymore.

I know that the #org directive only works with a maximum size of 64KB. I tried using two #org directives as mentioned in this thread.

http://www.ccsinfo.com/forum/viewtopic.php?p=118042
and this
http://www.ccsinfo.com/forum/viewtopic.php?t=31941

but the first address in the application .lst file is still not the address i planned it to.

my current code looks like this

Code:
#define LOADER_SIZE 0xFFFF
#define LOADER_END 0xFFFF
#define LOADER_ADDR (LOADER_END - LOADER_SIZE)

#ifndef _bootloader
 #ifdef BOOTLOADER_AT_START
  #build (reset=LOADER_END+1,interrupt=LOADER_END+5)

    #if LOADER_END > 0x0FFFF
    #org 0x00000, 0x0FFFF {}
    #org 0x10000, LOADER_END {}
    #else
    #org 0x00000, LOADER_END {}
    #endif

#endif
#endif


the first address in the .lst file is 0x0000

I've tried to #org the main in the application .c file but it don't change anything.


can somebody help me or explain why it is like this?
Ttelmah



Joined: 11 Mar 2010
Posts: 19327

View user's profile Send private message

PostPosted: Mon Mar 16, 2015 2:13 pm     Reply with quote

Have you tried using the first ORG as shown, rather than changing the start address to 0?.
Note that PCM programmer leaves space for the bottom of memory jump instruction, when setting up this first ORG.
PIC24H



Joined: 02 Mar 2015
Posts: 19

View user's profile Send private message

PostPosted: Tue Mar 17, 2015 6:56 am     Reply with quote

Ttelmah wrote:
Have you tried using the first ORG as shown, rather than changing the start address to 0?.
Note that PCM programmer leaves space for the bottom of memory jump instruction, when setting up this first ORG.


Which first ORG do you mean? This one? Leaving the 08? My MAX_LOADABLE is 0xFFFF

Code:
#if getenv("FUSE_SET:WDT")==TRUE
#define MAX_LOADABLE 0x16800   
#else
#define MAX_LOADABLE 0x16820   
#endif


#if MAX_LOADABLE > 0x0FFFF
#org 0x00008, 0x0FFFF {}   
#org 0x10000, MAX_LOADABLE {}
#else
#org 0x00008, MAX_LOADABLE {}
#endif


I have tried that and now the GOTO is at address 104AC in the .lst file.
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