2

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?

Michael
  • 281
  • 1
  • 5
  • 12
  • this question might be more likely generate an answer on http://electronics.stackexchange.com/ – kenny Aug 29 '11 at 12:41

1 Answers1

1

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?

AShelly
  • 34,686
  • 15
  • 91
  • 152
  • Thankyou AShelly. I've never had to create a link file using other compilers, so this caught me off guard. How do I specify the .lnk file to SDCC? can I just include it as a header in the main C file? You are correct in that the manual does say -mpic16 is to be used for pics. I saw an example which used -p16f84, which is why I used it. They produce the same result. – Michael Aug 31 '11 at 04:37
  • Thanks, I have edited how sdcc is called. `sdcc -mpic16 -I /usr/share/sdcc/include -L 16f84.lkr scoreboard.c` However I now get an error "libdev18f452.lib: No such file or directory" and nothing else. – Michael Aug 31 '11 at 06:39
  • The man also says this about the -mpic16 option. Generate code for the PIC 14-bit processors (In development, not complete). SO maybe I'm barking up the wrong tree with SDCC. – Michael Aug 31 '11 at 06:57
  • 1
    The last error sounds like a simple path error. Do you have that file anywhere in the toolchain directory structure? As a hack, just move it to the same directory as the source. (The correct fix would be adding some sort of "Library Path" command line option.) – AShelly Aug 31 '11 at 16:39
  • r.e. Using SDCC: Did you see this question about PIC compilers? http://stackoverflow.com/q/1030985/10396 – AShelly Aug 31 '11 at 16:40
  • Did see it. I am following MPLAB IDE under wine a a parallel alternative, however not having any success with it. I was hoping that sometime between July 2009 (the posting date) and now, SDCC PIC support would have moved out of the Beta realm. Will try and move libdev18f452 into source directory. – Michael Aug 31 '11 at 20:27
  • 2
    was able to get it to compile. sdcc -mpic14 -p16f84 -I /usr/share/sdcc/include scoreboard.c. Had to move both the .lkr and PIC16f84.lib files into the local directory. yields a warning that the default 16f84.lkr file is being used, which is good. Have not tested yet but I have higher hopes. Thanks for the help. – Michael Sep 01 '11 at 06:35