View previous topic :: View next topic |
Author |
Message |
Steam
Joined: 03 Nov 2011 Posts: 7
|
Compiling with 4.120 |
Posted: Sun Nov 06, 2011 12:35 am |
|
|
Hi! I used for years the PICC 4.053 without any problem.
Now, I want to test the 4.120 version, but I wrote a simple test code to try it.
If I compile the code with 4.053, everything work, but if I compile the same code with 4.120, then nothing works.
Code: |
#include <18F252.h>
#FUSES HS //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES PUT //Power Up Timer
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES PROTECT //Code protected from reads
#FUSES NODEBUG
#use delay(clock=18432000)
#use rs232(baud=19200, xmit=PIN_C6, rcv=PIN_C7)
#include <bootloader.h>
void main(void)
{
while(TRUE)
{
putc('Y');
delay_ms(100);
}
}
|
Any advice? It seems that the pic doesn't start... I don't know.
Thanks! |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Sun Nov 06, 2011 6:44 am |
|
|
Did you install the newer version in the default folder or in a separate one?
If default, you could have corrupted one of the files. It's always best to have every version in it's own folder( I name them PCM2540,PCM3249,PCW4053,etc) .that way I can test a new version , if it fails , quickly go back to a previous version.
1) Always add 'error's to the USE RS232(....) options...
2) Get rid of the bootloader.h include, try again.It's the only line of code that makes your program 'bigger' than "Hello World" test.
Does the older version work now? If yes, then it's not a hardware issue.
Dump the listings of the two programs, they should be identical(same source code),unless there is a bug in the newer one. |
|
|
Steam
Joined: 03 Nov 2011 Posts: 7
|
|
Posted: Sun Nov 06, 2011 11:36 am |
|
|
Hi thanks for the answer! I installed the new version on a separate folder.
The code compiled on the 4.053 runs ok on the hardware. Its a tested hardware that runs a bootloader to download new firmware, so I can't get rid of the bootloader line.
When I download the version compiled with the new compiler it doesn't start the program. I think that the problem is on one of the fuses... but I don't know.
I will try the errors option on the rs232 statement.
Thanks!!! |
|
|
Steam
Joined: 03 Nov 2011 Posts: 7
|
|
Posted: Sun Nov 06, 2011 2:39 pm |
|
|
I made it work.
I looked at the .hex files:
The 4.057 compiler starts like this:
:020000040000FA
:040500000AEF33F0DB
:08050800056ED8CF06F0E0CF2C
:1005100007F00001E9CF0DF0EACF08F0E1CF09F0D4
:10052000E2CF0AF0D9CF0BF0DACF0CF0F3CF14F012
On the other side, the newer version 4.120, like this:
:04050000E9EF2CF003
:08050800046ED8CF05F0E0CF2E
:1005100006F00001E9CF0CF0EACF07F0E1CF08F0D8
:10052000E2CF09F0D9CF0AF0DACF0BF0F3CF12F017
:10053000F4CF13F0FACF14F0F5CF15F0F6CF16F094
So i only copy and paste the first line of the older version on the newer version, and VOILA!
But... why? What does it mean? is the reset vector?
thanks! |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Mon Nov 07, 2011 12:05 am |
|
|
I see. You could expect fast help, if you had told the full story (the code is downloaded by a bootloader) from the beginning.
As explained in the linked post, you only need to initialize the extended address part in your bootloader to make it work without patching the *.hex files.
The bad thing is, that CCS apparently doesn't think about compatibility when applying arbitrary changes to the compiler. |
|
|
Steam
Joined: 03 Nov 2011 Posts: 7
|
|
Posted: Mon Nov 07, 2011 6:01 am |
|
|
Thanks for you answer.
Yes, the code is downloaded by a bootloader, thats why the bootloader.h define is in the code.
Sorry I didn't explain it.
How can I do to make the compiler add this line?
I can't modify the bootloader, I only can modify the source code of the program that will be loaded.
Program.c and bootloader.h can be modified, but bootloader.c don't.
thanks! |
|
|
Steam
Joined: 03 Nov 2011 Posts: 7
|
|
Posted: Tue Nov 08, 2011 11:11 am |
|
|
Is there an option to do this automatic on the compiler?
thanks! |
|
|
|