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

Firmwareloader

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



Joined: 22 Sep 2008
Posts: 6

View user's profile Send private message

Firmwareloader
PostPosted: Thu May 07, 2009 10:17 am     Reply with quote

We are interested to implement a Firmwareloader like a Bootloader into our
Project with a PIC 18F2550, but we don't have any experience with this.

We use the PICWinUSB Example from Hobbypic.
On a reset we want to run the actual firmware. (So it isn't a Bootloader)
Then when we connect the PIC with the USB to the PC we want to make a
Button in our Computer Software (written with VC#) called "update
Firmware". Then you select a File (hex) and it would
program the PIC.
(The USB is also needed for Dataexchange in the main Program)

Is this possible to do and how difficult is it? Has someone done this?

(PCWH Compiler 4.073)
John Morley



Joined: 09 Aug 2004
Posts: 97

View user's profile Send private message

PostPosted: Fri May 08, 2009 7:39 am     Reply with quote

Hi,

Do a search on 'USB Bootloader'. Why do you think your desired behaviour does not describe a 'bootloader'? Many bootloaders, will run the 'actual firmware' after a reset. For example, the popular Tiny Bootloader will wait one second after reset to see if new firmware is to be loaded, and if not it will launch the current code.

Cheers,
_________________
John Morley
Ttelmah
Guest







PostPosted: Fri May 08, 2009 9:27 am     Reply with quote

I think the point he is trying to make, is that he wants the bootloader in his case, to not be a separate program, but part of the running code.

In fact he does need a normal separate bootloader, but will have to approach it slightly differently from the common 'at wakeup' approach. The problem is that if the loader is in the 'main' code, then it will have to overwrite itself....

What actually needs to happen, is something like this:
Code:

//Main code, resident at the bottom of memory

//Somewhere in the main code, a program line, that tests for a particular
//'key', and if it sees this, calls the bootloader, resident at the top of
//the memory.

#org something near the top of memory
//'bootloader' code here, which is _not_ overwritten by the loaded new
//code.


This is pretty much a standard bootloader configuration, and such 'top of memory' bootloaders, are more efficient in use, since there is no need to re-vector the interrupt and boot vectors.

They are still 'bootloaders' (the name comes from the idea of 'pulling yourself up by your bootstraps', with the processor programming itself, _not_ from them inherently being run at 'boot' time).

The only big 'caveat', is if you are using ICD, you need to ensure that you allow enough space above the bootloader code, for the ICD code.

Several of the normally used bootloaders, are 'top of memory' bootloaders, which can be modified fairly easily for this approach, only being called, once a specific criterion is met, rather than automatically at boot, and then making the decision themselves of whether to proceed to reprogram or not.

Best Wishes
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