User forums > Help
Compiler SDCC: how do you change the pic-processor type ?
(1/1)
eckard_klotz:
Hello everyone.
I'm using the C::B nightly-build from 1’st of March 2007 under WINXP to write a program for a microchip PIC18F458. I use the SDCC as compiler together with the gputils.
How do I configure the processor-type? Currently C::B (or SDCC) uses the header-files for the PIC18F452, so some registers are not defined correctly. The only way I found to change it, is to edit the SDCC-header named "pic18fregs.h" like this:
--- Code: ---...
#elif defined(pic18f452)
//# include <pic18f452.h>
# include <pic18f458.h> /*changed by Eckard Klotz*/
...
--- End code ---
But this is not the way I would prefer. I think, I have overseen something, so where is my failure?
A second point is how to use the MPLAB-tools instead of the gputils. Is there also a possibility to configure it, which I have overseen?
best regards,
Eckard Klotz.
mandrav:
You should better ask those tools' authors for answers. They have nothing to do with C::B itself and most probably no one can help you here.
eckard_klotz:
Hello everyone.
--- Quote ---You should better ask those tools' authors for answers. They have nothing to do with C::B itself and most probably no one can help you here.
--- End quote ---
OK, I've done this and here is the answer:
1. To define the processor-type there is the p-option which has to be added in the "other options"-tab of the build-options like this:
-p18f458
2. The SDCC does not call the assembler-tool (gpasm or mplab) by itself. This has to be done in the make-file like in this examples (copied out of the manuel of the SDCC):
--- Quote ---Here is a Makefile using GPUTILS:
.c.o:
sdcc -S -V -mpic14 -p16F877 $<
gpasm -c $*.asm
$(PRJ).hex: $(OBJS)
gplink -m -s $(PRJ).lkr -o $(PRJ).hex $(OBJS) libsdcc.lib
Here is a Makefile using MPLAB:
.c.o:
sdcc -S -V -mpic14 -p16F877 $<
mpasmwin /q /o $*.asm
$(PRJ).hex: $(OBJS)
mplink /v $(PRJ).lkr /m $(PRJ).map /o $(PRJ).hex $(OBJS) libsdcc.lib
--- End quote ---
If I compilewith the SDCC I get the asm-files (what means the SDCC is working) but I get no hex-file. In the build log I found the following message:
--- Quote ---sdcc.exe --out-fmt-ihx -mpic16 -Wall -p18f458 -D__18F458 --out-fmt-ihx -mpic16 --verbose --debug -Wall -p18f458 --out-fmt-ihx -mpic16 -I..\..\..\H -I..\..\..\Def -IC:\sdcc\include -IC:\include -c ..\..\..\C\xxx.C -o obj\Release\C\xxx.rel
Usage: gpasm [options] file
Options: [defaults in brackets after descriptions]
-a FMT, --hex-format FMT Select hex file format. [inhx32]
-c, --object Output relocatable object.
-d, --debug Output debug messages.
-D SYM=VAL, --define SYM=VAL Define SYM with value VAL.
-e [ON|OFF], --expand [ON|OFF] Macro expansion.
-g, --debug-info Use debug directives for COFF.
-h, --help Show this usage message.
-i, --ignore-case Case insensitive.
-I DIR, --include DIR Specify include directory.
-l, --list-chips List supported processors.
-L, --force-list Ignore nolist directives.
-m, --dump Memory dump.
-M, --deps Output dependency file.
-o FILE, --output FILE Alternate name of output file.
-p PROC, --processor PROC Select processor.
-q, --quiet Quiet.
-r RADIX, --radix RADIX Select radix. [hex]
-u, --absolute Use absolute pathes.
-v, --version Show version.
-w [0|1|2], --warning [0|1|2] Set message level. [0]
-y, --extended Enable 18xx extended mode.
Default header file path D:\Tools\gputils\header
Report bugs to:
<URL:http://gputils.sourceforge.net/>
Processor: 18f458
sdcc: Calling preprocessor...
sdcc: Generating code...
sdcc: Calling assembler...
--- End quote ---
I think the point is, that there are some wrong or old options in the default make-file. So how can I change it or where have I do to ask?
Kind regards,
Eckard Klotz
Navigation
[0] Message Index
Go to full version