Issue with using CodeBlocks and SDCC Compiler on build.

Discussion in 'Programmer's Corner' started by Fuji, Dec 6, 2014.

  1. Fuji

    Thread Starter Member

    Nov 8, 2014
    100
    1
    I'm learning in C language. When I compile the following code:
    Code (Text):
    1.  
    2. ==============================================
    3. #include <pic16/pic18f452.h>
    4.  
    5. code char at __CONFIG1H conf1 = _OSC_HS_PLL_1H & _OSCS_ON_1H;   // Select HS PLL OSC
    6. code char at __CONFIG2L conf2 = _PUT_ON_2L;
    7. code char at __CONFIG2H conf3 = _WDT_OFF_2H;                    // Disable WDT
    8. code char at __CONFIG4L conf4 = _LVP_OFF_4L;                    // Disable LVP
    9.  
    10. void main() {
    11.     PORTA = 0;
    12.     PORTB = 0;
    13.     TRISA |= 0x10;
    14.     TRISB &= 0xF0;
    15.     PORTB = 0x0A;
    16.     while(1) {
    17.         if(PORTAbits.RA4 != 0)
    18.             PORTB = ~PORTB;
    19.     }
    20. }
    21. ==============================================
    22.  
    This is the warning that pops up after I build:

    Process terminated with status 1 (0 minute(s), 0 second(s))
    0 error(s), 0 warning(s) (0 minute(s), 0 second(s))

    I have no issues with the code, but why would this message be popping up?

    moderators note: please use code tags for pieces of code
     
    Last edited by a moderator: Dec 6, 2014
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Compiling how on which compiler?

    It would appear the compiler did absolutely nothing. Did you include this c file in the compiler instructions?
     
  3. Papabravo

    Expert

    Feb 24, 2006
    10,135
    1,786
    He named the compiler in the title. It is SDCC.
    IIRC the SDCC compiler was for the 8051. Is there now a version for the PIC family? Does the include file for the 18F452 contain sufficient information for the compiler to do it's job?
     
  4. Fuji

    Thread Starter Member

    Nov 8, 2014
    100
    1
    Thanks for the reply from both of you.

    As far as I see from these two pages, it does look like it can be used for the PIC16 and 14 instructions.

    I got the information of programming PIC's using SDCC from the SDCC wiki page:
    http://wiki.codeblocks.org/index.php?title=Using_the_Code::Blocks_IDE_with_SDCC_on_PIC_MCUs

    Also here:
    http://curuxa.org/en/Write_programs_for_PICs_in_C_using_SDCC_and_Code::Blocks_on_Windows

    I followed the instructions as said in the wiki page, but that error just keeps popping up. I am not sure if the include file would have sufficient information available. Should I overwrite the .h file for this pic with the full information? I didn't know the SDCC was only for the 8051 at one point, and now supposedly it ends up working for PICs.

    Moreover, do you think the SDCC compiler is a good one to use?
     
    Last edited: Dec 6, 2014
  5. Papabravo

    Expert

    Feb 24, 2006
    10,135
    1,786
    That's all well and good, but the 18f452 is not a member of the PIC 14 or 16 families.
     
  6. Fuji

    Thread Starter Member

    Nov 8, 2014
    100
    1
    The compiler flags options in codeblocks shows the selection for PIC16 families as 'PIC 16-bit (p18f452) and variants [-mpic16]'. I just realized it shows that it is still under development. So perhaps this is probably why the code is not building?

    If this is the case, I need an alternative compiler. Im not sure how long they are going to take to set up the instructions for the pic 14 and 16 in SDCC.

    Do you know any alternative compilers that can work with code blocks or any other software? Haven't had the feeling to get MPLAB. A freeware would be nice.
     
  7. Papabravo

    Expert

    Feb 24, 2006
    10,135
    1,786
    I don't think the PIC family number maps to the number of bits in the instruction word. It is just a family number. You're on your own for non Microchip alternatives because they bought up all the people that used to make alternative compilers. Do you want a free one or are you willing to pay?
     
    Fuji likes this.
  8. Fuji

    Thread Starter Member

    Nov 8, 2014
    100
    1
    Free or Buying is fine with me. What do you use?
     
    Last edited: Dec 6, 2014
  9. Papabravo

    Expert

    Feb 24, 2006
    10,135
    1,786
    MPLAB and the XC compilers
     
Loading...