Problem with STM32 pin configuration

Ole Reinhardt <ole.reinhardt-L1vi/[email protected]>
Newsgroups gmane.comp.hardware.microcontrollers.ethernut
Message-ID <[email protected]>
Hi Uwe,

there is a problem with your new pin configuration scheme, which you
committed a few days ago, which breaks several drivers.

The problem is, that the GCC preprocessor does not know anything about
types. But in several places, a preprocessor comparison like

#if (SPI_CS0 != PIN_NONE)

is used, where PIN_NONE is of the enum type nutgpio_t.

The above comparison is always true, as the preprocessor takes SPI_CS0
and PIN_NONE as identifiers, not as macros. These are then both replaced
by 0. So finally the comparison is always true.

This kind of preprocessor comparisons are at least used in

arch/cm3/dev/stm/stm32_spi.c
arch/cm3/dev/stm/stm32_emac.c

but perhaps ins several more.

See also https://gcc.gnu.org/onlinedocs/gcc-3.0.2/cpp_4.html#SEC38 for a
detailed explanation.


Could you please have a look at it? Unfortunately I do not have an idea
for an elegant solution.

Best regards,

Ole


-- 
kernel concepts GmbH            Tel: +49-271-771091-14
Sieghuetter Hauptweg 48         Mob: +49-177-7420433
D-57072 Siegen
http://www.embedded-it.de
http://www.kernelconcepts.de
_______________________________________________
http://lists.egnite.de/mailman/listinfo/en-nut-discussion
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.