logo elektroda
logo elektroda
X
logo elektroda
REKLAMA
REKLAMA
Adblock/uBlockOrigin/AdGuard mogą powodować znikanie niektórych postów z powodu nowej reguły.

Błąd kompilacji w WinAVR przy użyciu biblioteki USBDRV i pliku main.c

operator5wp 07 Sie 2024 14:07 102 2
REKLAMA
  • #1 21183138
    operator5wp
    Poziom 16  
    Witam , mam problem z kompilacją w WinAVR biblioteki USBDRV i pliku main.c . W innym projekcie gdziem mam taki sam plik Makefile i te same biblioteki wszytko się dobrze kompiluje a tu wywala mi błąd i nie mogę znaleźć przyczyny.
    W załączniku zamieszczam cały kod.
    Przy kompilacji wywala takie coś :
    D:\Projects\USB_avr2\usb_lpt>make.exe all 
    avr-gcc -Wall -Os -DF_CPU=12000000    -Iusbdrv -I. -DDEBUG_LEVEL=0 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums  -Wstrict-prototypes -fno-tree-scev-cprop -fno-split-wide-types -Wl,-static -fdata-sections -ffunction-sections -Wl,--gc-sections --param inline-call-cost=2 -finline-limit=3 -fno-inline-small-functions -fno-move-loop-invariants -fno-tree-loop-optimize -fno-caller-saves -mmcu=atmega8 -c usbdrv/usbdrv.c -o usbdrv/usbdrv.o
    usbdrv/usbdrv.h:186: warning: 'usbFunctionSetup' used but never defined
    usbdrv/usbdrv.h:213: warning: 'usbFunctionDescriptor' used but never defined
    usbdrv/usbdrv.h:249: warning: 'usbFunctionWrite' used but never defined
    usbdrv/usbdrv.h:267: warning: 'usbFunctionRead' used but never defined
    usbdrv/usbdrv.h:281: warning: 'usbFunctionWriteOut' used but never defined
    usbdrv/usbdrv.c:608: warning: 'usbInit' defined but not used
    usbdrv/usbdrv.c:566: warning: 'usbPoll' defined but not used
    usbdrv/usbdrv.c:246: warning: 'usbSetInterrupt' defined but not used
    avr-gcc -Wall -Os -DF_CPU=12000000    -Iusbdrv -I. -DDEBUG_LEVEL=0 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums  -Wstrict-prototypes -fno-tree-scev-cprop -fno-split-wide-types -Wl,-static -fdata-sections -ffunction-sections -Wl,--gc-sections --param inline-call-cost=2 -finline-limit=3 -fno-inline-small-functions -fno-move-loop-invariants -fno-tree-loop-optimize -fno-caller-saves -mmcu=atmega8 -x assembler-with-cpp -c usbdrv/usbdrvasm.s -o usbdrv/usbdrvasm.o
    avr-gcc -Wall -Os -DF_CPU=12000000    -Iusbdrv -I. -DDEBUG_LEVEL=0 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums  -Wstrict-prototypes -fno-tree-scev-cprop -fno-split-wide-types -Wl,-static -fdata-sections -ffunction-sections -Wl,--gc-sections --param inline-call-cost=2 -finline-limit=3 -fno-inline-small-functions -fno-move-loop-invariants -fno-tree-loop-optimize -fno-caller-saves -mmcu=atmega8 -c usbdrv/oddebug.c -o usbdrv/oddebug.o
    avr-gcc -Wall -Os -DF_CPU=12000000    -Iusbdrv -I. -DDEBUG_LEVEL=0 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums  -Wstrict-prototypes -fno-tree-scev-cprop -fno-split-wide-types -Wl,-static -fdata-sections -ffunction-sections -Wl,--gc-sections --param inline-call-cost=2 -finline-limit=3 -fno-inline-small-functions -fno-move-loop-invariants -fno-tree-loop-optimize -fno-caller-saves -mmcu=atmega8 -c main.c -o main.o
    main.c: In function 'usbFunctionSetup':
    main.c:685: warning: assignment makes pointer from integer without a cast
    main.c:694: warning: assignment makes pointer from integer without a cast
    main.c: In function 'BuildStringFromUTF8':
    main.c:824: warning: suggest parentheses around arithmetic in operand of |
    main.c: At top level:
    main.c:842: warning: function declaration isn't a prototype
    main.c:965: warning: function declaration isn't a prototype
    main.c: In function 'usbFunctionDescriptor':
    main.c:1007: warning: assignment makes pointer from integer without a cast
    main.c: At top level:
    main.c:1153: warning: function declaration isn't a prototype
    main.c:1153: warning: return type of 'main' is not 'int'
    usbdrv/usbdrv.h:168: warning: 'usbInit' used but never defined
    usbdrv/usbdrv.h:174: warning: 'usbPoll' used but never defined
    usbdrv/usbdrv.h:220: warning: 'usbSetInterrupt' used but never defined
    main.c:679: warning: 'usbFunctionSetup' defined but not used
    main.c:978: warning: 'usbFunctionDescriptor' defined but not used
    main.c:776: warning: 'usbFunctionWrite' defined but not used
    main.c:761: warning: 'usbFunctionRead' defined but not used
    main.c:799: warning: 'usbFunctionWriteOut' defined but not used
    avr-gcc -Wall -Os -DF_CPU=12000000    -Iusbdrv -I. -DDEBUG_LEVEL=0 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums  -Wstrict-prototypes -fno-tree-scev-cprop -fno-split-wide-types -Wl,-static -fdata-sections -ffunction-sections -Wl,--gc-sections --param inline-call-cost=2 -finline-limit=3 -fno-inline-small-functions -fno-move-loop-invariants -fno-tree-loop-optimize -fno-caller-saves -mmcu=atmega8 -o main.elf usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o
    main.o: In function `start':
    main.c:(.init3+0x18): undefined reference to `usbMsgLen'
    main.c:(.init3+0x46): undefined reference to `usbInit'
    main.c:(.init3+0x1bc): undefined reference to `usbPoll'
    make.exe: *** [main.elf] Error 1
    <<< Process finished. (Exit code 2)
    ================ READY ================
    
  • REKLAMA
  • #2 21184066
    bialy
    Poziom 16  
    main.c:(.init3+0x18): undefined reference to `usbMsgLen'
    main.c:(.init3+0x46): undefined reference to `usbInit'
    main.c:(.init3+0x1bc): undefined reference to `usbPoll'

    szukaj tych 3 funkcji gdzie jest ich implementacja.
  • #3 21184251
    operator5wp
    Poziom 16  
    Witam, walczę z tym i nic. Teraz mam błąd związany usbTxLen, gdy w main,.c jest 'extern uchar usbTxLen' wywala taki błąd
    D:\Projects\proteus\USB_avr2\usb_lpt>make.exe all 
    avr-gcc -Wall -Os -DF_CPU=12000000    -Iusbdrv -I. -DDEBUG_LEVEL=0 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums  -Wstrict-prototypes -nostartfiles -ffreestanding  -mcall-prologues  -fno-tree-scev-cprop -fno-split-wide-types -Wl,-static -fdata-sections -ffunction-sections -Wl,--gc-sections --param inline-call-cost=2 -finline-limit=3 -fno-inline-small-functions -fno-move-loop-invariants -fno-tree-loop-optimize -fno-caller-saves -mmcu=atmega8 -c main.c -o main.o
    main.c:114: warning: function declaration isn't a prototype
    main.c:137: error: conflicting type qualifiers for 'usbTxLen'
    usbdrv/usbdrv.c:30: error: previous definition of 'usbTxLen' was here
    main.c: In function 'BuildStringFromUTF8':
    main.c:832: warning: suggest parentheses around arithmetic in operand of |
    main.c: At top level:
    main.c:850: warning: function declaration isn't a prototype
    main.c:973: warning: function declaration isn't a prototype
    make.exe: *** [main.o] Error 1

    Gdy usunę tą deklarację z main.c to wywala inny błąd:
    
    D:\Projects\proteus\USB_avr2\usb_lpt>make.exe all 
    avr-gcc -Wall -Os -DF_CPU=12000000    -Iusbdrv -I. -DDEBUG_LEVEL=0 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums  -Wstrict-prototypes -nostartfiles -ffreestanding  -mcall-prologues  -fno-tree-scev-cprop -fno-split-wide-types -Wl,-static -fdata-sections -ffunction-sections -Wl,--gc-sections --param inline-call-cost=2 -finline-limit=3 -fno-inline-small-functions -fno-move-loop-invariants -fno-tree-loop-optimize -fno-caller-saves -mmcu=atmega8 -c main.c -o main.o
    main.c:114: warning: function declaration isn't a prototype
    main.c: In function 'BuildStringFromUTF8':
    main.c:832: warning: suggest parentheses around arithmetic in operand of |
    main.c: At top level:
    main.c:850: warning: function declaration isn't a prototype
    main.c:973: warning: function declaration isn't a prototype
    avr-gcc -Wall -Os -DF_CPU=12000000    -Iusbdrv -I. -DDEBUG_LEVEL=0 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums  -Wstrict-prototypes -nostartfiles -ffreestanding  -mcall-prologues  -fno-tree-scev-cprop -fno-split-wide-types -Wl,-static -fdata-sections -ffunction-sections -Wl,--gc-sections --param inline-call-cost=2 -finline-limit=3 -fno-inline-small-functions -fno-move-loop-invariants -fno-tree-loop-optimize -fno-caller-saves -mmcu=atmega8 -o main.elf usbdrv/usbdrv.o usbdrv/usbdrvasm.o main.o
    main.o:(.data.usbTxLen+0x0): multiple definition of `usbTxLen'
    usbdrv/usbdrv.o:(.data.usbTxLen+0x0): first defined here
    make.exe: *** [main.elf] Error 1


    Dodano po 1 [godziny] 21 [minuty]:

    Wreszcie poszło, kod się skompilował. Zmieniłem w pliku Makefile :
    OBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o main.o
    na
    OBJECTS = usbdrv/usbdrvasm.o main.o
    W pliku main.c , usunąłem : extern uchar usbTxLen;
REKLAMA