PIC18F4550, ccsinfo C compiler & USB bootloader

Thread Starter

OZ1BV

Joined Nov 3, 2010
2
Hi

I have made a board containing a PIC18F4550. I have programmed the Microchip USB bootloader into it, and it works fine (Windows recognize it and the driver is installed).

I want to transfer some code written i CCSinfo C since this is my preferred environment.

I made a simple program and added this code to avoid overwriting the bootloader:

#define LOADER_SIZE (0x7FF)
#define LOADER_START (0)
#define LOADER_END (LOADER_SIZE)
#define APPLICATION_START (LOADER_SIZE+1)
#define APPLICATION_END (getenv("PROGRAM_MEMORY")-1)
#define APPLICATION_ISR (APPLICATION_START+8)

#ifndef _bootloader
//in the application, this moves the reset and isr vector out of the bootload
//space. it then reserves the loader space from being used by the application.
#build(reset=APPLICATION_START, interrupt=APPLICATION_ISR)
#org 0, LOADER_END {}
#endif

I am using the Microchip PICDEM FS USB Demo tool to transfer my code to the PIC. When opening the HEX file i got some warnings. I fixed most of them (wrong fuses) except this one:

WARNING - Port B A/D is not [configures as Digital I/O]

A dialog box want me to decide to use the settings in the HEX file or the boards default.
If I choose Yes (use the settings in the HEX file) and click Program Device, the next warning message says:
WARNING - Failed to program CONFIG DATA
And no code has been programmed into the PIC.

If I click No (boards default) and click Program Device I get no warnings. But the code is not working. It seems like the code is not programmed since the only code in the PIC is the bootloader itself.

The next thing I did was trying out the code from this site: http://www.schmalzhaus.com/UBW32/ - i downloaded the "Hello World" source, fixed the code to match the PIC18F4550 and compiled it.
When programming the PIC using the PICDEM tool the code is working fine.
It seems it's the linker file that does the trick. CCSInfo does not use a linker file as far as I have been able to figure out.

Have anybody here been able to write a C program using CCSinfo C compiler and transferred it to the PIC via the USB port?
If yes, what have You done to make it work?

I have goggled for days and not been able to find any solution.
Any help would be very nice.

Best regards, Brian
 

Thread Starter

OZ1BV

Joined Nov 3, 2010
2
Note: I have fixed this warning: "WARNING - Port B A/D is not [configures as Digital I/O]".
I replaced "PBADEN" with "NOPBADEN".
But the programming still fail and this one appears again: "WARNING - Failed to program CONFIG DATA".

/Brian
 
Top