ljbeng
Joined: 10 Feb 2004 Posts: 205
|
24FJ128GA106 bootloader |
Posted: Wed Aug 31, 2011 4:17 pm |
|
|
I have a bootloader from CCS that works great from a pc serial port to bootload a 24FJ128GA106.
I then modifed their example to work with a VNC1L-1A usb interface. This interfaces the serial port to files on a thumb drive.
The only modifcations I made were in the area the standard bootloader was sending xon/xoff, I am sending a request to read the next byte. I read an entire line of hex code, write it to the chip, then start requesting more data from the VNC1L.
I can get the file from the usb thumb drive to boot load once but the chip will not bootload again. The app will always run once bootloaded.
The file size is 1886 bytes with the code I had to add to enable the vnc1l and set it up to work for this application.
The newly bootloaded application will run after bootloaded. If I try to boot load again, the chip is basically dead and nothing happens. If I then just reset the chip, the bootloaded program runs again. It's like the chip knows I want to bootload again, it just does nothing.
Code: | ///////////////////////////////////////////////////////////////////////////
//// pcd_bootloader_stand_alone.h ////
//// ////
//// This include file must be included by any application loaded ////
//// by the example bootloader (ex_pcd_bootloader_stand_alone.c). ////
//// ////
//// The directives in this file relocates the reset vector as well ////
//// as reserving space for the bootloader. ////
///////////////////////////////////////////////////////////////////////////
//// (C) Copyright 1996,2009 Custom Computer Services ////
//// This source code may only be used by licensed users of the CCS ////
//// C compiler. This source code may only be distributed to other ////
//// licensed users of the CCS C compiler. No other use, ////
//// reproduction or distribution is permitted without written ////
//// permission. Derivative programs created using this software ////
//// in object code form are not restricted in any way. ////
///////////////////////////////////////////////////////////////////////////
#ifndef __BOOTLOADER_H__
#define __BOOTLOADER_H__
#define __BOOTLOADER_INCLUDED__ TRUE
#if (getenv("PROGRAM_MEMORY")%0x100==0)
#define LOADER_SIZE 0x7FF
#elif ((getenv("PROGRAM_MEMORY")+4)%0x100==0)
#define LOADER_SIZE 0x7FB
#elif ((getenv("PROGRAM_MEMORY")+8)%0x100==0)
#define LOADER_SIZE 0x7F7 //This is the correct size to use for this PIC. This was also incorrect in our example.
#endif
#endif
#if (getenv("FLASH_ERASE_SIZE")==2048)
#define RESET_VECTOR 0x200
#else
#define RESET_VECTOR 0x100
#endif
//BOOTLOADER AT END
// LOADER_END - This is the end of the general purpose bootload code.
#ifndef LOADER_END
#define LOADER_END (getenv("PROGRAM_MEMORY")-1)
#define LOADER_ADDR (LOADER_END-LOADER_SIZE)
#endif
#ifndef _bootloader
#build (reset=RESET_VECTOR)
#org LOADER_ADDR, LOADER_END {}
#endif
#ifdef _bootloader
//#include "loader_pcd_stand_alone.c"//if serial port bootloader
#include "gps_5_loader_usb.c"//if usb boot loader
#endif
|
|
|