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 question

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



Joined: 10 Feb 2011
Posts: 241
Location: Vancouver, BC

View user's profile Send private message

bootloader question
PostPosted: Fri Feb 25, 2011 11:22 am     Reply with quote

Hi There,

I would like to utilize the sample bootloader and include it into my project. I added ex_bootload.c ex_bootloader.c and loader.c to my MPLAB project and added #include <bootloader.h> to my main file.
IOn compilation i am told *** Error 128 "loader.c" Line 42(1,4): A #DEVICE required before this line so I added #include <18F87K22.h> on top of loader.c which brought up a whole bunch of other errors like Undefined identifier -- putchar & getch... :( How do I correctly add this bootloader to my project? Hints and suggedtions are appreciated, thank you!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Feb 25, 2011 1:14 pm     Reply with quote

Don't "add" multiple files to an MPLAB project. Only add the main file.
All other files will be #include files. Don't add those to the project.

Make a new MPLAB project with the Ex_bootloader.c file, in the Examples
directory. Only add that file to the project. Then compile the project.
It should compile OK.
cerr



Joined: 10 Feb 2011
Posts: 241
Location: Vancouver, BC

View user's profile Send private message

PostPosted: Fri Feb 25, 2011 4:34 pm     Reply with quote

PCM programmer wrote:
Don't "add" multiple files to an MPLAB project. Only add the main file.
All other files will be #include files. Don't add those to the project.

Make a new MPLAB project with the Ex_bootloader.c file, in the Examples
directory. Only add that file to the project. Then compile the project.
It should compile OK.


That actually gives me following errors:
Code:
*** Error 12 "C:\Program Files\PICC\drivers\loader.c" Line 69(32,33): Undefined identifier  -- getch
*** Error 12 "C:\Program Files\PICC\drivers\loader.c" Line 72(16,17): Undefined identifier  -- putchar
*** Error 12 "C:\Program Files\PICC\drivers\loader.c" Line 131(19,20): Undefined identifier  -- putchar
*** Error 12 "C:\Program Files\PICC\drivers\loader.c" Line 133(15,16): Undefined identifier  -- putchar
*** Error 12 "C:\Program Files\PICC\drivers\loader.c" Line 136(13,14): Undefined identifier  -- putchar
*** Error 12 "C:\Program Files\PICC\drivers\loader.c" Line 137(12,13): Undefined identifier  -- putchar
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Feb 25, 2011 5:13 pm     Reply with quote

What's your compiler version ?

And what PIC did you compile Ex_bootloader.c for ?
cerr



Joined: 10 Feb 2011
Posts: 241
Location: Vancouver, BC

View user's profile Send private message

PostPosted: Fri Feb 25, 2011 5:18 pm     Reply with quote

18F87K22 and 4.119
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Feb 25, 2011 5:24 pm     Reply with quote

That's not what I get. I just did a fresh install of vs. 4.119.

I edited the following section of code in Ex_bootloader.c. The portions
shown in bold are the parts that I changed.
Quote:

#if defined(__PCM__)
#include <16F877.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7) // Jumpers: 8 to 11, 7 to 12

#elif defined(__PCH__)
#include <18F87K22.h>
#fuses HSH,NOWDT,NOPROTECT //,NOLVP
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7) // Jumpers: 8 to 11, 7 to 12
#endif


Then I compiled it and the build was successful. I got a couple warnings
but it succeeded.
Quote:

Executing: "C:\Program Files\PICC\Ccsc.exe" +FH "ex_bootloader.c" +DF +LY -T -A +M -Z +Y=9 +EA #__18F452=TRUE
>>> Warning 224 "C:\Program Files\PICC\drivers\bootloader.h" Line 28(12,23): #warning 128
>>> Warning 202 "C:\Program Files\PICC\drivers\loader.c" Line 60(13,22): Variable never used: next_addr
Memory usage: ROM=1% RAM=2% - 3%
0 Errors, 2 Warnings.
Loaded C:\Program Files\PICC\Examples\ex_bootloader.cof.
BUILD SUCCEEDED: Fri Feb 25 15:21:58 2011
cerr



Joined: 10 Feb 2011
Posts: 241
Location: Vancouver, BC

View user's profile Send private message

PostPosted: Fri Feb 25, 2011 5:29 pm     Reply with quote

Uh, okay, I got it compiled and downloaded it. I connected the pin B5 to GND and reset the pic. Am trying to "download software" with SIOW.exe but am failing, it keeps timing out... What else am I doing wrong? Tried Open File and got something transferred. After transfer finished, I removed P5-GND and reset the mcu but my software wasn't there :( Question
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Feb 25, 2011 5:34 pm     Reply with quote

Quote:

Am trying to "download software" with SIOW.exe but am failing, it keeps timing out...

Read these previous threads on SIOW timeout problems:
http://www.ccsinfo.com/forum/viewtopic.php?t=40220
http://www.ccsinfo.com/forum/viewtopic.php?t=34029
http://www.ccsinfo.com/forum/viewtopic.php?t=31311
cerr



Joined: 10 Feb 2011
Posts: 241
Location: Vancouver, BC

View user's profile Send private message

PostPosted: Fri Feb 25, 2011 5:53 pm     Reply with quote

Okay, now I don't have the timeout problem anymore, I hook pin B5 up to GND, reset the mcu, go "Open File", select my hex file, and it seems to be getting transferred down to the pic, once the little transfer box disappears i remove my pin B5 GND bridge and hit reset the pic but there's no application present. And also, I seem to be able to download the file even if pin B5 isn't connected to GND, I also tried to connect B5 to +5V in order to get into "normal" operation mode but it's not happening, my program seems to have vanished.... What am I doing wrong here? :o
Thanks!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Feb 25, 2011 6:32 pm     Reply with quote

I can't work on this anymore today. Maybe on Sunday.
cerr



Joined: 10 Feb 2011
Posts: 241
Location: Vancouver, BC

View user's profile Send private message

PostPosted: Fri Feb 25, 2011 6:44 pm     Reply with quote

PCM programmer wrote:
I can't work on this anymore today. Maybe on Sunday.

Yep, I understand, it's Friday afternoon/evening. Have a good weekend and I hope to advance within the next days... Smile
Thanks for your help!
cerr



Joined: 10 Feb 2011
Posts: 241
Location: Vancouver, BC

View user's profile Send private message

PostPosted: Mon Feb 28, 2011 11:12 am     Reply with quote

Okay, hooked it up again this morning, Pin B5 to +5V and started it witrh a debugger. Added a breakpoint to if(!input(PIN_B5)) and check if it behaved correctly and in fact, it goes directly to application();
Did this again with B5 hooked up top GND and it went to load_program(); from where it went to open loader.c and it got stuck seeminlgy endlessly at buffer[buffidx] = getc(); as I put another breakpoint at the next line after the loop at putchar (XOFF); but the program never got there... :o How come, what's going wrong here? :o

Thanks for help!
Ron
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Feb 28, 2011 3:37 pm     Reply with quote

Before I work on it any more, try using TeraTerm as the downloader
terminal program. See this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=40920
cerr



Joined: 10 Feb 2011
Posts: 241
Location: Vancouver, BC

View user's profile Send private message

PostPosted: Tue Mar 01, 2011 1:05 pm     Reply with quote

I did that and followed the instructions about how to install and configure (flow control) Tera Term but it's not happening for me. I did compile ex_bootloader.c & ex_bootload.c and downloaded bootloader into the pic with MPLAB and tried to load bootload.hex with teraterm but nothing... Sad
I don't know what i'm doing wrong... :(
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