Some issues/bugs with SDCC (3.2.0) in MPLAB-X (1.30 and 1.40)

Page: 12 > Showing page 1 of 2
Author
vloki
always on da run
  • Total Posts : 6650
  • Reward points : 0
  • Joined: 2007/10/15 00:51:49
  • Location: Germany
  • Status: offline
2012/08/09 05:06:06 (permalink)
5 (2)

Some issues/bugs with SDCC (3.2.0) in MPLAB-X (1.30 and 1.40)

Horrified by the code produced by the free version of XC compiler, I have recently started to play with the SDCC compiler
(How to explain XC8 / Hi-Tech generated code to our students ???)
 
The biggest issues I had to fight with, getting the first little code snipped compiled and running in debug mode
I will post here for others who may run into the same ;-)
 
1. The PIC that I want to use seemed to be not supported by SDCC in MPLAB-X
    Both tools support PIC18F25K22, so why SDCC disappears as I select it in project properties ?
 
    The "J" and "K" type PIC18 are listed with lowercase letters (jk) instead of upper case (JK) in file:
    MPLABX\mplab_ide\mplab_ide\modules\br-unifei-rmaalmeida-toolchainSDCC.jar
    -> br-unifei-rmaalmeida-toolchainSDCC\br\unifei\rmaalmeida\toolchainSDCC/sdcc.languageToolchain.xml
 
    The file must be edited to make them usable. Here you can add new supported PICs too. (like PIC18FxxK22)
 
2. SDCC version 3.2.0 should support "'#pragma config" directive. But there seems to be a bug.
    It's only working if you place everything in one (  #pragma config FOSC = INTIO67, WDTEN = OFF, PBADEN = OFF, LVP = OFF ... )
    With multiple pragmas you get error messages:  Error[154]   Each object file section must be contiguous.
 
<edit>
3. The descriptions of the compiler options are not shown properly in the dialog
   MPLABX\mplab_ide\mplab_ide\modules\br-unifei-rmaalmeida-toolchainSDCC.jar
    -> br-unifei-rmaalmeida-toolchainSDCC\br\unifei\rmaalmeida\toolchainSDCC/sdcc.optionLanguage.xml
 
post edited by vloki - 2012/09/10 07:20:06

Posting images, links and code - workaround for restrictions.
#1

