Forum: Mikrocontroller und Digitale Elektronik PIC: Problem beim Linken für PIC16F1704


von Gerd B. (bertr2d2) Benutzerseite


Lesenswert?

Hallo,

folgenden Code versuche ich zu Übersetzen und zu Linken:
1
#include <pic16f1704.h>
2
#include <stdint.h>
3
4
static __code uint16_t __at (_CONFIG1) configword1 = _FOSC_INTOSC & _WDTE_OFF & _MCLRE_ON & _CP_OFF & _PWRTE_OFF & _BOREN_OFF & _CLKOUTEN_OFF;
5
static __code uint16_t __at (_CONFIG2) configword2 = _WRT_OFF & _PLLEN_ON & _STVREN_ON & _LVP_ON;
6
7
#define FOSC    32000000
8
9
void init() {
10
  // switch off analog
11
  ANSELA  = 0;
12
  ANSELC  = 0;
13
  ADCON0  = 0;
14
  ADCON1  = 0;
15
  ADCON2  = 0;
16
  CM1CON0 = 0;
17
  CM1CON1 = 0;
18
  CM2CON0 = 0;
19
  CM2CON1 = 0;
20
  TRISA5 = 0;
21
}
22
23
void main() {
24
  init();
25
  while(1) {
26
    LATA5 = 1;
27
    LATA5 = 1;  // add 3 CPU cycles to generate symetric signal
28
    LATA5 = 1;  //
29
    LATA5 = 1;  //
30
    LATA5 = 0;
31
  }
32
}
Beim Übersetzen und anschließendem Linken bekomme ich folgende 
Fehlermeldung:
1
% sdcc --use-non-free -mpic14 -p16f1704 main.c
2
message: Using default linker script "/usr/local/share/gputils/lkr/16f1704_g.lkr".
3
error: Processor family mismatch in "idata.o".
4
error: Processor family mismatch in "_gptrget1.o".
5
error: Processor family mismatch in "_gptrget2.o".
6
error: Missing definition for symbol "_INDF", required by "_gptrget1.o".
7
error: Missing definition for symbol "_FSR", required by "_gptrget1.o".
8
9
% sdcc -v
10
SDCC : mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8 3.4.1 #9092 (Nov  3 2014) (Linux)
11
published under GNU General Public License (GPL)
12
13
% gplink -v
14
gplink-1.4.0 #1107 (Nov  3 2014)

Eine Suche im Internet nach dieser Fehlermeldung hat nichts brauchbares 
ergeben. Hat jemand eine Idee, was faul sein könnte bzw. hat von Euch 
jemand schon Code für Enhanced PIC14 Cores erfolgreich mit SDCC 
übersetzen können ?

Gruß

Gerd

: Bearbeitet durch User
von Teo D. (teoderix)


Lesenswert?

Gerd B. schrieb:
> #include <pic16f1704.h>

Mach statt dessen #include <xc.h>

von Wolfgang R. (portside)


Lesenswert?

Teo Derix schrieb:
> Gerd B. schrieb:
>> #include <pic16f1704.h>
>
> Mach statt dessen #include <xc.h>

Gerd benutzt sdcc und nicht XC8 Compiler. Da hilft xc.h nicht viel und 
ist wahrscheinlich nicht vorhanden

von Gerd B. (bertr2d2) Benutzerseite


Lesenswert?

Ich würde gerne den xc8 vermeiden. Deshalb, wie Wolfgang es schon gesagt 
hat, bringt ein '#include <xc.h>' nix.

von Teo D. (teoderix)


Lesenswert?

Ups (:|

Dann vermute ich mal, der sdcc kennt die Pic Type (noch*) nicht.

*)Manual 4.5.2


PS:
Gerd B. schrieb:
> Ich würde gerne den xc8 vermeiden.
Warum?

: Bearbeitet durch User
von Gerd B. (bertr2d2) Benutzerseite


Lesenswert?

