Помощь - Поиск - Пользователи - Календарь
Полная версия этой страницы: AT91 USB CDC Driver
Форум разработчиков электроники ELECTRONIX.ru > Микроконтроллеры (MCs) > ARM
romez777
Приветствую,

взял пример драйвера с atmel.com, пример заточен под ARM. Теперь переношу под arm-gcc (toolchain из проекта YAGARTO), все подточил, кроме файла udp.c. Постоянно валится со следующими ошибками:

Код
udp.c: In function 'UDP_ConfigureEndpoint':
udp.c:579: error: dereferencing pointer to incomplete type
udp.c:580: error: dereferencing pointer to incomplete type
udp.c:582: error: dereferencing pointer to incomplete type
udp.c:602: error: dereferencing pointer to incomplete type


Код, на котором валится:

Код
bool UDP_ConfigureEndpoint(const S_usb                     *pUsb,
                           const S_usb_endpoint_descriptor *pEpDesc)
{
    unsigned char  bEndpoint;
    ...
    bEndpoint = (unsigned char) (pEpDesc->bEndpointAddress & 0x7);
    bType = (unsigned char) (pEpDesc->bmAttributes & 0x3);

    if (ISSET(pEpDesc->bEndpointAddress, 1 << 7)) {
        ....
    }
    .....

    pEndpoint->wMaxPacketSize = pEpDesc->wMaxPacketSize;

    .....
}


Файл, в котором определен S_usb_endpoint_descriptor подключается в самом начале udp.c.
В чем же проблема? Надеюсь кто-то уже поборол это?

Заранее благодарю!
romez777
Цитата(romez777 @ Dec 24 2007, 10:03) *
Приветствую,

взял пример драйвера с atmel.com, пример заточен под ARM. Теперь переношу под arm-gcc (toolchain из проекта YAGARTO), все подточил, кроме файла udp.c. Постоянно валится со следующими ошибками:

Код
udp.c: In function 'UDP_ConfigureEndpoint':
udp.c:579: error: dereferencing pointer to incomplete type
udp.c:580: error: dereferencing pointer to incomplete type
udp.c:582: error: dereferencing pointer to incomplete type
udp.c:602: error: dereferencing pointer to incomplete type


Код, на котором валится:

Код
bool UDP_ConfigureEndpoint(const S_usb                     *pUsb,
                           const S_usb_endpoint_descriptor *pEpDesc)
{
    unsigned char  bEndpoint;
    ...
    bEndpoint = (unsigned char) (pEpDesc->bEndpointAddress & 0x7);
    bType = (unsigned char) (pEpDesc->bmAttributes & 0x3);

    if (ISSET(pEpDesc->bEndpointAddress, 1 << 7)) {
        ....
    }
    .....

    pEndpoint->wMaxPacketSize = pEpDesc->wMaxPacketSize;

    .....
}


Файл, в котором определен S_usb_endpoint_descriptor подключается в самом начале udp.c.
В чем же проблема? Надеюсь кто-то уже поборол это?

Заранее благодарю!


Эту проблему победил, но теперь не работает линковка. Линкер вызывается с такими ключами:
Код
arm-elf-ld -r -o ..\obj\core.o -x -S udp.o device.o board.o at91stdio.o standard.o


Что приводит к ошибкам:
Код
device.o: In function `AT91F_AIC_ConfigureIt':
device.c:(.text+0x0): multiple definition of `AT91F_AIC_ConfigureIt'
udp.o:udp.c:(.text+0x0): first defined here
device.o: In function `AT91F_AIC_EnableIt':
device.c:(.text+0x38): multiple definition of `AT91F_AIC_EnableIt'
udp.o:udp.c:(.text+0x38): first defined here
device.o: In function `AT91F_AIC_DisableIt':
device.c:(.text+0x48): multiple definition of `AT91F_AIC_DisableIt'
udp.o:udp.c:(.text+0x48): first defined here
device.o: In function `AT91F_AIC_ClearIt':
device.c:(.text+0x5c): multiple definition of `AT91F_AIC_ClearIt'
...
at91stdio.o: In function `AT91F_AIC_ConfigureIt':
at91stdio.c:(.text+0x0): multiple definition of `AT91F_AIC_ConfigureIt'
udp.o:udp.c:(.text+0x0): first defined here
at91stdio.o: In function `AT91F_AIC_EnableIt':
at91stdio.c:(.text+0x38): multiple definition of `AT91F_AIC_EnableIt'
udp.o:udp.c:(.text+0x38): first defined here
....
standard.o: In function `AT91F_TC_IsInterruptMasked':
standard.c:(.text+0x1924): multiple definition of `AT91F_TC_IsInterruptMasked'
udp.o:udp.c:(.text+0x2908): first defined here
standard.o: In function `AT91F_PWMC_IsStatusSet':
standard.c:(.text+0x1930): multiple definition of `AT91F_PWMC_IsStatusSet'
udp.o:udp.c:(.text+0x2914): first defined here
standard.o: In function `AT91F_PWMC_IsInterruptMasked':
standard.c:(.text+0x193c): multiple definition of `AT91F_PWMC_IsInterruptMasked'
udp.o:udp.c:(.text+0x2938): first defined here
standard.o: In function `AT91F_UDP_IsInterruptMasked':
standard.c:(.text+0x1948): multiple definition of `AT91F_UDP_IsInterruptMasked'
udp.o:udp.c:(.text+0x2944): first defined here
standard.o: In function `AT91F_AIC_Open':
standard.c:(.text+0x1954): multiple definition of `AT91F_AIC_Open'
udp.o:udp.c:(.text+0x29e0): first defined here


Функции AT91F_AIC_* определены в хедере через inline. Возможно, кто уже сталкивался с этим и и может помочь справиться.

Спасибо!
xelax
У тебя видимо в standart.c подключается два (или более smile.gif ) хидерника, где подключаются определения инлайновых функций.
amw
Цитата(xelax @ Dec 24 2007, 11:51) *
У тебя видимо в standart.c подключается два (или более smile.gif ) хидерника, где подключаются определения инлайновых функций.

inline функция должна быть static.
Тогда делай что хочеш, включай сколько хочеш.
И самое ей место в .h файле, а не .c
Для просмотра полной версии этой страницы, пожалуйста, пройдите по ссылке.
Invision Power Board © 2001-2025 Invision Power Services, Inc.