Hi List.

I started developing for the STM32F103C8T6 based on the "Beginning STM32" book https://www.apress.com/gp/book/9781484236239 Using the regular "blue pill", as well as the RobotDyn "black pill" as hadware basis and all was well.

Then I got the idea to carefully step up my game by using a STM32F303CCT6. Hardware migration promised (and proved) to be very seamless, using also a F303 "black pill" with even pin compatible layout
and the only difference there being basically BOOT1/PB2 - see:

https://www.st.com/resource/en/application_note/dm00073522-migrating-from-stm32f1-series-to-stm32f3-series-microcontrollers-stmicroelectronics.pdf

I thought I could start writing somewhat device independent code. Well ... code that should run on both the STM32F103 and STM32F303. However, I'm hitting quite a few walls with libopencm3 there. It seems there are particular inconsistencies for libopencm3 for these
two families where I had actually hoped they would be "almost the same".

I still haven't the amount of insight I'd like to have in the libopencm3 code base, but to my defense I have to say it doesn't make it easy.

https://github.com/libopencm3/libopencm3/commit/ebb058825f356474aa5cefa3b3e71b5f18cc670c
("[STM32F3] Removed all specific F3 stuff out of common files.")

And there you see the code being moved to e.g. ...common_f0124.h
So why exactly is "3" omitted from the common stuff, when it is supposed to be THE migration path for F1 devices? Maybe they are so similar I could simply continue use the F1 files? Nope - that messes up way more one is willing to fix.

Why are there such inconsistencies even in the register naming?

e.g.

F1/NVIC

#define NVIC_USART1_IRQ 37
#define NVIC_USART2_IRQ 38
#define NVIC_USART3_IRQ 39

then you try to compile your code for F3 and after this gets thrown at you


src/uartlib.c:42:24: error: 'NVIC_USART1_IRQ' undeclared here (not in a function); did you mean 'NVIC_USB_HP_IRQ'? 42 | { USART1, RCC_USART1, NVIC_USART1_IRQ, uart1_getc, uart1_putc },
      |                        ^~~~~~~~~~~~~~~
      |                        NVIC_USB_HP_IRQ
src/uartlib.c:43:24: error: 'NVIC_USART2_IRQ' undeclared here (not in a function); did you mean 'NVIC_SPI2_IRQ'? 43 | { USART2, RCC_USART2, NVIC_USART2_IRQ, uart2_getc, uart2_putc },
      |                        ^~~~~~~~~~~~~~~
      |                        NVIC_SPI2_IRQ
src/uartlib.c:44:24: error: 'NVIC_USART3_IRQ' undeclared here (not in a function); did you mean 'NVIC_USB_HP_IRQ'?
   44 |  { USART3, RCC_USART3, NVIC_USART3_IRQ, uart3_getc, uart3_putc }
      |                        ^~~~~~~~~~~~~~~


you find out that for F3 it is (observe the "did you mean")

#define NVIC_USART1_EXTI25_IRQ 37
#define NVIC_USART2_EXTI26_IRQ 38
#define NVIC_USART3_EXTI28_IRQ 39

:-P Uh.

So - what am I doing wrong in using libopencm3 or does it really need some streamlining between F1 and F3 family?



regards,
--
Rico


_______________________________________________
libopencm3-devel mailing list
libopencm3-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libopencm3-devel

Reply via email to