bootloader problemas help!!!

Software e Hardware para uC PIC

Moderadores: andre_luis, 51, guest2003, Renie

bootloader problemas help!!!

Mensagempor lucasromeiro » 13 Nov 2015 20:26

Olá galera, tudo bem?
estou com dificuldades para fazer o bootloader funcionar...
uso o pic: 18LF2685
ccs versao: 5.008

existem algumas questoes:

1- preciso modificar e gravar o bootloader que vem no ccs, isso foi feito! OK
2- preciso gravar o meu codigo novo via serial, isso foi feito! OK
3- preciso modificar algo no meu codigo para que ele funcione corretamente! carrego o codigo, mas nao funciona.

Entao aí começam os problemas...
li que preciso por alguns codigos dentro do meu codigo:
-include na biblioteca bootloader
-por alguns defines, #org, #build, #define LOADER_END, #define LOADER_SIZE etc....

entao ficou muito confuso!
Acredito que é algo simples, mas nao estou entendendo!

me falaram que com eu modifiquei o bootloader, preciso de codigos especificos e tal, mas como consigo isso? como funciona?



olhem meus codigos:

bootloader:
Código: Selecionar todos


#include "18LF2685.h"
#device ADC = 16

#FUSES NOWDT       //No Watch Dog Timer
#FUSES WDT128      //Watch Dog Timer uses 1:128 Postscale
#FUSES NOBROWNOUT  //No brownout reset
#FUSES NOPBADEN    //PORTB pins are configured as digital I/O on RESET
#FUSES NOLVP       //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES BBSIZ1K     //1K words Boot Block size
#FUSES NOXINST     //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES PROTECT     //Code protected from reads
#use delay(crystal = 20000000)
#use rs232(baud = 115200, parity = N, xmit = PIN_C6, rcv = PIN_C7, bits = 8) //, stream = Modem)
#use i2c(Master, Fast, sda = PIN_C4, scl = PIN_C3)



#define PUSH_BUTTON PIN_B3


#define _bootloader

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

#if defined(__PCM__)
 #org LOADER_END+1,LOADER_END+2
#elif defined(__PCH__)
 #org LOADER_END+2,LOADER_END+4
#endif
void application(void) {
  while(TRUE);
}

void main(void) {

   if(!input(PUSH_BUTTON))
   {
      printf("\r\nBootloader Version 1.0\r\n");
   
      // Let the user know it is ready to accept a download
      printf("\r\nWaiting for download...");
      load_program();
   }
 
   //application(); <<<<<<<<

}

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


meu codigo:
Código: Selecionar todos

#include "18LF2685.h"
#device ADC = 16

#FUSES NOWDT       //No Watch Dog Timer
#FUSES WDT128      //Watch Dog Timer uses 1:128 Postscale
#FUSES NOBROWNOUT  //No brownout reset
#FUSES NOPBADEN    //PORTB pins are configured as digital I/O on RESET
#FUSES NOLVP       //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES BBSIZ1K     //1K words Boot Block size
#FUSES NOXINST     //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES PROTECT     //Code protected from reads
#use delay(crystal = 20000000)
#use rs232(baud = 115200, parity = N, xmit = PIN_C6, rcv = PIN_C7, bits = 8) //, stream = Modem)
#use i2c(Master, Fast, sda = PIN_C4, scl = PIN_C3)


#define LOADER_END
#include <bootloader.h>
#include "ds1307.c"
#include "mc342.c"
#include "24025.c"
#include "STRING.h"

lucasromeiro
Byte
 
Mensagens: 121
Registrado em: 22 Out 2009 20:32

Voltar para PIC

Quem está online

Usuários navegando neste fórum: Nenhum usuário registrado e 1 visitante

x