Path: ...!weretis.net!feeder8.news.weretis.net!news.trigofacile.com!usenet-fr.net!agneau.org!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!cleanfeed3-b.proxad.net!nnrp1-1.free.fr!not-for-mail Newsgroups: fr.comp.lang.c From: JKB Subject: Fonction inline Reply-To: User-Agent: slrn/1.0.3 (Linux) Mime-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Message-ID: Date: 31 Jan 2022 15:44:43 GMT Lines: 81 Organization: Guest of ProXad - France NNTP-Posting-Date: 31 Jan 2022 16:44:43 CET NNTP-Posting-Host: 62.212.98.88 X-Trace: 1643643883 news-3.free.fr 20262 62.212.98.88:44349 X-Complaints-To: abuse@proxad.net Bytes: 3524 Bonjour à tous, J'obtiens une erreur que je ne m'explique pas dans l'édition des liens d'un firmware compilé avec avr-gcc. J'ai écrit ceci : void freqdiv(uint8_t diviseur) { mutex_lock(&mutex_freqdiv); if ((CLKPR & 0x0F) != diviseur) { stty_print("freqdiv "); stty_hexprint(CLKPR & 0x0F); stty_print("->"); stty_hexprint(diviseur); stty_print("\r\n"); while(uart0_BytesToSend() > 0); ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { diviseur &= 0x0F; CLKPR = (1 << CLKPCE); CLKPR = diviseur; } ... } ... } L'édition des liens me répond : make[1] : on quitte le répertoire « /home/bertrand/cvs/firmware-antivol4/usart » /usr/local/cross/avr/bin/avr-gcc -mmcu=atmega1284 -Wl,-Map,firmware.map -o firmware.elf main.o affichage.o interruptions.o io.o spi.o vfd.o mcp3001.o mcp23s08.o random.o stty.o leds.o horloge.o badges.o task_25Hz.o task_gnss.o gnss.o satellites.o synchronisation.o rscombo.o trame.o derivation_clefs.o task_boutons.o task_affichage.o eui64.o lorawan.o task_lorawan.o task_commandes.o task_puissance.o programmation.o iso14443a.o clrc632.o task_nfc.o usart/libusart.a crypto/libcrypto.a lorawan/liblorawan.a multitasking/libmultitasking.a \ -Wl,-u,vfprintf -lprintf_flt -lm /usr/local/cross/avr/lib/gcc/avr/11.1.0/../../../../avr/bin/ld: task_25Hz.o: in function `freqdiv': /home/bertrand/cvs/firmware-antivol4/task_25Hz.c:47: undefined reference to `uart0_BytesToSend' collect2: error: ld returned 1 exit status make: *** [Makefile:68 : firmware] Erreur 1 Ce que je ne saisis pas, c'est que cette fonction est une fonction inline définie dans une bibliothèque que j'utilise (libusart pour avoir un vrai port série avec RTS et CTS). J'ai regardé ce que me sort le compilo avec l'option -E : .... void uart0_flush(void); extern volatile uint8_t tx0_Head, tx0_Tail; inline uint8_t uart0_BytesToSend(void) { return (tx0_Head - tx0_Tail - 1) & (128 - 1); } # 1836 "usart/usart.h" char uart0_getc(void); .... puis la ribambelle d'includes et mon code qui est inclus comme ceci : # 53 "task_25Hz.c" & 0x0F); stty_print("->"); stty_hexprint(diviseur); stty_print("\r\n"); while(uart0_BytesToSend() > 0); Je ne comprends pas pourquoi une fonction inline déclarée comme ceci provoque un problème à l'édition des liens. Je suis preneur de toute explication. Merci d'avance, JKB -- Si votre demande me parvient en code 29, je vous titiouillerai volontiers une réponse.