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

I want to a few question ask about Bootloader.

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



Joined: 13 Jul 2017
Posts: 135
Location: IZMIR

View user's profile Send private message Send e-mail

I want to a few question ask about Bootloader.
PostPosted: Wed Oct 23, 2019 1:56 am     Reply with quote

Code:

#org LOADER_END+2, LOADER_END+4   
This code what does it do?

LOADER_END+2 and LOADER_END+4 what is happening

ccs c  version 5.090

Process steps;
1- In the project wizard I selected processor 18f67j60.
2- I set the crystal and clock speeds to 25MHz.
3- In the project wizard, I clicked on the bootloder option. and I chose PUSH_BUTTON according to 3.3v ethernet Controller Development kit. (PIN_A4)
4- I did the coding.
5- After writing my code, I clicked Build & Run button and upload my program.
6- I run Serial Monitor from Tools option. I made my adjustments. I chose my com port. Then I pressed Reset and PUSH_BUTON. I saw Bootloader Version 1.0 and Waiting For Dowland. From the File menu, clicked Dowload Software. And I loaded my deneme.hex code.
8- Then I made changes to my code. I changed Version 1.0 to Version 1.1 and rebuild it. Then I pressed Reset and PUSH_BUTON again and uploaded deneme.hex file. Now I need to write Version 1.1 on my screen. Why does it say Version 1.0?

my code
#include <18F67J60.h>
#device ADC=10

#FUSES NOWDT                  //No Watch Dog Timer

#use delay(crystal=25MHz)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)             
#define _bootloader

// NOTE - User must include bootloader.h in application program
#include <bootloader.h>
#include <loader.c>
                                   
#define PUSH_BUTTON PIN_A4
     
float version=1.2;                                                                           
#INT_GLOBAL
void isr(void){                                                 
   jump_to_isr(LOADER_END+9*(getenv("BITS_PER_INSTRUCTION")/8));   
 
}
                             
#org LOADER_END+2, LOADER_END+4   
void application(void) {                             
  while(TRUE);
}                                                             

void main()                                                                                                                                                       
{   

   setup_adc_ports(NO_ANALOGS, VSS_VDD);                         
 
   // Enter Bootloader if Pin A4 is low after a RESET         
   if(!input(PIN_A4))                                                                                         
   {                                                                       
      printf("\r\nBootloader Version:%2.1f\r\n",version);
                                                                                               
      // Let the user know it is ready to accept a download           
      printf("\r\nWaiting for download ");           
      load_program();
   }                                                   
   printf("\r\nBootloader Version:%2.1f\r\n",version);
                                                              
   application();                                                           
                                                                     
}


_________________
Es
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Wed Oct 23, 2019 2:10 am     Reply with quote

#define _bootloader

This define must only be present in the actual bootloader, not in the
application that is to be loaded. With this present the code will be built
to locate where the bootloader sits, and the bootloader will _not_ load
the code if this is the case. Hence your new code has not been loaded.

Don't 'trust' the wizard, you will waste a lot of time if you do.
Instead look at the examples. The example ex_bootload.c shows how
a file that is going to be 'bootloaded' has to appear.

The ORG statements say 'where' the following code is going to be located
in memory. So in this case, just after the bootloader.
ertansuluagac



Joined: 13 Jul 2017
Posts: 135
Location: IZMIR

View user's profile Send private message Send e-mail

PostPosted: Wed Oct 23, 2019 2:18 am     Reply with quote

Understood. But, ex_bootlooder.c file when I compile give error.
Errors given:

>>> Warning 205 "C:\Program Files (x86)\PICC\Drivers\loader.c" Line 185(1,1): Unsigned variable is never less than zero
*** Error 71 "C:\Users\Technopc\AppData\Roaming\PICC\ex_bootloader.c" Line 73(1,2): Out of ROM, A segment or the program is too large MAIN
Seg 00000-00003, 0000 left, need 00049 Reserved
Seg 00004-0000E, 0000 left, need 00049 Orged
Seg 0000F-0033F, 0000 left, need 00049
Seg 00340-00341, 0000 left, need 00049 Orged
Seg 00342-007FE, 04BD left, need 00049 Reserved
Seg 007FF-007FF, 0001 left, need 00049 Reserved
Seg 00800-00FFE, 07FF left, need 00049 Reserved
Seg 00FFF-00FFF, 0001 left, need 00049 Reserved
Seg 01000-017FE, 07FF left, need 00049 Reserved
Seg 017FF-017FF, 0001 left, need 00049 Reserved
Seg 01800-01FFE, 07FF left, need 00049 Reserved
Seg 01FFF-01FFF, 0001 left, need 00049 Reserved

1 Errors, 1 Warnings.
Build Failed.
_________________
Es
ertansuluagac



Joined: 13 Jul 2017
Posts: 135
Location: IZMIR

View user's profile Send private message Send e-mail

PostPosted: Wed Oct 23, 2019 2:58 am     Reply with quote

Okay. It works. Thanks.
_________________
Es
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Wed Oct 23, 2019 3:04 am     Reply with quote

Er. You said you had the bootloader already compiled and installed in
the chip. So why are you touching bootloader.c?.

Sequence as follows:

Bootloader.c
Edit to match _your_ chip. Compile, and load into the chip with a
programmer. Don't touch it again.

Your_program.c
Add the #include for bootloader.h
Compile. Then load with the serial.

That is all that is involved. You should not be touching the bootloader
at this point.

The bootloader, and the application are separate. Combing the bootloader
with the application can be done, but is honestly more trouble than it
is worth.
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