Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relocation "_cinit" #3

Open
Young-Angelo opened this issue Jan 24, 2018 · 5 comments
Open

Relocation "_cinit" #3

Young-Angelo opened this issue Jan 24, 2018 · 5 comments

Comments

@Young-Angelo
Copy link

Everytime I compile the program (7 segment). I get this message
warning: Relocation symbol "_cinit" [0x0000] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0004] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x001E] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0022] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0000] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0004] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x001E] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0022] has no section. (pass 0)

I use windows 8.1 and I've installed gputils.Is this a bug or is my system causing this troble?????
screenshot 9

@geoffpw
Copy link

geoffpw commented Apr 19, 2018

Hi .....
I have the same problem with sdcc running on linux and am wondering if you ever resolved this issue.
Geoff

@a-v-s
Copy link

a-v-s commented May 18, 2019

It seems this is a problem caused by sdcc. _cinit looks like referring to its C library.
sdcc --use-non-free -mpic16 -p18f2550 --no-crt blink_led.c
builds without the error message, confirming it is the crt causing the problem. I have verified the example built this way runs.

Looking at usin the C library:
SDCC's pic16 libraries are located in /usr/share/sdcc/lib/pic16 for a default installation in linux.
Looking in that directory, I see, the files crt0i.o crt0iz.o crt0.o
I have no expirience on the pic16 platform, I'm not sure about the differences between those variants

When telling sdcc to use crt0.o, it also builds without errors

sdcc --use-non-free -mpic16 -p18f2550 --use-crt=crt0.o blink_led.c

Also this runs fine.

Nevertheless, I believe this problem should be reported upstream at sdcc, as it doesn't select a valid c runtime by default.

@markh2016
Copy link

markh2016 commented Nov 14, 2019

Hi Im new to sdcc in part although I have used older versions I tried the Ubuntu package which supposedly installs SDCC ver 3.4 together with gputils which should both work together having not had a problem with previous version but on a 32 bit ubuntu platform

I then uninstall these due to the fact that no pic libraries were present on this and to find that despite instructions left in the folders to compile these libraries there is no configure,in as suggested for doing this

There after i decided to use sourceforge for downloads gputils and of course sdcc
Fine except with a few earlier version which just do not compile at all Surprise surprise , but on trying this example just to get a led to blink and not knowing to much abut sdcc I also get this problem

Version being used is as follows for SDCC

sdcc --version
SDCC : mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8 3.5.0 #9253 (Nov 14 2019) (Linux)
published under GNU General Public License (GPL)

gpasm version
gpasm-1.5.0 #1285 (Nov 14 2019)
Ubuntu Linux version x86_64 Version 16:04

This is the file Im compiling in C using sdcc
#include <stdint.h>

#include <pic14/pic12f675.h>

//Use this configuration word:
//0x31c4

__code int __at(_CONFIG) __CONFIG = 0x31c4;

//Setup variables
unsigned char ucharCount = 0;
unsigned int uintDelayCount = 0;

void main(void)
{
//Set GPIO to all outputs
TRISIO = 0x00;

//Loop forever
while ( 1 )
{
	//Delay Loop
	while ( uintDelayCount < 10000 )
	{
		//Increment the loop counter
		uintDelayCount++;
	}

	//Reset delay loop counter
	uintDelayCount = 0;

	//Increment the count
	ucharCount++;

	//Display the count on the GPIO pins
	GPIO = ucharCount;

}

}

This is the make file
SRC=blink_led.c

CC=sdcc
FAMILY=pic14
PROC=12f675

all: $(SRC:.c=.hex)

$(SRC:.c=.hex): $(SRC)
$(CC) --use-non-free -m$(FAMILY) -p$(PROC) $^

clean:
rm -f $(SRC:.c=.asm) $(SRC:.c=.cod) $(SRC:.c=.hex) $(SRC:.c=.lst) $(SRC:.c=.o)

.PHONY: all clean

Finally a similar problem in retrospect to others who have commented on this issue after compiling

