#55 Can't find PORTA_bits definition for PIC16F84A

closed
nobody
None
5
2006-12-01
2006-11-24
marco_gaio
No

Dear all, I cannot find the definition of PORTA_bits, RA0, RA1 and so on for PIC16F84A and for many PICs (if not all, I didn't check) with 14 bit core.
I already posted a similar topic and got a reply to download the latest SDCC version.
The point is that I downoaded the latesd SDCC 6.0 for Win32 from:
http://sourceforge.net/project/showfiles.php?group_id=599.
I also downloaded the latest 6.0 tar archive of the sources (sdcc-src-2.6.0.tar), and had a look inside some headers (pic16f84a.h, pic16f819.h, ..) but I couldn't find the aforementioned definition. I can find it in the pic16 port, but I couldn't copy the same definitions inside my pic16f84a.h file.
What am I missing?

Thanks a lot, be patient since I'm new to SDCC.
Regards
Marco

Discussion

  • Raphael Neider
    Raphael Neider
    2006-11-24

    Logged In: YES
    user_id=1115835
    Originator: NO

    Hmmm, my mistake.

    1. The PORTA_bits declaration is only available in the nightly snapshots (e.g., sdcc-snapshot-*-4482.tar.bz2); the 2.6.0 release did not have them.

    2. Even the snapshots only have few PORTx_bits declarations, namely the 16f84 and 16f84a.

    So, your best start for now would be to copy pic16fXXX.h and pic16fXXX.c from the library sources into your project, modify them according to your needs and link them into your project. You might need to specify --nostdlib so as to prevent sdcc from linking with the (unmodified) pic16fXXX.{o,lib} from the library, but then you will have to manually link against libsdcc.lib. In other words, you might need to use
    sdcc -mpic14 -mpic16f84a --nostdlib -L/path/to/sdcc/pic/libraries -llibsdcc.lib main.c helper1.o helper2.o helper3.o pic16f84a.o
    until I or someone else comes up with a script to regenerate the device headers/libraries with appropriate declarations and definitions.

    Sorry for the confusion,
    Raphael

     
  • Maarten Brock
    Maarten Brock
    2006-11-24

    Logged In: YES
    user_id=888171
    Originator: NO

    Marco,

    There is no version 6.0 of SDCC. At our speed that will take another 40 years.

    Apart from the official releases we also have nightly snapshots available from our website. When Raphael said to get the latest he meant those snapshots (or get source code directly from SVN).

    And instead of opening a new tracker item you also could have added to your previous one. Since you logged in when filing that report you even could have reopened it. I've set this one pending now so it will close automatically if you do not respond within several weeks but will reopen automatically if you do.

    Hope This Helps
    Maarten

     
  • Maarten Brock
    Maarten Brock
    2006-11-24

    • status: open --> pending
     
  • marco_gaio
    marco_gaio
    2006-11-24

    • status: pending --> open
     
  • marco_gaio
    marco_gaio
    2006-11-24

    Logged In: YES
    user_id=1652313
    Originator: YES

    Sorry Maarten,
    I was wrong when I wrote version 6.0 (the leading "2." was kept inside my keyboard :-)), so I meant version 2.6.0.
    I'm new both to SDCC and to this kind of forum, sorry if I put some confusion into it. Thanks again also to Raphael, I will look for the nightly sources and try as suggested.
    I'll let you know.
    Regards,
    Marco

     
  • marco_gaio
    marco_gaio
    2006-11-24

    • priority: 5 --> 1
    • status: open --> pending
     
  • marco_gaio
    marco_gaio
    2006-11-29

    Logged In: YES
    user_id=1652313
    Originator: YES

    Dear all,
    sorry to bother you again, but I still cannot compile a simple test file for pic16f84a with SDCC. I downloaded and installed (under Windows XP) a newer SDCC snapshot; sdcc -v now reports:
    SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.6.1 #4482 (Nov 24 2006) (MINGW32)
    I wrote then a simple C program like this:

    // chiave.c test programma per pic16f84a
    #include <pic14regs.h>

    void main()
    {
    TRISA=0; // all PORTA pins are output
    PORTA=0; // clear all outputs
    RA0=1; // set RA0 pin
    }
    // EOF

    then I compiled with: sdcc -mpic14 -p16f84a chiave.c
    and got the following result:
    message: using default linker script "C:\Programmi\gputils\lkr\16f84a.lkr"
    error: linker script has no definition that matches the type of section "sharebank"

    I get the same message even when I compile with: sdcc -mpic14 -p16f84a --nostdlib -Lc:\programmi\sdcc\lib\pic -llibsdcc.lib chiave.c
    as Raphael suggested.

    I'm using the latest gputils 0.13.4 which I downloaded from sourceforge.
    Do you have any suggestion?
    Thanks a lot,
    Regards

    P.S. Now I can see the PORTA_bits definitions, should I open a new tracker item for this next trouble?

    Marco

     
  • marco_gaio
    marco_gaio
    2006-11-29

    • priority: 1 --> 5
    • status: pending --> open
     
  • marco_gaio
    marco_gaio
    2006-12-01

    • status: open --> closed
     
  • marco_gaio
    marco_gaio
    2006-12-01

    Logged In: YES
    user_id=1652313
    Originator: YES

    I think I found out a solution, I don't know if it's the best one, but it works: I just added the line:
    SECTION NAME=sharebank RAM=gprs
    to the linker script file 16f84a.lkr.
    Now the build process works fine!!
    Thanks a lot!
    Marco