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 CCS Technical Support

PIC18F4520 Bootloader

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







PIC18F4520 Bootloader
PostPosted: Wed Nov 14, 2007 11:50 am     Reply with quote

Hi all,

I am new to bootloaders. Can any one give me the code for 18F4520 bootloader. And how do i flash it on to my PIC.

Thank you,
Vamsi
curt2go



Joined: 21 Nov 2003
Posts: 200

View user's profile Send private message

PostPosted: Wed Nov 14, 2007 3:05 pm     Reply with quote

There is a ton of info alreay on that stuff. Search on bootloaders and you will get tons of info.. Hope that helps.. TTY
Vamsi
Guest







boot loader for 18F4520.h
PostPosted: Wed Nov 14, 2007 3:29 pm     Reply with quote

This is my code
Code:

#if defined(__PCM__)
#include <16F877.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)  // Jumpers: 8 to 11, 7 to 12

#elif defined(__PCH__)
#include <18F4520.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)  // Jumpers: 8 to 11, 7 to 12
#endif


#define _bootloader


#include <bootloader.h>
#include <loader.c>


#if defined(__PCM__)
 #org LOADER_END+1,LOADER_END+10
#elif defined(__PCH__)
 #org LOADER_END+2,LOADER_END+20
#endif
void application(void) {
  while(TRUE)
  {
  delay_ms(1000);
  output_toggle(PIN_B0);
  }
}

#if defined(__PCH__)
#org 0x20,0x7F
#else
#org 0x20,0x3F
#endif
void main(void) {
   if(!input(PIN_B5))
   {
      load_program();
   }

   application();
}

#ORG default

#int_global
void isr(void) {
   jump_to_isr(LOADER_END+5*(getenv("BITS_PER_INSTRUCTION")/8));
}



The error i get is
Out of ROM , A segment or the program is too large application
seg 00500-00512,014 left,need 0016

When i change the line
Code:
 #org 0x40,0x7F

to
Code:
 #org 0x15,0x7F


i get the following error
invalid ORG range

Please pass your suggestions

Thank you,
Vamsi
it gives the
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Wed Nov 14, 2007 4:01 pm     Reply with quote

The interrupt handlers are using the memory region from 0x0008 to about 0x0025. That's why you got a different error message after you changed the 0x40-0x7F region.

Have another close look at the error message
Quote:
Out of ROM , A segment or the program is too large application
seg 00500-00512,014 left,need 0016
The reserved memory region from 0x500 to 0x512 is two bytes too small. Search your source code for where this region is defined and increase it's size a little.
Vamsi
Guest







Thank you
PostPosted: Wed Nov 14, 2007 5:02 pm     Reply with quote

Thank you...it helped i am able to work on it now.....
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