|
|
View previous topic :: View next topic |
Author |
Message |
rao
Joined: 03 Oct 2010 Posts: 10 Location: Pune
|
Problem in Compiling Code with 4.114 |
Posted: Sat Feb 12, 2011 3:24 am |
|
|
Guys hi:
I have been using CCS to compile my code. The code offset is at 0800, so that it doesn't overwrite the boot-loader.
I used to compile my code with 4.039, loaded the hex file in PICDEM FS USB, and burned it to the mcu via USB. When I loaded the file compiled with 4.039 in PICDEM FS USB it clearly showed code starting from 0800, however, ever since I upgraded to 4.114 same file when compiled starts like this:
Code: |
2C41720 06 F0 00 01 E9 CF 0C F0 EA CF 07 F0 E1 CF 08 F0
2C41730 E2 CF 09 F0 D9 CF 0A F0 DA CF 0B F0 F3 CF 12 F0
2C41740 F4 CF 13 F0 FA CF 14 F0 F5 CF 15 F0 F6 CF 16 F0
2C41750 F7 CF 17 F0 00 C0 0E F0 01 C0 0F F0 02 C0 10 F0
2C41760 03 C0 11 F0 F2 AA 30 EF 04 F0 F2 B4 38 EF 12 F0
|
Once I burn the hex file it doesn't work either. Same source when compiled on other computer with 4.039 works fine.
Can anyone please guide me what am I missing.
Here is the definition for bootloader:
Code: |
#define BOOTLOADER PICDEM
#define CODE_START 0x0800
#build(reset=CODE_START, interrupt=CODE_START+0x08)
#org 0, CODE_START-1 {}
|
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Feb 12, 2011 4:09 pm |
|
|
Post a short bootloader application program that shows the problem.
This program should be only maybe 15 lines, maximum.
If you can do that, I can compile it with both your versions and compare
the two .LST files and maybe find the problem. I can do this later today
or tomorrow. |
|
|
rao
Joined: 03 Oct 2010 Posts: 10 Location: Pune
|
|
Posted: Sun Feb 13, 2011 10:22 am |
|
|
PCM programmer:
Thanks for the reply, I have been busy in the funeral of a close relative, and I didnt get much time to write a new program so I pulled one right out of CCS's examples folder and added a couple of lines to make it bootloader compatible, I have not omitted anything, just commented out. So here it is:
Code: |
/////////////////////////////////////////////////////////////////////////
//// EX_LED.C ////
//// ////
//// This program shows how to drive a two digit LED using input ////
//// from an RS-232 port. ////
//// ////
//// Configure the CCS prototype card as follows: ////
//// LED seg f Pin B0 ////
//// LED seg a Pin B1 ////
//// LED seg e Pin B2 ////
//// LED seg c Pin B3 ////
//// LED seg dp Pin B4 ////
//// LED seg d Pin B5 ////
//// LED seg b Pin B6 ////
//// LED seg g Pin B7 ////
//// LED Anode 1 Pin A0 ////
//// LED Anode 2 Pin A1 ////
//// ////
//// Jumpers: ////
//// PCB pin A2 to RS232 RX, pin A3 to RS232 TX ////
//// PCM,PCH pin C7 to RS232 RX, pin C6 to RS232 TX ////
//// ////
//// This example will work with the PCB, PCM and PCH compilers. ////
//// The following conditional compilation lines are used to ////
//// include a valid device for each compiler. Change the device, ////
//// clock and RS232 pins for your hardware if needed. ////
/////////////////////////////////////////////////////////////////////////
//// (C) Copyright 1996,2003 Custom Computer Services ////
//// This source code may only be used by licensed users of the CCS ////
//// C compiler. This source code may only be distributed to other ////
//// licensed users of the CCS C compiler. No other use, ////
//// reproduction or distribution is permitted without written ////
//// permission. Derivative programs created using this software ////
//// in object code form are not restricted in any way. ////
/////////////////////////////////////////////////////////////////////////
/*#include <18F2550.h>
#use delay(clock=48000000)
//#include "pic18_usb.h"
//#include "pic18_usb.c"
//#include "usb.c"
//#include "usb.h"
*/
/*#if defined(__PCB__)
#include <16C56.h>
#fuses HS,NOWDT,NOPROTECT
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_A3, rcv=PIN_A2)
#elif defined(__PCM__)
#include <16F877.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
*/
//#elif defined(__PCH__)
#include <18F4550.h>
//#fuses HS,NOWDT,NOPROTECT,NOLVP
#fuses HSPLL,NOWDT,NOPROTECT,NODEBUG,NOBROWNOUT,USBDIV,PLL2,CPUDIV1,VREGEN,PUT,NOMCLR,NOLVP
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
//#endif
// Bootloader
#define CODE_START 0x0800
#build(reset=CODE_START, interrupt=CODE_START+0x08)
#org 0, CODE_START-1 {}
BYTE CONST LED_MAP[10] = {0x90,0xb7,0x19,0x15,0x36,0x54,0x50,0xb5,0,0x24};
void wait() { // This function waits for either ~2ms or until a
int countdown; // event happens (in this case a rs232 character)
countdown=200;
while((--countdown!=0)&&!kbhit())
delay_us(10);
}
void display_segs(char c) {
if((c>'9')||(C<'0'))
output_b(0xff);
else
output_b(LED_MAP[c-'0']);
}
void display( char one, char two) {
display_segs(one);
output_high(PIN_A0);
wait();
output_low(PIN_A0);
display_segs(two);
output_high(PIN_A1);
wait();
output_low(PIN_A1);
}
void main() {
char pos1, pos2;
set_tris_b(0);
output_b(0);
pos1='0';
pos2='1';
while(TRUE) {
display(pos1,pos2);
if(kbhit()) {
pos1=pos2;
pos2=getc();
}
}
}
|
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Feb 13, 2011 1:07 pm |
|
|
Quote: |
Ever since I upgraded to 4.114 same file when compiled starts like this:
Code:
2C41720 06 F0 00 01 E9 CF 0C F0 EA CF 07 F0 E1 CF 08 F0
2C41730 E2 CF 09 F0 D9 CF 0A F0 DA CF 0B F0 F3 CF 12 F0
2C41740 F4 CF 13 F0 FA CF 14 F0 F5 CF 15 F0 F6 CF 16 F0
2C41750 F7 CF 17 F0 00 C0 0E F0 01 C0 0F F0 02 C0 10 F0
2C41760 03 C0 11 F0 F2 AA 30 EF 04 F0 F2 B4 38 EF 12 F0
|
Where do you get this display ? I'm using MPLAB and I can't find it.
If I compile with vs. 4.114, everythings shows that the code starts at
address 0x0800. The .LST file shows it, and also View Program Memory
and View Disassembly Listing in MPLAB.
Here's the first part of the .LST file. The first line of code (a GOTO ins.) is at 0800:
Code: |
CCS PCH C Compiler, Version 4.114, xxxx 13-Feb-11 11:02
Filename: C:\Program Files\PICC\Projects\PCH_Test\PCH_Test.lst
ROM used: 212 bytes (1%)
Largest free fragment is 30504
RAM used: 6 (0%) at main() level
10 (0%) worst case
Stack: 3 locations
*
0800: GOTO 0884
|
|
|
|
rao
Joined: 03 Oct 2010 Posts: 10 Location: Pune
|
|
Posted: Sun Feb 13, 2011 9:26 pm |
|
|
Thanks for the update.
However, I too compiled one code with CCS 4.114 and 4.039, .lst file shows the code starting at 0800, however, when I load the hex file in PICDEM FS USB, the one I compile with CCS 4.114 shows the following:
Code: |
Addr. 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
PROGRAM MEMORY:
E8 EF 1D F0 04 6E D8 CF 05 F0 E0 CF
2C41720 06 F0 00 01 E9 CF 0C F0 EA CF 07 F0 E1 CF 08 F0
2C41730 E2 CF 09 F0 D9 CF 0A F0 DA CF 0B F0 F3 CF 12 F0
2C41740 F4 CF 13 F0 FA CF 14 F0 F5 CF 15 F0 F6 CF 16 F0
|
and the one compiled with 4.039 shows this:
Code: |
Addr. 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
PROGRAM MEMORY:
000800 13 EF 20 F0 XX XX XX XX 05 6E D8 CF 06 F0 E0 CF
000810 07 F0 00 01 E9 CF 0D F0 EA CF 08 F0 E1 CF 09 F0
000820 E2 CF 0A F0 D9 CF 0B F0 DA CF 0C F0 F3 CF 14 F0
|
Only difference between both files is probably PLL value (for crystal frequency) |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19553
|
|
Posted: Mon Feb 14, 2011 4:44 am |
|
|
One suggestion.
Output format.
I'd suspect one of the settings has changed in the output format, and the one now being generated, is not being properly translated by the PICDEM, hence the data is effectively arriving as 'garbage'.....
Best Wishes |
|
|
|
|
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
|