Teo Derix schrieb:
> Ups (:|
>
> Dann vermute ich mal, der sdcc kennt die Pic Type (noch*) nicht.
>
> *)Manual 4.5.2
>
>
> PS:
> Gerd B. schrieb:
>> Ich würde gerne den xc8 vermeiden.
> Warum?

Laut Doku zu sdcc 3.4.1 :
1
Supported devices with enhanced cores:
2
3
16F: 1703, 1704, 1705, 1707, 1708, 1709, 1713, 1716, 1717, 1718, 1719, 1782, 1783, 1784, 1786, 1787, 1788,
4
1789

bzw:
1
 % gpasm -l | grep 16f1704
2
p16f1704       p16f1705       p16f1707       p16f1708       p16f1709       p16f1713

Ich denke nicht, das der SDCC schuld ist, denn das Kompilieren klappt:
1
sdcc -V --use-non-free -mpic14 -p16f1704 main.c
2
+ /usr/local/bin/sdcpp -nostdinc -Wall -D__SDCC_PROCESSOR="16f1704" -DSDCC_PROCESSOR="16f1704" -D__SDCC_PIC16F1704 -obj-ext=.o -D__SDCC_USE_NON_FREE -DSDCC_USE_NON_FREE -D__SDCC=3_4_1 -DSDCC=341 -D__SDCC_REVISION=9092 -DSDCC_REVISION=9092 -D__SDCC_pic14 -DSDCC_pic14 -D__pic14 -D__STDC_NO_COMPLEX__ -D__STDC_NO_THREADS__ -D__STDC_NO_ATOMICS__ -D__STDC_NO_VLA__ -isystem /usr/local/bin/../share/sdcc/include/pic14 -isystem /usr/local/share/sdcc/include/pic14 -isystem /usr/local/bin/../share/sdcc/include -isystem /usr/local/share/sdcc/include -isystem /usr/local/bin/../share/sdcc/non-free/include/pic14 -isystem /usr/local/share/sdcc/non-free/include/pic14 -isystem /usr/local/bin/../share/sdcc/non-free/include -isystem /usr/local/share/sdcc/non-free/include  main.c
3
+ /usr/local/bin/gpasm -o main.o -c main.asm
4
+ /usr/local/bin/gplink -I/usr/local/bin/../share/sdcc/lib/pic14 -I/usr/local/share/sdcc/lib/pic14 -I/usr/local/bin/../share/sdcc/non-free/lib/pic14 -I/usr/local/share/sdcc/non-free/lib/pic14  -I/usr/local/bin/../share/sdcc/lib/pic14 -I/usr/local/share/sdcc/lib/pic14 -I/usr/local/bin/../share/sdcc/non-free/lib/pic14 -I/usr/local/share/sdcc/non-free/lib/pic14   -w -r -o main main.o   libsdcc.lib pic16f1704.lib
5
message: Using default linker script "/usr/local/share/gputils/lkr/16f1704_g.lkr".
6
7
error: Processor family mismatch in "idata.o".
8
error: Processor family mismatch in "_gptrget1.o".
9
error: Processor family mismatch in "_gptrget2.o".
10
error: Missing definition for symbol "_INDF", required by "_gptrget1.o".
11
error: Missing definition for symbol "_FSR", required by "_gptrget1.o".
12
13
+ /usr/local/bin/gplink -I/usr/local/bin/../share/sdcc/lib/pic14 -I/usr/local/share/sdcc/lib/pic14 -I/usr/local/bin/../share/sdcc/non-free/lib/pic14 -I/usr/local/share/sdcc/non-free/lib/pic14  -I/usr/local/bin/../share/sdcc/lib/pic14 -I/usr/local/share/sdcc/lib/pic14 -I/usr/local/bin/../share/sdcc/non-free/lib/pic14 -I/usr/local/share/sdcc/non-free/lib/pic14   -w -r -o main main.o   libsdcc.lib pic16f1704.lib  returned errorcode 256
14
make: *** [main] Error 1

Das Linken eben nicht.

Für das bischen Blinky sollte der sdcc bzw. gputils doch locker reichen 
...

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.