|
|
View previous topic :: View next topic |
Author |
Message |
rikotech8
Joined: 10 Dec 2011 Posts: 376 Location: Sofiq,Bulgariq
|
Bootloader example don't compile |
Posted: Sun Mar 10, 2013 11:56 am |
|
|
Hello!
I'm trying to create bootloader by modifying the example provided by CCS but I get an error at one of the loader.c lines.
Here is the code I made:
Code: |
#include <16F873A.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=16000000)
#use rs232(baud=9600, xmit=PIN_C2, rcv=PIN_C3,ERRORS)
#include <bootloader.h>
#include <loader.c>
#org LOADER_END+1,LOADER_END+10
void application(void) {
while(TRUE);
}
#org 0x20,0x3F
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 line of the error is
Code: | #ORG LOADER_ADDR+10, LOADER_END auto=0 default |
(this line is in loader.c the driver I have inserted)
The error I get is : Invalid ORG range
Where I'm wrong? _________________ A person who never made a mistake never tried anything new. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9229 Location: Greensville,Ontario
|
|
Posted: Sun Mar 10, 2013 6:45 pm |
|
|
Have you actually got the examples supplied by CCS to compiler and execute correctly? |
|
|
jeremiah
Joined: 20 Jul 2010 Posts: 1349
|
|
Posted: Sun Mar 10, 2013 7:50 pm |
|
|
You have 2 #org statements that have overlapping addresses. You can see that by comparing the #org in your code with the one in the error line. You should probably take a step back and really make sure you know where things go. From my own experience, a large % of bootloader problems come from stuff not placed in the right address locations. |
|
|
rikotech8
Joined: 10 Dec 2011 Posts: 376 Location: Sofiq,Bulgariq
|
|
Posted: Mon Mar 11, 2013 2:32 am |
|
|
Thank you guys!
I saw my mistake was not using complete example bootloader.c
Now the code compiles fine!
New bootloader code is:
Code: |
#include <16F873A.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=16M)
#use rs232(baud=9600, xmit=PIN_C2, rcv=PIN_C3,ERRORS)
#define _bootloader
#include <bootloader.h>
#include <loader.c>
#org LOADER_END+1,LOADER_END+10
void application(void) {
while(TRUE);
}
#org 0x20,0x3F
void main(void) {
if(!input(PIN_B5))
{
printf("Ready...");
load_program();
}
application();
}
#ORG default
#int_global
void isr(void) {
jump_to_isr(LOADER_END+5*(getenv("BITS_PER_INSTRUCTION")/8));
}
|
The code to send:
Code: |
#include <16F873A.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=16M)
#use rs232(baud=9600, xmit=PIN_C2, rcv=PIN_C3,ERRORS)
#include <bootloader.h>
void main(void)
{
char c;
delay_ms(100);
while (true)
{
c = getc();
putc(c);
}
} |
How to send my second code. I guess I need special software for my PC.
I tried to use this one http://www.etc.ugal.ro/cchiculita/software/picbootloader.htm
but it can't establish communication with my PIC. Apparently I need another software.
I have heard that I can use hyperterminal, or Serial Input/Output Monitor(siow provided by CCS), but I don't know how to load the hex file to be send.
Thank you in advance! _________________ A person who never made a mistake never tried anything new. |
|
|
|
|
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
|