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

Bootloader again

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



Joined: 27 Nov 2003
Posts: 1

View user's profile Send private message

Bootloader again
PostPosted: Mon Sep 20, 2004 12:58 pm     Reply with quote

Hi all

I have made the CCS included bootloader to work (ex-bootloader.c, bootloader.h and loader.c) on my 18F458

But I can't compile a code with both my bootloader and a source code included.

What I want to do is to create a new version of my source code with the bootloader included so that I can program this with mplab. And then when a new release is done, this code is whitout the bootloader which can then be DL'ed with RS-232. (The download of the source code works fine now.)

Has anyone done this before.

How do I set up the #org, #build reset and so on, in the ex_bootloader.c file to make this work.

Best regards Rune
Guest








PostPosted: Mon Sep 20, 2004 2:10 pm     Reply with quote

I also use loader.c in my project.

main.c

#fuses HS,NOWDT,PUT, NOPROTECT, NOLVP, BROWNOUT

#include "loader.c" //it is pretty much the same as the example, except #define LOADER_SIZE 0x4FF

main()
{
....
CommandDispatcher();
....
}

CommandDispatcher()
{
...
/*Ready to run the loader.c*/
disable_interrupts(global);
putchar(XON);
LED_RED();
load_program(); //this will not return
}

Everything seems to work fine, so far.

The only concern is:

If the loader can't finish due to any reason (such as power lost), the micro has to be sent back to me -- thus I am not telling my customers about this feature, and only use it when it is absolutely necessary.
asmallri2
Guest







Bootloader again
PostPosted: Mon Sep 20, 2004 6:06 pm     Reply with quote

Quote:
If the loader can't finish due to any reason (such as power lost), the micro has to be sent back to me -- thus I am not telling my customers about this feature, and only use it when it is absolutely necessary.


I have my own flavour of bootloader and it uses flags to control the loading process. When it start loading new code it sets a "code invalid flag" this flag is not cleared until the eof record is received. When the system is booted, and the bootloader has control, it will not execute user code if the "code invalid" flag is set. In the event of power failure during programing, the system restarts in the bootloader mode and stays there until a new image is programmed. I have successfully used this feature to reprogram remote systems thousands of kilometres away and recover from loader failures.
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Tue Sep 21, 2004 10:28 am     Reply with quote

asmallri2,
Can you share this code?
I looked into this for a while, and I also had loader problem.
I ended up going in a different direction,... But I would love to find out what went wrong with my code.

Thanks for your help.
tjr
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

Bootloader again
PostPosted: Wed Sep 22, 2004 6:15 am     Reply with quote

Quote:
asmallri2,
Can you share this code?
I looked into this for a while, and I also had loader problem.
I ended up going in a different direction,... But I would love to find out what went wrong with my code.


Send me an email at asmallri@westnet.com.au and I will send you the code and the programmer application. NOTE: This bootloader bears no resemblance whatsoever to the Loader.c example on CCS, it is written in assembler and was designed for fault tolerant operation. It is not small. (end of disclaimers)
Guest








Re: Bootloader again
PostPosted: Wed Sep 22, 2004 12:51 pm     Reply with quote

asmallri2 wrote:
Quote:
If the loader can't finish due to any reason (such as power lost), the micro has to be sent back to me -- thus I am not telling my customers about this feature, and only use it when it is absolutely necessary.


I have my own flavour of bootloader and it uses flags to control the loading process. When it start loading new code it sets a "code invalid flag" this flag is not cleared until the eof record is received. When the system is booted, and the bootloader has control, it will not execute user code if the "code invalid" flag is set. In the event of power failure during programing, the system restarts in the bootloader mode and stays there until a new image is programmed. I have successfully used this feature to reprogram remote systems thousands of kilometres away and recover from loader failures.


Is it similar to what described in this app note?

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en012031
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

Re: Bootloader again
PostPosted: Wed Sep 22, 2004 3:08 pm     Reply with quote

Is it similar to what described in this app note?

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en012031[/quote]

No but it follows the general principle of a bootloader. My loader is located high in memory and the only low memory consumed is the reset vector. My initial implementation was a bootloader that works over ethernet (appearded in issue #165 of Circuit Cellar in May this year). It works but reading a line of the hex file and sending the entire line wrapped in a header to the target. The target returns status, line by line to the coontrolling host. I then ported it to RS232. I also have a flavour that I use for bootloadinng thru an intermediary PIC and every bootloads a MAX1463 digital ananlog processor thru the downstream remote pic over the SPI bus. This bootloader's hex file is included in issue #171 (October 2004).
bloodynri



Joined: 03 Nov 2004
Posts: 2

View user's profile Send private message

PostPosted: Wed Nov 03, 2004 2:16 pm     Reply with quote

I have a problem with loader.c

First of all I'm confused about what is required to run a bootloader.
In my project, I have my main C file, the header files related to that and the loader.c file. Is this all I need? Do I need the ex_bootloader etc that come with CCSC?

When I compile the Main C file, I get an error for loader.c that says "unidentified identifier getch" and the same for putchar. Can someone please help me with these issues?
Thanks alot!
Nick
Guest







PostPosted: Wed Jun 08, 2005 10:42 pm     Reply with quote

bloodynri wrote:


When I compile the Main C file, I get an error for loader.c that says "unidentified identifier getch" and the same for putchar. Can someone please help me with these issues?
Thanks alot!


I'm getting the same error, just a different year.
Guest








PostPosted: Wed Jun 08, 2005 10:49 pm     Reply with quote

Code:

#include <16F876.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=38400, xmit=PIN_C6, rcv=PIN_C7)


#include <loader.c>

/*
#include <16F876.h>
#fuses HS,NOWDT,NOPROTECT,PUT//,//BROWNOUT,NOLVP
#use delay(clock=20000000)// 20mhz clock

//set up PC communications

#include <loader.c>

#use rs232(baud=38400, xmit=PIN_C6, rcv=PIN_C7,errors)
*/



the error is in the header.... the commented out header will generate that error... this is for the archives. I hope it helps
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