Thanks for the notification.
Your proposal is mostly OK for me, I hope others will send reactions
too. I have just one concern.
If I attempt to rephrase the proposal: Starting from a commit in a
future, stm32h7 GPIO definitions will not include speed indications
anymore, and these will have to be added manually in board.h, but ONLY
if the LEGACY_PINMAP is not set?
Here is my concern: What will happen if a user (me, probably) builds a
NuttX with this new commit from a full stored defconfig, but does not
regenerate its config prior to rebuilding ? the LEGACY_PINMAP setting
will not be present when building in that case.
Can we force a config update before starting the build, so the
LEGACY_PINMAP setting will be set to Y automatically in all cases?
Also, this has to be documented very clearly, not just the official
release notes for the next release!
Aditionnally, if LEGACY_PINMAP is set in user config, maybe we can add a
compile time warning in stm32h7/stm32_gpio.c that in the future, users
are required to update their board.h and once done, disable LEGACY_PINMAP ?
Sebastien
Le 07/04/2023 à 15:34, David Sidrane a écrit :
Opening the discussion for this issue on the list. See
https://github.com/apache/nuttx/issues/1570
I would like to get feedback on the approach see if we can move forward on
this.
While some solutions were discussed in
- Revert "stm32h7 sdmmc: set SDMMC_CK pin to high speed (50 MHz) mode."
#5012 <https://github.com/apache/nuttx/pull/5012>
I would like to propose a solution for this issue as a request for comment:
1. That will not affect any existing boards
2. Will allow us to fix the issues without forcing massive changes.
3. Eventually after N more releases of NuttX deprecate the solution.
Steps to get there:
1. Kconfig for all effected arches will have STM32xxx_USE_LEGACY_PINMAP
set to yes as a default.
2. Rework top level pinmap files E.G. hardware/stm32_pinmap.h.
3. The current pinmap file will be renamed with _legacy E.G.
hardware/stm32h7x3xx_pinmap_legacy.h
4. Rework chip specific files removing speeds and adding _0 to the
previous no-selectable pins with speeds
5. Rework chip specific files adding _0 to the previous no-selectable
pins
The hardware/stm32_pinmap.h will have the following structure
#if defined(STM32H7_USE_LEGACY_PINMAP )
# if defined(CONFIG_STM32H7_STM32H7X3XX)
# include "hardware/stm32h7x3xx_pinmap_legacy.h"
# elif defined(CONFIG_STM32H7_STM32H7X7XX)
# include "hardware/stm32h7x3xx_pinmap_legacy.h"
# else
# error "Unsupported STM32 H7 Legacy Pin map"
# endif
#else
# if defined(CONFIG_STM32H7_STM32H7X3XX)
# include "hardware/stm32h7x3xx_pinmap.h"
# elif defined(CONFIG_STM32H7_STM32H7X7XX)
# include "hardware/stm32h7x3xx_pinmap.h"
# else
# error "Unsupported STM32 H7 Pin map"
# endif
# endif
Moving forward boards will turn off STM32xx_USE_LEGACY_PINMAP and update
the board.h files to fully define
the pins with selected speeds.
was:
#define GPIO_SDMMC2_CK GPIO_SDMMC2_CK_1 /* PD6 FC_PD6_SDMMC2_CK */
#define GPIO_SDMMC2_CMD GPIO_SDMMC2_CMD_1 /* PD7 FC_PD7_SDMMC2_CMD */
// GPIO_SDMMC2_D0 No Remap /* PB14 FC_PB14_SDMMC2_D0 */
// GPIO_SDMMC2_D1 No Remap /* PB15 FC_PB15_SDMMC2_D1 */
#define GPIO_SDMMC2_D2 GPIO_SDMMC2_D2_1 /* PG11 FC_PG11_SDMMC2_D2 */
// GPIO_SDMMC2_D3 No Remap /* PB4 FC_PB4_SDMMC2_D3 */
is:
#define GPIO_SDMMC2_CK (GPIO_SDMMC2_CK_1 | GPIO_SPEED_25MHz) /*
PD6 FC_PD6_SDMMC2_CK */
#define GPIO_SDMMC2_CMD (GPIO_SDMMC2_CMD_1 | GPIO_SPEED_2MHz) /*
PD7 FC_PD7_SDMMC2_CMD */
#define GPIO_SDMMC2_D0 (GPIO_SDMMC2_D0_0 | GPIO_SPEED_2MHz) /* PB14
FC_PB14_SDMMC2_D0 */
#define GPIO_SDMMC2_D1 (GPIO_SDMMC2_D1_0 | GPIO_SPEED_2MHz)/* PB15
FC_PB15_SDMMC2_D1 */
#define GPIO_SDMMC2_D2 GPIO_SDMMC2_D2_1 | GPIO_SPEED_2MHz) /*
PG11 FC_PG11_SDMMC2_D2 */
#define GPIO_SDMMC2_D3 (GPIO_SDMMC2_D3_0 | GPIO_SPEED_2MHz) /* PB4
FC_PB4_SDMMC2_D3 */
To maintain the speed that was set in the legacy files just diff the
_legacy file
with the non legacy file and use that
speed when creating the #define.