Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo
The pic14 port, automatically creates the -DpicXXX definition. Now I write the libio directory and this definition needed to distinguish the PIC types. The adc is almost complete. Then comes the usart and i2c. As my time permits.
Creates the -DpicXXX definition.
Sdcc already generates -D__SDCC_PROCESSOR="XXX", for example -D__SDCC_PROCESSOR="16f842". Isn't this enough to distinguish the PIC type?
... and if it is not, please use -D__picXXX. Philipp only recently worked towards replacing all compiler-generated defines to the standard-compliant form with two leading underscores. I am not sure, but it might even need to be -D__PICXXX (uppercase?).
However, if other tools such as mplab to emit -DpicXXX I would like to know about it and withdraw my plea.
Therefore must that the pic16fam.h to function. This pic18fam.h is modeled on. I upload to the pic16fam.h.
* This file is has been generated using ./pic16fam-h-gen.pl .
What about the pic16fam-h-gen.pl script? Do you intend to submit it?
Anyway the -D__picXXX also good.
Originally I wanted to send along with libio. Here it is.
Currently there is no -D__picXXX:
$ sdcc -V -mpic14 -p16f84 -E --std-c99 t.c
+ C:\PROGRA~1\SDCC\bin\sdcpp.exe -nostdinc -Wall -std=c99 -obj-ext=.o -D__SDCC=3
_1_5 -D__SDCC_REVISION=7839 -D__SDCC_pic14 -D__SDCC_PROCESSOR="16f84" -D__STDC_N
O_COMPLEX__ -D__STDC_NO_THREADS__ -D__STDC_NO_ATOMICS__ -D__STDC_NO_VLA__ -isyst
em "C:\Program Files\SDCC\bin\..\include\pic14" -isystem "C:\Program Files\SDCC\
The -D__SDCC_PROCESSOR="16f84" is not usable for comprision:
#if __SDCC_PROCESSOR == 12f1822
doesn't work since only macros with numeric values can be compared.
So it really seems that implementing -DpicXXX is the only option.
I vote for __PICXXX,for example __PIC16F84: two leading underscores and all upper case letters. Or maybe __SDCC_PIC16F84...
You can be "__PICXXX". I will send the results. I archive them in order to avoid a conflict.
The changes in one archive.
Philipp Klaus Krause
I'd prefer __SDCC_PIC16F84: It is both compliant and makes it clear that this is an sdcc-specific define and it fits with the names of our other defines.
All right, here is another version. I applied the DpicXXX solution therefore, because the branch of the pic16 using the same. Not knowing, that this causes confusion.
This a new version.
Modified patch applied in svn revision #7850.
Now pic16 also generates -D__SDCC_PICXXX and pic18fam.h uses it.