Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#182 The pic14 port, automatically creates the -DpicXXX

closed-fixed
Borut Ražem
None
5
2012-06-02
2012-06-01
Molnár Károly
No

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.

Discussion

  • Creates the -DpicXXX definition.

     
    Attachments
  • Borut Ražem
    Borut Ražem
    2012-06-01

    Sdcc already generates -D__SDCC_PROCESSOR="XXX", for example -D__SDCC_PROCESSOR="16f842". Isn't this enough to distinguish the PIC type?

    Borut

     
  • Borut Ražem
    Borut Ražem
    2012-06-01

    • assigned_to: nobody --> borutr
    • status: open --> pending-works-for-me
     
  • Raphael Neider
    Raphael Neider
    2012-06-01

    ... 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.

     
    • status: pending-works-for-me --> open-works-for-me
     
  • Therefore must that the pic16fam.h to function. This pic18fam.h is modeled on. I upload to the pic16fam.h.

     
  •  
    Attachments
  • Borut Ražem
    Borut Ražem
    2012-06-01

    * 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?

    Borut

     
  • Anyway the -D__picXXX also good.

    Originally I wanted to send along with libio. Here it is.

     
  •  
    Attachments
  • Borut Ražem
    Borut Ražem
    2012-06-01

    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\ bin\..\include" "t.c"

    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...

    Borut

     
  • You can be "__PICXXX". I will send the results. I archive them in order to avoid a conflict.

     
  • 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.

    Philipp

     
  • 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.

     
  • Borut Ražem
    Borut Ražem
    2012-06-02

    • status: open-works-for-me --> closed-fixed
     
  • Borut Ražem
    Borut Ražem
    2012-06-02

    Modified patch applied in svn revision #7850.

    Now pic16 also generates -D__SDCC_PICXXX and pic18fam.h uses it.

    Borut