Question

Using SDCC 3.0.0. Compiling this code

#include <  pic16f84.h>
void main(void) {
TRISA0=0;
RA0=1;
}

and receive these warnings.

daedalus@Eurydice:~/Projects/PIC$ sdcc -I /usr/share/sdcc/include/pic -p16f84 test.c

/usr/share/sdcc/include/pic/pic16f84.h:101: warning 182: absolute address for sfr 'INDF' probably out of range.

/usr/share/sdcc/include/pic/pic16f84.h:101: warning 182: absolute address for sfr 'INDF' probably out of range.

/usr/share/sdcc/include/pic/pic16f84.h:102: warning 182: absolute address for sfr 'TMR0' probably out of range.

/usr/share/sdcc/include/pic/pic16f84.h:102: warning 182: absolute address for sfr 'TMR0' probably out of range.

/usr/share/sdcc/include/pic/pic16f84.h:103: warning 182: absolute address for sfr 'PCL' probably out of range.

/usr/share/sdcc/include/pic/pic16f84.h:103: warning 182: absolute address for sfr 'PCL' probably out of range.

/usr/share/sdcc/include/pic/pic16f84.h:104: warning 182: absolute address for sfr 'STATUS' probably out of range.

/usr/share/sdcc/include/pic/pic16f84.h:104: warning 182: absolute address for sfr 'STATUS' probably out of range.

/usr/share/sdcc/include/pic/pic16f84.h:105: warning 182: absolute address for sfr 'FSR' probably out of range.

/usr/share/sdcc/include/pic/pic16f84.h:105: warning 182: absolute address for sfr 'FSR' probably out of range.

/usr/share/sdcc/include/pic/pic16f84.h:106: warning 182: absolute address for sfr 'PORTA' probably out of range.

/usr/share/sdcc/include/pic/pic16f84.h:106: warning 182: absolute address for sfr 'PORTA' probably out of range.

/usr/share/sdcc/include/pic/pic16f84.h:107: warning 182: absolute address for sfr 'PORTB' probably out of range.

/usr/share/sdcc/include/pic/pic16f84.h:107: warning 182: absolute address for sfr 'PORTB' probably out of range.

/usr/share/sdcc/include/pic/pic16f84.h:108: warning 182: absolute address for sfr 'EEDATA' probably out of range.

/usr/share/sdcc/include/pic/pic16f84.h:108: warning 182: absolute address for sfr 'EEDATA' probably out of range.

/usr/share/sdcc/include/pic/pic16f84.h:109: warning 182: absolute address for sfr 'EEADR' probably out of range.

/usr/share/sdcc/include/pic/pic16f84.h:109: warning 182: absolute address for sfr 'EEADR' probably out of range.

/usr/share/sdcc/include/pic/pic16f84.h:110: warning 182: absolute address for sfr 'PCLATH' probably out of range.

/usr/share/sdcc/include/pic/pic16f84.h:110: warning 182: absolute address for sfr 'PCLATH' probably out of range.

/usr/share/sdcc/include/pic/pic16f84.h:111: warning 182: absolute address for sfr 'INTCON' probably out of range.

/usr/share/sdcc/include/pic/pic16f84.h:111: warning 182: absolute address for sfr 'INTCON' probably out of range.

?ASlink-Warning-Undefined Global '_TRISA_bits' referenced by module 'test'

?ASlink-Warning-Undefined Global '_PORTA_bits' referenced by module 'test'

Can anyone help me understand these warnings? Should I care?

Was it helpful?

Solution

Disclaimer: I've never worked on a PIC

My guess is that the compiler is detecting that the addresses assigned to those variables (which are sfr's -- "Special Function Registers") are not within the expected memory map for the processor. The sfr syntax looks like __sfr __at (0x80) P0; This is assigining the register variable to a specific address. The warning is saying that those address appear to be invalid.

Many embedded compiler toolchains include some sort of "link map" command file which tells the linker in which physical addresses to place the code and data. This SDCC user's guide suggests that you can use a ".lkr" file. (See pg 68). Make sure that that is correct for your specific processor.

Also, that manual says that the correct flag to select pic is -mpic16. Are you sure that the -p16f86 option is correct?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top