23 Replies Related Threads

    vloki
    always on da run
    • Total Posts : 6650
    • Reward points : 0
    • Joined: 2007/10/15 00:51:49
    • Location: Germany
    • Status: offline
    Re:Some issues/bugs with SDCC (3.2.0) in MPLAB-X (1.30) 2012/08/10 01:29:36 (permalink)
    +2 (1)
    Just noticed that all the PIC16xxx "a" and "b" types have to be edited as well.
     
    I will attach a modified file where I tried to change all a,b,j,k to A,B,J,K
    and added lots of PIC16 and the 18FxxK22 types from the actual compiler version 3.2.0a
     
    Actual lists:
    PIC14 processors supported:      
    16f72     16f73     16f74     16f76     16f77     16f84     16f84a
    16f87     16f88     16f616    16hv616   16f627    16f627a   16f628
    16f628a   16f648    16f648a   16f630    16f676    16f636    16f639
    16f684    16f685    16f689    16f690    16f687    16f688    16f716
    16f720    16lf720   16f721    16lf721   16f737    16f747    16f767
    16f777    16f785    16hv785   16f870    16f872    16f871    16f873
    16f873a   16f874    16f874a   16f876    16f876a   16f877    16f877a
    16f882    16f883    16f884    16f886    16f887    16f818    16f819
    16f913    16f914    16f916    16f917    16f946    16c62     16c72
    16c63a    16c73b    16c65b    16c74b    16cr73    16cr74    16cr76
    16cr77    16c432    16c433    16c554    16c557    16c558    16c620
    16c620a   16cr620a  16c621    16c621a   16c622    16c622a   16c710
    16c71     16c711    16c715    16c717    16c770    16c771    16c745
    16c765    16c773    16c774    16c781    16c782    16c925    16c926
    12f629    12f675    12f635    12f683    16f1455   16lf1455  16f1458
    16lf1458  16f1459   16lf1459  16f1503   16lf1503  16f1507   16lf1507
    16f1508   16lf1508  16f1509   16lf1509  16f1516   16lf1516  16f1517
    16lf1517  16f1518   16lf1518  16f1519   16lf1519  16f1526   16lf1526
    16f1527   16lf1527  16f1782   16lf1782  16f1783   16lf1783  12f1822
    12lf1822  16f1823   16lf1823  16f1824   16lf1824  16f1825   16lf1825
    16f1826   16lf1826  16f1827   16lf1827  16f1828   16lf1828  16f1829
    16lf1829  12f1840   12lf1840  16f1847   16lf1847  16lf1902  16lf1903
    16lf1904  16lf1906  16lf1907  16f1933   16lf1933  16f1934   16lf1934
    16f1936   16lf1936  16f1937   16lf1937  16f1938   16lf1938  16f1939
    16lf1939  16f1946   16lf1946  16f1947   16lf1947

     
    PIC16 - Valid devices are:      
    p18f1220    p18f1230    p18f1320    p18f1330    p18f13k50   p18f14k50
    p18f2220    p18f2221    p18f2320    p18f2321    p18f2331    p18f23k20
    p18f23k22   p18f2410    p18f242     p18f2420    p18f2423    p18f2431
    p18f2450    p18f2455    p18f248     p18f2480    p18f24j10   p18f24j50
    p18f24k20   p18f24k22   p18f2510    p18f2515    p18f252     p18f2520
    p18f2523    p18f2525    p18f2550    p18f258     p18f2580    p18f2585
    p18f25j10   p18f25j50   p18f25k20   p18f25k22   p18f2610    p18f2620
    p18f2680    p18f2682    p18f2685    p18f26j50   p18f26k20   p18f26k22
    p18f4220    p18f4221    p18f4320    p18f4321    p18f4331    p18f43k20
    p18f43k22   p18f4410    p18f442     p18f4420    p18f4423    p18f4431
    p18f4450    p18f4455    p18f448     p18f4480    p18f44j10   p18f44j50
    p18f44k20   p18f44k22   p18f4510    p18f4515    p18f452     p18f4520
    p18f4523    p18f4525    p18f4550    p18f458     p18f4580    p18f4585
    p18f45j10   p18f45j50   p18f45k20   p18f45k22   p18f4610    p18f4620
    p18f4680    p18f4682    p18f4685    p18f46j50   p18f46k20   p18f46k22
    p18f6520    p18f6527    p18f6585    p18f65j50   p18f6620    p18f6622
    p18f6627    p18f6680    p18f66j50   p18f66j55   p18f6720    p18f6722
    p18f67j50   p18f66j60   p18f66j65   p18f67j60   p18f8520    p18f8527
    p18f8585    p18f85j50   p18f8620    p18f8622    p18f8627    p18f8680
    p18f86j50   p18f86j55   p18f86j60   p18f86j65   p18f8720    p18f8722
    p18f87j50   p18f87j60   p18f96j60   p18f96j65   p18f97j60


    Newest file added include path option to dialg posted Sep. 11 2012

    -file with modified compiler options dialog posted September 10. 2012

    USE AT YOU OWN RISK (better you have a copy of the original file ;-)

    br-unifei-rma...txt (29.35 KB) - downloaded 53+3 times
    br-unifei-rma...nSDCC.jar.txt (26.26 KB) - downloaded 654 times
     

    Oct. 07 2013 removed the file because it is not up to date.

    Please use SDCC 3.2.1 - MPLAB-X plugin resources
    Information/instructions in post #16 below by drewkeller may be of help.
    post edited by vloki - 2013/10/07 00:25:14

    Posting images, links and code - workaround for restrictions.
    #2
    al_bin
    Super Member
    • Total Posts : 108
    • Reward points : 0
    • Joined: 2011/02/11 06:28:47
    • Location: 0
    • Status: offline
    Re:Some issues/bugs with SDCC (3.2.0) in MPLAB-X (1.30) 2012/08/14 02:14:03 (permalink)
    0
    Unfortunately this method don't work for supported by SDCC PIC12x and PIC10x :-(
     
    Albert
    #3
    vloki
    always on da run
    • Total Posts : 6650
    • Reward points : 0
    • Joined: 2007/10/15 00:51:49
    • Location: Germany
    • Status: offline
    Re:Some issues/bugs with SDCC (3.2.0) in MPLAB-X (1.30) 2012/08/14 02:57:33 (permalink)
    0
    Supported PIC10 ?  (<edit> e.g 10F320 ???)
    Do you have a newer version than 3.2.0a ?
    For the PIC12 in the list above (created by compiler) it *seems* to work (they can be selected then ...)
    post edited by vloki - 2012/08/14 03:00:13

    Posting images, links and code - workaround for restrictions.
    #4
    al_bin
    Super Member
    • Total Posts : 108
    • Reward points : 0
    • Joined: 2011/02/11 06:28:47
    • Location: 0
    • Status: offline
    Re:Some issues/bugs with SDCC (3.2.0) in MPLAB-X (1.30) 2012/08/15 15:12:14 (permalink)
    0
    vloki
    Supported PIC10 ?  (<edit> e.g 10F320 ???)
    Do you have a newer version than 3.2.0a ?

    Yes and yes. 3.2.1 from SVN
    vloki
    For the PIC12 in the list above (created by compiler) it *seems* to work (they can be selected then ...)

    But not compile. (MPLABX send "none" value to -m parameter)  

    Albert
     
    Edit:
     
    Adding  -mpic14 to:
            Project properties->Conf->SDCC Toolchain->sdcc->Additional options
    do the trick.
    Also if you create project for supported pic10 add:
             --stack-loc 0x40
    And don't worry about RAM usage.  MPLABX reported size is useless.

     
    post edited by al_bin - 2012/08/17 00:40:37
    #5
    atodobom
    New Member
    • Total Posts : 1
    • Reward points : 0
    • Joined: 2012/08/21 13:04:35
    • Location: 0
    • Status: offline
    Re:Some issues/bugs with SDCC (3.2.0) in MPLAB-X (1.30) 2012/08/21 13:11:33 (permalink)
    0
    Hi, and Thanks a lot, AFAIK you fixed my problem too! :)
    Note: I replaced the file
    /opt/microchip/mplabx/mplab_ide/mplab_ide/modules/br-unifei-rmaalmeida-toolchainSDCC.jar
    And now SDCC appears on my toolchains list selecting 18F24K22
     
    Regards,
     
    Antonio Todo Bom
    #6
    vloki
    always on da run
    • Total Posts : 6650
    • Reward points : 0
    • Joined: 2007/10/15 00:51:49
    • Location: Germany
    • Status: offline
    Re:Some issues/bugs with SDCC (3.2.0) in MPLAB-X (1.30) 2012/09/10 07:29:55 (permalink)
    0
    Posted updated jar file (post #2),
    - that shows descriptions in the dialog
    - added peephole optimization option
    - changed option name "Location of constants" -> "Optimization of BANKSEL"

    Posting images, links and code - workaround for restrictions.
    #7
    vloki
    always on da run
    • Total Posts : 6650
    • Reward points : 0
    • Joined: 2007/10/15 00:51:49
    • Location: Germany
    • Status: offline
    Re:Some issues/bugs with SDCC (3.2.0) in MPLAB-X (1.30) 2012/09/11 07:31:34 (permalink)
    0
    new jar file ( br-unifei-rma...nSDCC.jar.txt (26.26 KB) - downloaded x times )
    - now with include path option in dialog
    post edited by vloki - 2012/09/11 07:39:35

    Posting images, links and code - workaround for restrictions.
    #8
    rmaalmeida
    New Member
    • Total Posts : 6
    • Reward points : 0
    • Joined: 2011/01/14 12:09:03
    • Location: 0
    • Status: offline
    Re:Some issues/bugs with SDCC (3.2.0) in MPLAB-X (1.30) 2012/10/04 15:48:21 (permalink)
    +3 (2)
    Thanks everyone for the feedback. Plug-in 1.0.2 is out with this bugs corrected: https://sites.google.com/.../mplabx-sdcc-toolchain
    #9
    mbtronics
    New Member
    • Total Posts : 3
    • Reward points : 0
    • Joined: 2012/10/17 03:08:11
    • Location: 0
    • Status: offline
    Re:Some issues/bugs with SDCC (3.2.0) in MPLAB-X (1.30) 2012/10/17 03:10:52 (permalink)
    0
    How do I have to install the new version? I can't find  a download link or anything like that?
    The jar files above don't seem to work on my installation (FC16 with latest MPLABX).
    #10
    vloki
    always on da run
    • Total Posts : 6650
    • Reward points : 0
    • Joined: 2007/10/15 00:51:49
    • Location: Germany
    • Status: offline
    Re:Some issues/bugs with SDCC (3.2.0) in MPLAB-X (1.30) 2012/10/17 04:29:11 (permalink)
    0
    What is FC16 ???

    Posting images, links and code - workaround for restrictions.
    #11
    mbtronics
    New Member
    • Total Posts : 3
    • Reward points : 0
    • Joined: 2012/10/17 03:08:11
    • Location: 0
    • Status: offline
    Re:Some issues/bugs with SDCC (3.2.0) in MPLAB-X (1.30) 2012/10/18 03:09:13 (permalink)
    0
    Fedora Core 16
    #12
    mbtronics
    New Member
    • Total Posts : 3
    • Reward points : 0
    • Joined: 2012/10/17 03:08:11
    • Location: 0
    • Status: offline
    Re:Some issues/bugs with SDCC (3.2.0) in MPLAB-X (1.30) 2012/10/18 03:11:23 (permalink)
    0
    Meanwhile, I have already downloaded the source with Git and compiled it.
    I add (preliminary) support a SystemIncludeProvider and SystemDefineProvider to get rid of the language errors (red underlined in the editor).
    #13
    erlo
    Starting Member
    • Total Posts : 14
    • Reward points : 0
    • Joined: 2013/01/16 14:24:57
    • Location: 0
    • Status: offline
    Re:Some issues/bugs with SDCC (3.2.0) in MPLAB-X (1.30) 2013/02/04 14:06:26 (permalink)
    0
    mbtronics

    Meanwhile, I have already downloaded the source with Git and compiled it.
    I add (preliminary) support a SystemIncludeProvider and SystemDefineProvider to get rid of the language errors (red underlined in the editor).

    Does this work OK? Can you provide a link to the jar-file? (I know next to nothing about Java, and this is not the time for learning it).
     
    Erlo
    #14
    drewkeller
    New Member
    • Total Posts : 13
    • Reward points : 0
    • Joined: 2005/06/28 14:46:46
    • Status: offline
    Re:Some issues/bugs with SDCC (3.2.0) in MPLAB-X (1.30) 2013/04/08 09:41:20 (permalink)
    +1 (1)
    It took me a while to figure out how to install this as well. Turns out there's not really any installation because it's installed through the netbeans IDE (aka MPLAB X).
     
    In MPLAB X, go to Tools > Plugins > Available Plugins > SDCC Toolchain. Select it and click Install. Restart MPLAB.
     
    This downloads some files to %AppData%\.mplab_ide\dev\vx.xx\. 
    #15
    drewkeller
    New Member
    • Total Posts : 13
    • Reward points : 0
    • Joined: 2005/06/28 14:46:46
    • Status: offline
    Re:Some issues/bugs with SDCC (3.2.0) in MPLAB-X (1.30) 2013/04/08 10:04:53 (permalink)
    0
    Reporting a few issues I had with the SDCC toolchain module...
     
    It seems to expect that everyone uses the pic16 families because it always includes --debug-ralloc and pstack-model on the command line (these are not valid for pic14).
     
    You can fix this by removing or changing them from the options list within the module code.
    1. Find the module at %AppData%\.mplab_ide\dev\v1.70\modules.
    2. Rename the .jar file to .zip and extract the sdcc.languageToolchain.xml and sdcc.optionLanguageToolchain.xml files out of it.
    3. In the languageToolchain options, find the debug-ralloc option and delete the whole line.
    4. In the optionLanguage options, find the pstack-model option. Change it's default from "small" to blank ("").
    5. (optional) Above the pstack-model option, add a boolean option for debug-ralloc. Since we removed it from the global settings, we'll add it back in here for the pic16 family.
    <opt:booleanOption opt:id="debug-ralloc"            opt:name=" Force register allocator to dump *.d ?les with debugging information." opt:desc="output debugging information" opt:trueemission="--debug-ralloc" opt:booldefault="false"/>

    6. (optional) In the general options section, let's add an option so we can add #defines. Add this line: 
        <opt:stringListOption opt:id="define-macros"         opt:name="Define macros"             opt:emissionseparator=" -D"  opt:emissionprefix="-D" opt:expr="[A-Za-z_][A-Za-z_0-9]*(=.+)?"/>

    7. Update the zip file with the modified files. Rename it back to .jar and start MPLAB.

    I have not figured out a way to assign the family as an option so that the options for the family that I'm NOT using are ignored, e.g. if I'm using PIC14 I want to ignore the PIC16 options. Setting up an enum option is easy enough, but how to use logic for an option category? I found a commented out "grayif" attribute in one of Microchips modules, but it didn't seem to work for me.
    post edited by drewkeller - 2013/04/08 10:06:49
    #16
    wannabegeek
    New Member
    • Total Posts : 10
    • Reward points : 0
    • Joined: 2013/07/07 12:48:02
    • Location: San Francisco
    • Status: offline
    Re:Some issues/bugs with SDCC (3.2.0) in MPLAB-X (1.30 and 1.40) 2013/07/07 12:57:07 (permalink)
    0
    Hi all,
     
    I'm a new to uC ans a Linux user and trying to get MPLAB v1.85 to play nice with my PIC12f675 and sdcc.
     
    I was able to get the sdcc tool_chain plugin loaded and found. When I create a new project using a "supported" uC, I can select the
    sdcc compiler.

    I read the above posts and tried to get my PIC12f675 working with no luck. 
    My /opt/microchip/mplabx/mplab_ide/mplab_ide/modules  does not contain any jar files with sdcc in the name. In fact, I tried to search for them
    with  $find . -iname "*sdcc*" and didn't  return anything... ???
    My sdcc versionis 2.9 from the Ubuntu Repo, I'm running Mint 13 XFCE.
     
    I'd like to get this working....TIA !
    wbg
     
    UPDATE: Found the file br-unifei-rmaalmeida-toolchainSDCC.jar, it is in  /home/user/.mplabx
    However, I am not a java guy and not sure what to do with this file. I tried backing up the existing file and using the updated file provided above. No luck yet....
    post edited by wannabegeek - 2013/07/07 16:17:41
    #17
    wannabegeek
    New Member
    • Total Posts : 10
    • Reward points : 0
    • Joined: 2013/07/07 12:48:02
    • Location: San Francisco
    • Status: offline
    Re:Some issues/bugs with SDCC (3.2.0) in MPLAB-X (1.30 and 1.40) 2013/07/07 16:34:13 (permalink)
    0
    Ok I figured out that the .jar is just a zip format...found the file  sdcc.languageToolchain.xml:
     
    I don't know much about how java uses XML files, but it looks to me like the PIC12F675 should work...but it doesn't.
     
     <mp:cCompiler mp:file="sdcc" mp:name="SDCC Compiler for 8-bit Devices"/>    
    <mp:deviceSupport>     
    <mp:family mp:family="16x">
    <mp:device mp:name="PIC12F629" mp:support="beta"/>
     <mp:device mp:name="PIC12F635" mp:support="beta"/>
    <mp:device mp:name="PIC12F675" mp:support="beta"/>           
    <mp:device mp:name="PIC12F683" mp:support="beta"/> 
    <mp:device mp:name="PIC12F1822" mp:support="beta"/>           
    <mp:device mp:name="PIC12F1840" mp:support="beta"/>
    <mp:device mp:name="PIC12LF1822" mp:support="beta"/>          
    <mp:device mp:name="PIC12LF1840" mp:support="beta"/> 
     <mp:device mp:name="PIC16C432" mp:support="beta"/>           
    <mp:device mp:name="PIC16C433" mp:support="beta"/>           
    <mp:device mp:name="PIC16C554" mp:support="beta"/>           
    <mp:device mp:name="PIC16C557" mp:support="beta"/>           
    <mp:device mp:name="PIC16C558" mp:support="beta"/>
     
     
     
    post edited by wannabegeek - 2013/07/07 16:44:35

    Linx Mint 13, Xfce, PICKit2, sdcc 2.9  PIC12F675 MPLAB X IDE v1.85

    Java: 1.7.0_17; Java HotSpot(TM) 64-Bit Server VM 23.7-b01
     

     
    #18
    vloki
    always on da run
    • Total Posts : 6650
    • Reward points : 0
    • Joined: 2007/10/15 00:51:49
    • Location: Germany
    • Status: offline
    Re:Some issues/bugs with SDCC (3.2.0) in MPLAB-X (1.30 and 1.40) 2013/07/08 01:12:32 (permalink)
    +1 (1)
    wannabegeek
    I read the above posts and tried to get my PIC12f675 working with no luck.
    ...
    My sdcc versionis 2.9 from the Ubuntu Repo, I'm running Mint 13 XFCE.

    Are you sure SDCC 2.9 supports this PIC ?

    Posting images, links and code - workaround for restrictions.
    #19
    wannabegeek
    New Member
    • Total Posts : 10
    • Reward points : 0
    • Joined: 2013/07/07 12:48:02
    • Location: San Francisco
    • Status: offline
    Re:Some issues/bugs with SDCC (3.2.0) in MPLAB-X (1.30 and 1.40) 2013/07/08 10:37:39 (permalink)
    0
    vloki
    wannabegeek
    I read the above posts and tried to get my PIC12f675 working with no luck.
    ...
    My sdcc versionis 2.9 from the Ubuntu Repo, I'm running Mint 13 XFCE.

    Are you sure SDCC 2.9 supports this PIC ?

     
    Hi vloki and thanks for responding.... I am sure that sdcc 2.9 supports the PIC12F675 b/c I compiled and programed the chip with an example program using 
    sdcc to compile and pk2cmd to send the hex to the PICkit 2 programmer.
    Also, the XML's look like it is included...
     
    Also, I typoed my original post.... :(   I have been able to load the SDCC plugin, and enable to tool chain, BUT when I create a NEW PROJECT,  SDCC is not
    an option for the PIC12F675 chip, although it will become an option for other chips.
     
    Sorry about that...
     
    Other's have reported that they got this working, so I feel like I should be able to as well...I suppose I could upgrade my sdcc to 3.x.
    If you could look at the XML and help me to get the SDCC option with my IC, that  would be great... If it doesn't work after that, then I'll
    upgrade.
     
    Thanks again !
    wbg
    post edited by wannabegeek - 2013/07/08 10:39:51
    #20
    Page: 12 > Showing page 1 of 2
    Jump to:
    © 2017 APG vNext Commercial Version 4.5