make
sdcc --use-non-free -mpic14 -p12f675 blink_led.c
blink_led.asm:143:Message[1304] Page selection not needed for this device. No code generated.
message: Using default linker script "/usr/local/share/gputils/lkr/12f675_g.lkr".
warning: Relocation symbol "_cinit" [0x0000] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0004] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x001E] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0022] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0000] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0004] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x001E] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0022] has no section. (pass 0)
warning: Relocation of section "UDL_idata_0" failed, relocating to a shared memory location.
warning: Relocation of section "ID_blink_led_1" failed, relocating to a shared memory location.
warning: Relocation of section "ID_blink_led_0" failed, relocating to a shared memory location.
warning: Relocation of section "ID_idata_0" failed, relocating to a shared memory location.

I'm attaching the hex and asm files for viewing as well
;--------------------------------------------------------
; File Created by SDCC : free open source ANSI-C Compiler
; Version 3.5.0 #9253 (Nov 14 2019) (Linux)
; This file was generated Thu Nov 14 08:44:09 2019
;--------------------------------------------------------
; PIC port for the 14-bit core
;--------------------------------------------------------
; .file "blink_led.c"
list p=12f675
radix dec
include "p12f675.inc"
;--------------------------------------------------------
; config word(s)
;--------------------------------------------------------
__config 0x31c4
;--------------------------------------------------------
; external declarations
;--------------------------------------------------------
extern _STATUSbits
extern _GPIObits
extern _INTCONbits
extern _PIR1bits
extern _T1CONbits
extern _CMCONbits
extern _ADCON0bits
extern _OPTION_REGbits
extern _TRISIObits
extern _PIE1bits
extern _PCONbits
extern _OSCCALbits
extern _WPUbits
extern _IOCbits
extern _IOCBbits
extern _VRCONbits
extern _EECON1bits
extern _ANSELbits
extern _INDF
extern _TMR0
extern _PCL
extern _STATUS
extern _FSR
extern _GPIO
extern _PCLATH
extern _INTCON
extern _PIR1
extern _TMR1
extern _TMR1L
extern _TMR1H
extern _T1CON
extern _CMCON
extern _ADRESH
extern _ADCON0
extern _OPTION_REG
extern _TRISIO
extern _PIE1
extern _PCON
extern _OSCCAL
extern _WPU
extern _IOC
extern _IOCB
extern _VRCON
extern _EEDAT
extern _EEDATA
extern _EEADR
extern _EECON1
extern _EECON2
extern _ADRESL
extern _ANSEL
extern __sdcc_gsinit_startup
;--------------------------------------------------------
; global declarations
;--------------------------------------------------------
global _main
global _ucharCount
global _uintDelayCount

global PSAVE
global SSAVE
global WSAVE
global STK12
global STK11
global STK10
global STK09
global STK08
global STK07
global STK06
global STK05
global STK04
global STK03
global STK02
global STK01
global STK00

sharebank udata_ovr 0x0020
PSAVE res 1
SSAVE res 1
WSAVE res 1
STK12 res 1
STK11 res 1
STK10 res 1
STK09 res 1
STK08 res 1
STK07 res 1
STK06 res 1
STK05 res 1
STK04 res 1
STK03 res 1
STK02 res 1
STK01 res 1
STK00 res 1

;--------------------------------------------------------
; global definitions
;--------------------------------------------------------
;--------------------------------------------------------
; absolute symbol definitions
;--------------------------------------------------------
;--------------------------------------------------------
; compiler-defined variables
;--------------------------------------------------------
;--------------------------------------------------------
; initialized data
;--------------------------------------------------------

ID_blink_led_0 idata
_ucharCount
db 0x00

ID_blink_led_1 idata
_uintDelayCount
db 0x00, 0x00

