|
|
View previous topic :: View next topic |
Author |
Message |
vamsi_ak Guest
|
PIC18F4520 Bootloader |
Posted: Wed Nov 14, 2007 11:50 am |
|
|
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
|
|
Posted: Wed Nov 14, 2007 3:05 pm |
|
|
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 |
Posted: Wed Nov 14, 2007 3:29 pm |
|
|
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
to
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
|
|
Posted: Wed Nov 14, 2007 4:01 pm |
|
|
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 |
Posted: Wed Nov 14, 2007 5:02 pm |
|
|
Thank you...it helped i am able to work on it now..... |
|
|
|
|
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
|