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 CCS Technical Support

How to inform the compiler for a bootloader?

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



Joined: 11 Oct 2004
Posts: 13
Location: Sofia

View user's profile Send private message

How to inform the compiler for a bootloader?
PostPosted: Mon Oct 11, 2004 5:57 am     Reply with quote

Hi.

I'm a begginer with the CCS C.

Till now I used Pibasic pro and Proton+. When I want to tell the compiler that I'll load the HEX file into the PIC with a bootloader I only have to type:

Define loader_used 1 --> for PBP
Bootloader = 1 --> for Proton+

Now I have the CCS compiler, but I don't know what line I've to type to inform the compiler for the bootloader. My PIC is 18F452 and I intend to use the microcode loader.
Any help will be greatly appreciated.
_________________
Regards
Boyko
dvsoft



Joined: 28 Nov 2003
Posts: 46

View user's profile Send private message

PostPosted: Mon Oct 11, 2004 6:55 am     Reply with quote

bonjour

that depend of your bootloader
reserver is needed place in ROM for the code of the bootloader and to indicate the new location of the reset


Code:

//---------------------------------------------------------------------------
// BootLoader
//
#build(reset=0x200, interrupt=0x208)
#org  0x0000,0x01FF             // BootLoader Rom location
//---------------------------------------------------------------------------
void bootloader()
{
    #asm
    nop
    #endasm
}


I use the following code with my bootloader
Boyko



Joined: 11 Oct 2004
Posts: 13
Location: Sofia

View user's profile Send private message

PostPosted: Tue Oct 12, 2004 7:31 am     Reply with quote

Please help. I don't know what's wrong. I'm loading the HEX file with the Microcode loader, but the program doesn't work (i.e. the LED does not blink). Here it is the code:
Code:

#include <18F452.h>
#use delay(clock=4000000)

#define led PIN_D0

//---------------------------------------------------------------
// BootLoader
//
#build(reset=0x200)
#build(interrupt=0x208)
#org 0x0000,0x01ff
//---------------------------------------------------------------
void bootloader()
{
   #asm
   nop
   #endasm
}

main() {

   while(1==1) {
      output_low(led);
      delay_ms(1000);
      output_high(led);
      delay_ms(1000);
   }
}


What I have to do?
_________________
Regards
Boyko
Guest








PostPosted: Tue Oct 12, 2004 7:48 am     Reply with quote

you are missing all the fuses. When you you the wizard it sets them up for you. If you do it manually then you have to do it yourself

something like
Code:

#fuses NOWDT, NOLVP, H4 ......,


do a search on #fuses
Boyko



Joined: 11 Oct 2004
Posts: 13
Location: Sofia

View user's profile Send private message

PostPosted: Tue Oct 12, 2004 11:52 am     Reply with quote

Nope. This is not the problem. I've added the following line:

#fuses XT,NOPROTECT,NOLVP,NOWDT

but the led still does not blink.
May be the reset and interrupt vectors must be different?
_________________
Regards
Boyko
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Oct 12, 2004 11:57 am     Reply with quote

You keep referring to a bootloader which you call a "microcode loader".
What company makes this bootloader ? Can you post a link to their
website. If we know more about the bootloader, then we can possibly
tell you how to make it work with CCS.
Boyko



Joined: 11 Oct 2004
Posts: 13
Location: Sofia

View user's profile Send private message

PostPosted: Tue Oct 12, 2004 12:08 pm     Reply with quote

Microcode loader is a part from the Microcode studio, which is the IDE for Picbasic pro.
Here it is the link for the Microcode loader part:

http://www.mecanique.co.uk/code-studio/loader/index.html

I can send you the microcode loader if it helps.
_________________
Regards
Boyko
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Oct 12, 2004 12:43 pm     Reply with quote

I read their page. This bootloader sounds very much like the
one from http://www.microchipc.com, because they mention
relocating the first 4 words of ROM.

In that case, the following code should work. You don't need to
use the #build directive.

When you initially program the "pre-compiled HEX file" into
your 18F452, make sure that you check the Config bit settings.
Make sure that it's set for XT, and that Watchdog and LVP are Disabled.
It also would help if Brownout and Power-up Timer are enabled.

The #fuse line shown in the application program below
actually won't be programmed into the PIC. The Config
bit settings used are the ones in the "pre-compiled HEX file"
(or the ones that you set in the PicStart-Plus Config Bits window).

Code:
#include <18F452.H>
#fuses XT, PUT, BROWNOUT, NOWDT, NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

#define led PIN_D0

// Reserve the top 384 words (768 bytes) of ROM for the bootloader.
#org 0x7D00, 0x7FFF {}   

//=================================

main()
{

while(1)
  {
   output_low(led);
   delay_ms(500);

   output_high(led);
   delay_ms(500);
  }
 
}
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