CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug Reports on this forum. Send them to support@ccsinfo.com

Bootload CCS example

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
cvargcal



Joined: 17 Feb 2015
Posts: 98

View user's profile Send private message

Bootload CCS example
PostPosted: Fri May 03, 2019 1:18 pm     Reply with quote

Hi, I want use the this example bootlooader, but no compiler


Code:
///////////////////////////////////////////////////////////////////////////
////                      EX_BOOTLOADER.C                              ////
////                                                                   ////
////  This program is an example stand alone bootloader.               ////
////                                                                   ////
////  This program must be loaded into a target chip using a device    ////
////  programmer.  Afterwards this program may be used to load new     ////
////  versions of the application program.                             ////
////                                                                   ////
////  This bootloader is designed to detect pin B5 low on reset.  It   ////
////  will then use the RS232 link to download a new program.          ////
////  Otherwise the application program is started.                    ////
////                                                                   ////
////  Use an RS232 link and the SIOW.EXE or CCS_BOOTLOADER.exe program ////
////  to load a new HEX file into the target chip.                     ////
////                                                                   ////
////  Uncomment the define BOOTLOADER_MODE2X to use an alternate       ////
////  bootloader that receives each line in the hex file twice and     ////
////  compares them before acknowledging the line and writing it to    ////
////  the target chip's memory.  This mode only works with the         ////
////  CCS_BOOTLOADER.exe program, add MODE2X to the command line to    ////
////  use this mode.                                                   ////
////                                                                   ////
////  This example will work with the PCM and PCH compilers.  The      ////
////  following conditional compilation lines are used to include a    ////
////  valid device for each compiler.  Change the device, clock and    ////
////  RS232 pins for your hardware if needed.                          ////
///////////////////////////////////////////////////////////////////////////
////     (C) Copyright 1996,2014,2018 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.                ////
///////////////////////////////////////////////////////////////////////////

#include <18LF26K22.h>
#use delay( crystal=20MHz )
#use rs232(icd)                                  //Text through the ICD
//#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7) //Text through the UART
#define PUSH_BUTTON PIN_A4

#define _BOOTLOADER
//#define BOOTLOADER_MODE2X

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

 #org LOADER_END+1,LOADER_END+2

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));
}



Error

*** Error 71 "main.c" Line 73(1,2): Out of ROM, A segment or the program is too large application
Seg 00500-00500, 0002 left, need 00004 Orged

What its the solution please?

I am new with the bootlooder, I want update the PIC across the net by one module TPC to TTL. So my idea is update firmware remotely
PCM programmer



Joined: 06 Sep 2003
Posts: 20759

View user's profile Send private message

PostPosted: Fri May 03, 2019 2:33 pm     Reply with quote

Did you edit that file ? Or maybe you have an older compiler ?
You have the #org statement used with 16F PICs (PCM compiler),
but your PIC uses the PCH compiler. So you really need the statement
shown in bold below.

The current compiler has #if statements to automatically select the
correct #org statement. See below:
Quote:
#if defined(__PCM__)
#org LOADER_END+1,LOADER_END+2
#elif defined(__PCH__)
#org LOADER_END+2,LOADER_END+4
#endif
cvargcal



Joined: 17 Feb 2015
Posts: 98

View user's profile Send private message

PostPosted: Sat May 04, 2019 5:51 pm     Reply with quote

PCM programmer wrote:
Did you edit that file ? Or maybe you have an older compiler ?
You have the #org statement used with 16F PICs (PCM compiler),
but your PIC uses the PCH compiler. So you really need the statement
shown in bold below.

The current compiler has #if statements to automatically select the
correct #org statement. See below:
Quote:
#if defined(__PCM__)
#org LOADER_END+1,LOADER_END+2
#elif defined(__PCH__)
#org LOADER_END+2,LOADER_END+4
#endif


Yes, Now work!
Thanks
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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