# Issue with using CodeBlocks and SDCC Compiler on build.

#### Fuji

Joined Nov 8, 2014
100
I'm learning in C language. When I compile the following code:
Code:
==============================================
#include <pic16/pic18f452.h>

code char at __CONFIG1H conf1 = _OSC_HS_PLL_1H & _OSCS_ON_1H;   // Select HS PLL OSC
code char at __CONFIG2L conf2 = _PUT_ON_2L;
code char at __CONFIG2H conf3 = _WDT_OFF_2H;                    // Disable WDT
code char at __CONFIG4L conf4 = _LVP_OFF_4L;                    // Disable LVP

void main() {
PORTA = 0;
PORTB = 0;
TRISA |= 0x10;
TRISB &= 0xF0;
PORTB = 0x0A;
while(1) {
if(PORTAbits.RA4 != 0)
PORTB = ~PORTB;
}
}
==============================================
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:

#### ErnieM

Joined Apr 24, 2011
8,058
Compiling how on which compiler?

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

#### Papabravo

Joined Feb 24, 2006
14,664
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?

#### Fuji

Joined Nov 8, 2014
100
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?
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:

#### Papabravo

Joined Feb 24, 2006
14,664
That's all well and good, but the 18f452 is not a member of the PIC 14 or 16 families.

#### Fuji

Joined Nov 8, 2014
100
That's all well and good, but the 18f452 is not a member of the PIC 14 or 16 families.
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.

#### Papabravo

Joined Feb 24, 2006
14,664
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

Joined Nov 8, 2014
100
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?
Free or Buying is fine with me. What do you use?

Last edited:

#### Papabravo

Joined Feb 24, 2006
14,664
Free or Buying is fine with me. What do you use?
MPLAB and the XC compilers