Re: STM32F103x port

Kalowsky, Daniel <daniel.kalowsky@...>

-----Original Message-----
From: Maciek Borzecki [mailto:maciek.borzecki(a)]
Sent: Tuesday, March 1, 2016 11:19 AM
To: Brandewie, Dirk J <dirk.j.brandewie(a)>
Cc: Kalowsky, Daniel <daniel.kalowsky(a)>;
devel(a); users(a)
Subject: Re: [devel] Re: Re: STM32F103x port

On 03/01 10:17, Dirk Brandewie wrote:

On 02/29/2016 02:26 PM, Kalowsky, Daniel wrote:
-----Original Message-----
First suggestion, create an arch/arm/soc/stm32, and use the Kconfig to
allow selecting of the various flavors of the STM32 chip. This would
be similar to what you've already got with the Kconfig.soc.stm32f103ve
file, merged with the values from your Kconfig.soc. Then keeping the
Kconfig to the pieces generic to all the STM32 portions (i.e. flash
size, base address, etc).

Makes sense. I think we should also add another 'MCU family' level of
hierarchy. We would have then:

<soc specific>
<soc specific>
<soc specific>
I'm not opposed to this.

Ben/Dirk any commentary?
Having thought about it for 10 seconds it seems reasonable :-) To the
greatest extent reasonable please avoid link time binding of SOC specifc
code into the generic stm32 code. We don't want to the next guy to
wonder which init() function is called.
Do you mind taking a look here
and sending some feedback?

The branch implements this layout:
Kconfig <-- includes family specific Kconfigs
Kconfig.soc <-- SOC family selection under 'General platform..'
Only one x? I'll admit to being relatively new to the STM32 family so it's not clear to me if 10x and 1xx will make any difference. Same goes for other STM32F models. I'm not sure the sub-directories are needed yet. Still digesting this one.

Makefile <-- list of possible MCUs in this family
general defaults
Having done some minor toying around with Kconfig today, I decided to use Kconfig.soc to just declare the generic STM32 family. From there, the Kconfig is used to better tune to which family type, but that most likely isn't enough granularity. Looks like you and I had done some similar work, as I just uploaded my minor tinkering from today.

Kconfig.soc.stm32f103ve <-- STM32F103VE specific settings
Kconfig.soc.stm32f103rb <-- xxRB model if we had
NUCLEO-FRB103 board
soc.{c,h} <-- MCU specifi headers & code
<soc specific>
<soc specific>

There's a little trick in Kconfig under stm32/<MCU-specific>, CONFIG_SOC
is set to have a default of pointing to MCU specific directory. For
example, for stm32f1x, the SOC defaults to stm32/stm32f1x, this ensures
that MCU specific path is included in CFLAGS.

Then under menuconfig we have:
-> ARM architecture
-> General Platform Configuration
-> SoC Selection (<choice> [=y]) <-- STM32F1x

and MCU selection:

-> ARM architecture
-> STM32F1x MCU Selection (<choice> [=y]) <-- STM32F103VE

Maciek Borzecki

Join to automatically receive all group messages.