|
|
View previous topic :: View next topic |
Author |
Message |
iw2nzm Guest
|
PIC18F4520 bootloader question |
Posted: Sun Nov 26, 2006 11:41 am |
|
|
Hi,
I'm new to bootloaders. I have a PIC18F4520 with a 10Mhz oscillator.
I need to update firmware via RS232. I would like to send an 'upgrade' command and then reset the micro with reset_cpu() function.
After the reset the bootloader should wait for a while and if the host send a start command begin the update.
I modified the bootloader example in this way:
Code: |
#elif defined(__PCH__)
#include <18F452.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+30
#endif
void application(void) {
while(TRUE);
}
#if defined(__PCH__)
#org 0x40,0x7F
#else
#org 0x20,0x3F
#endif
void main(void)
{
long timeout;
timeout=0;
while(!kbhit() && (++timeout < (100000)))
delay_us(10);
if(kbhit())
load_program();
application();
}
#ORG default
#int_global
void isr(void) {
jump_to_isr(LOADER_END+5*(getenv("BITS_PER_INSTRUCTION")/8));
}
|
I get this error:
error - 71: out of ROM, a segment or the program is too large. Main.
I guess it is due the change I made: the new code size is greater than the example. However, I don't know how fix it. Is there a problem with an #ORG directive?
Could anyone help me, please?
Than you
Marco / iw2nzm |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Nov 26, 2006 12:56 pm |
|
|
That's not the full error message. I put your program into MPLAB
and compiled it with PCH vs. 3.249. I got this:
Quote: |
Error 71 "C:\Program Files\PICC\Projects\PCH_Test\PCH_Test.c"
Line 74(0,1): Out of ROM, A segment or the program is too large
main Seg 00040-0007E, 0040 left, need 0046
|
The last line is a major clue. You have this line in your code:
What should be done to that line of code to increase the segment size ?
Get the current CCS manual:
http://www.ccsinfo.com/downloads.php
Look in the section on #org. How are the two numbers in the #org
statement used ? Which one should you change ? |
|
|
iw2nzm Guest
|
|
Posted: Sun Nov 26, 2006 3:23 pm |
|
|
PCM programmer wrote: | The last line is a major clue. You have this line in your code:
What should be done to that line of code to increase the segment size ?
[...] How are the two numbers in the #org
statement used ? Which one should you change ? |
Well, I guess I should change the first parameter. I replaced it with a smaller one and now it works. I'm trying to download new firmware now.
Thank you
Marco / iw2nzm |
|
|
Vamsi Guest
|
Sameproblem |
Posted: Wed Nov 14, 2007 2:34 pm |
|
|
Hi guys,
i still have the same problem. Though i change 0x40 to a lower value i still get the same error.
Can anyone help me in this ? Actually i am using PIC18F4520.h and not 18F452
Thank you,
Vamsi |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Wed Nov 14, 2007 3:54 pm |
|
|
Vamsi, please stick to your original thread.
Posting in an old thread from someone with similar but slightly different problems is confusing and will not get you the correct answers. |
|
|
|
|
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
|