PIC18F4550 missing port definition

Help
yvan56
2007-06-01
2013-03-12
  • yvan56
    yvan56
    2007-06-01

    Hi everyone,
    I'm working with Microchip 18f4550, Piklab and sdcc 2.6 on a GNU/Debian - testing - box:
    uname -a
    Linux monPC 2.6.18-4-686 #1 SMP Mon Mar 26 17:17:36 UTC 2007 i686 GNU/Linux
    sdcc -v
    SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.6.0 #4309 (Oct 15 2006) (UNIX)
    Piklab 0.14.1,
    gptutils 0.13.4 beta
    I've updated the include file to take into account addional ports and function pins not defined previously. See the post in the open discussion forum.
    When trying a simple code trying to access PORTD - 40 pins DIL chip -:
    #define __18F4550
    #include <pic18fregs.h>
    void main(void)
    {
    TRISD=0x00;    // data port as output
    LATD=0xFF;
    }

    This is the log of the compilation:
    sdcc -mpic16 -p18f4550 -V -I/home/yvan/projets/electronique/prog-18f4550/code/test/ -c test_lcd.c
    + "/usr/bin/sdcpp" -nostdinc -Wall -std=c99 -I"/home/yvan/projets/electronique/prog-18f4550/code/test/" -Dpic18f4550 -D__18f4550 -DSTACK_MODEL_SMALL -obj-ext=.o -DSDCC_MODEL_SMALL -DSDCC=260 -DSDCC_pic16 -D__pic16 -I"/usr/bin/../share/sdcc/include/pic16" -I"/usr/share/sdcc/include/pic16" -I"/home/yvan/projets/electronique/prog-18f4550/code/test/"  "test_lcd.c"
    + "/usr/bin/gpasm" -DSDCC_MODEL_SMALL -Dpic18f4550 -D__18F4550 -DSTACK_MODEL_SMALL -c "test_lcd.asm" -o "test_lcd.o"
    sdcc -mpic16 -p18f4550 -V -Wl-c -Wl-s/usr/share/gputils/lkr/18f4550i.lkr -I/home/yvan/projets/electronique/prog-18f4550/code/test/ -otest_lcd.hex test_lcd.o
    warning: processor mismatch in "/usr/bin/../share/sdcc/lib/pic16/crt0i.o"
    warning: processor mismatch in "pic18f4550.o"
    error: missing definition for symbol "_TRISD", required by "test_lcd.o"
    error: missing definition for symbol "_LATD", required by "test_lcd.o"
    + "/usr/bin/gplink" -I"/usr/bin/../share/sdcc/lib/pic16" -I"/usr/share/sdcc/lib/pic16"  -c -s/usr/share/gputils/lkr/18f4550i.lkr  -o test_lcd.hex  test_lcd.o  crt0i.o pic18f4550.lib libsdcc.lib

    I've tried by compiling with a 18f452 chip, the compilation succeeded.
    I've seen that these symbols (LATD, PORTD, TRISD, LATE, PORTE, TRISE) are not defined in the pic18f4550.lib.
    But, they are defined in the gputils header file.
    How could we add these symbols for the 18f4550? - I've posted the updated include in the open discussion forum
    Have these symbols been included in the newest version?

    Many thanks for your help,
    Yvan

     
    • Borut Ražem
      Borut Ražem
      2007-06-09

    • Raphael Neider
      Raphael Neider
      2007-06-10

      Just update your SDCC version. Since 2007-01-015 (SDCC 2.6.4, r4573), PORTD and TRISD have been present in the official include/library files.

      Regarding your other post:
      I cannot find DMA0WN, RDYO, ACTIVIF/E (instead of ACTVIF/E), an 8-bit PORTA (but a 7-bit wide one), HF256DIV, SCKP, RCMT, or FLTS in any datasheet. Where do these come from? I won't update the official tree unless convinced the changes are required. Being at it, I did work in more alternative names for the PORTx registers from the datasheet, but wait with my commit until this other open question is answered.
      Though I do like the shorter CONFIG names, I am not sure whether the change does not rather disturb current users...

      Regards,
      Raphael

       
    • yvan56
      yvan56
      2007-06-26

      Hi Raphael,
      Thanks for your reply and your comments.
      I have put bit names based on datasheet with my convenience, not sure it's relevant for other users.
      The more useful could be the CONFIG definition,
      because you could use them with Piklab, specially with the configuration wizard.

      Best regards,
      Yvan