;--------------------------------------------------------
; overlayable items in internal ram
;--------------------------------------------------------
; udata_ovr
;--------------------------------------------------------
; reset vector
;--------------------------------------------------------
STARTUP code 0x0000
nop
pagesel __sdcc_gsinit_startup
goto __sdcc_gsinit_startup
;--------------------------------------------------------
; code
;--------------------------------------------------------
code_blink_led code
;***
; pBlock Stats: dbName = M
;***
;entry: _main ;Function start
; 2 exit points
;has an exit
;; Starting pCode block
_main ;Function start
; 2 exit points
; .line 22; "blink_led.c" TRISIO = 0x00;
BANKSEL _TRISIO
CLRF _TRISIO
;;unsigned compare: left < lit(0x2710=10000), size=2
00105_DS
; .line 28; "blink_led.c" while ( uintDelayCount < 10000 )
MOVLW 0x27
SUBWF (_uintDelayCount + 1),W
BTFSS STATUS,2
GOTO 00119_DS
MOVLW 0x10
SUBWF _uintDelayCount,W
00119_DS
BTFSC STATUS,0
GOTO 00107_DS
;;genSkipc:3247: created from rifx:0x7ffebcbdc100
; .line 31; "blink_led.c" uintDelayCount++;
INCF _uintDelayCount,F
BTFSC STATUS,2
INCF (_uintDelayCount + 1),F
GOTO 00105_DS
00107_DS
; .line 35; "blink_led.c" uintDelayCount = 0;
CLRF _uintDelayCount
CLRF (_uintDelayCount + 1)
; .line 38; "blink_led.c" ucharCount++;
INCF _ucharCount,F
; .line 41; "blink_led.c" GPIO = ucharCount;
MOVF _ucharCount,W
BANKSEL _GPIO
MOVWF _GPIO
GOTO 00105_DS
RETURN
; exit point of _main

; code size estimation:
; 20+ 2 = 22 instructions ( 48 byte)

end

Below the hex file

:1000000000000228E830AE000030AF008030000071
:1000100000009E200000000083120000B1002F08A5
:10002000B000EA30B2000030B300831200003008A4
:10003000B4003108B500FF30B007031CB103340829
:10004000350403199A2804303207B400B501B50D00
:100050003308B5073408AE003508AF008030000023
:1000600000009E200000000083120000B7002F084F
:10007000B6003208AE003308AF0080300000000048
:100080009E200000000083120000B900B5002F0878
:10009000B800B40002303207B400B501B50D330822
:1000A000B5073408AE003508AF008030000000000E
:1000B0009E200000000083120000B500BB002F0846
:1000C000B400BA00831200003608BA003708BB003B
:1000D000FF30B607031CB7033A083B040319932803
:1000E0003808AE003908AF00803000000000BF20A3
:1000F0000000000083120000BA00340883120313CA
:100100008400831383120000351883173A08831282
:100110000313800083120000B80A0319B90AB40A55
:100120000319B50A6228063083120000B2070318CB
:10013000B30A152800000000D2280800003A03196D
:10014000A628803A0319B028AF0100342E08840095
:1001500083132F1883170008AF00840A00080800D3
:1001600000000000CD20AD00AE0FAF03AF0A0000CD
:100170000000CD20AC002D08AF002C080800003A8C
:100180000319C628803A0319CD2800342E088400AC
:1001900083132F188317000808002F088A002E08E1
:1001A000820008008316850127303D02031DDA28EE
:1001B00010303C020318E028BC0A0319BD0AD428F9
:1001C000BC01BD01BE0A3E0883128500D428080088
:1001D00003340034FE3400343E340034013400343F
:1001E000FC3400343C34003402340034FF34003436
:1001F0003F3400340134003400340034003400341F
:02400E00C431BB
:00000001FF

Any ideas at all on this or why this might be Ive searched high and low for answers on the net
Ive also tried different versions of both gputils and SDCC but nope no joy

Id really appreciate any help or suggestions that some one might be able to offer bearing in mind I dont know to much about sdcc at all

Thanking you

Mark Harrington

@biergaizi
Copy link

The PIC14 and PIC16 builds on SDCC have multiple problems. Some of them, including this one, seems to be caused by a problem in SDCC's build system. For example, I can see the same problem when SDCC is built manually on Debian Sid, but the official Linux build "sdcc-snapshot-amd64-unknown-linux2.5" doesn't have this problem at all. The Windows build is probably broken due to the same reason. The upstream source needs some serious troubleshooting.

@markh2016
Copy link

I would also like to see this back up and running I think I have only ever managed to get this to work all of three times to some part with old disto's of Linux

Terrible shame as this would be very good for many people especially with view to how much you now pay for MPlabx full versions in terms of what they want and how much control they exert over many which none of us agree with

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants