|
|
View previous topic :: View next topic |
Author |
Message |
Nitroxide
Joined: 08 Jun 2008 Posts: 4
|
PIC18F87J50 and CCS USB bootloader code |
Posted: Tue Aug 19, 2008 7:54 am |
|
|
Hi,
I'm trying to port the CCS USB bootloader for PIC18F87J50 and I just can't make it run the self written code.
I must mention the fact that I've got it working flawlessly on PIC18F4550 using the same compiler version.
The problem I had from beginning was the way the #org directives were used to reserve space:
Original definitions:
Code: | #if APPLICATION_END>0xFFFF
#org APPLICATION_START+0x10, 0xFFFF {}
#if APPLICATION_END>0x1FFFF
#org 0xFFFF, 0x1FFFF {}
#else
#org 0xFFFF, APPLICATION_END {}
#endif
#else
#org APPLICATION_START+0x10, APPLICATION_END {}
#endif
#endif |
Compiler Output:
--- Info 300 "C:\Program Files\PICC\drivers\usb_bootloader.h" Line 62(36,37): More info: Segment at 00000-017FE (0000 used)
--- Info 300 "C:\Program Files\PICC\drivers\usb_bootloader.h" Line 62(36,37): More info: Segment at 01800-0180E (0000 used) Priv
--- Info 300 "C:\Program Files\PICC\drivers\usb_bootloader.h" Line 62(36,37): More info: Segment at 01810-0FFFE (0000 used) Priv
--- Info 300 "C:\Program Files\PICC\drivers\usb_bootloader.h" Line 62(36,37): More info: Segment at 10000-1FFF6 (0000 used)
--- Info 300 "C:\Program Files\PICC\drivers\usb_bootloader.h" Line 62(36,37): More info: Attempted to create: 0FFFE-1FFF6 for #org
*** Error 126 "C:\Program Files\PICC\drivers\usb_bootloader.h" Line 62(36,37): Invalid ORG range
1 Errors, 0 Warnings.
Modiffied definitions ( for PIC18F87J50) :
Code: | #org APPLICATION_START+0x10, 0xFFFF {}
#org 0x10000, APPLICATION_END {} |
Compiles OK
The bootloader connects to USB, I can download the firmware using SIOW but the written software won't run.
Using the same files ( only with necessary modifications ) works flawless for PIC18F4550.
If I'm using only a small test software ( 3 instructions ) it runs, but the interrupts won't work.
After running these tests I assume there's a problem in the way the program space is being reserved.
However another thing that I just don't understand is the use of
Code: | #define APPLICATION_END (getenv("PROGRAM_MEMORY")-1) |
which shouldn't output 1FFF6 if we judge by the getenv("PROGRAM_MEMORY") definition in the CCS C Compiler user manual:
PROGRAM_MEMORY Returns the size of memory for code (in words)
It should output only FFF6 ( PIC18F87J50 has a program memory of 128 KBytes)
If anyone has any idea or suggestion of how can I find the bug related to this issue, please feel welcome to reply.
Thank you! |
|
|
Nitroxide
Joined: 08 Jun 2008 Posts: 4
|
|
Posted: Wed Aug 20, 2008 7:00 am |
|
|
Update:
I fixed the problem after many hours spent debugging and I felt it was my duty to tell others too , so they won't spend that time too porting the USB Bootloader to PIC18F87J50
The problem is in the way the writing of flash occurs:
To fix the bootloader to correctly work for PIC18F87J50 replace the line,in ex_bootloader.c :
rom_w(addr, data, count);
with:
write_program_memory( addr, data, count );
If anyone needs the full code for 18F87J50 port of CCS USB Bootloader feel free to ask for. |
|
|
mschmelz
Joined: 26 Jun 2006 Posts: 5 Location: Wertheim/Germany
|
Bootloader source offer... seriously ? |
Posted: Wed Sep 03, 2008 11:26 am |
|
|
Hi,
I saw your post about bootloader issues.
I am currently starting a project on 18F87J50, and would be more than happy to have a running sample of bootloader code via USB....
So really appreciate your support and code snippets here....
Thanks in advance,
Michael |
|
|
Vishal Guest
|
|
Posted: Tue Sep 16, 2008 10:16 pm |
|
|
Hi Nitroxide,
I want to write the boot loader for pic 18f87j50. As you already worked on it can you please give me source code of boot loader you wrote?
This will be helpful to me.
Vishal N |
|
|
jatink007
Joined: 16 Dec 2010 Posts: 1
|
|
Posted: Thu Dec 16, 2010 7:55 pm |
|
|
Hey Nitroxide, even I am starting a project using the same pic!! Can you send me the Bootloader? I don't know much about how to code it :-(. It would be of great help.
Hoping for reply. Thanx |
|
|
|
|
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
|