
Hi,
On 02/05/2018 02:33 AM, patrice.chotard@st.com wrote:
From: Patrice Chotard patrice.chotard@st.com
This allows to create and set the environment variable "soc_name" which contains the current STM32 SoC's name.
Signed-off-by: Christophe Priouzeau christophe.priouzeau@st.com Signed-off-by: Patrice Chotard patrice.chotard@st.com
For the series, Reviewed-by: Vikas Manocha vikas.manocha@st.com
One point below, [...]
#endif /* _ASM_ARCH_HARDWARE_H */ diff --git a/arch/arm/mach-stm32/soc.c b/arch/arm/mach-stm32/soc.c index df20d547c500..06ca61b270cf 100644 --- a/arch/arm/mach-stm32/soc.c +++ b/arch/arm/mach-stm32/soc.c @@ -8,6 +8,7 @@ #include <common.h> #include <asm/io.h> #include <asm/armv7m_mpu.h> +#include <asm/arch/stm32.h>
int arch_cpu_init(void) { @@ -54,3 +55,17 @@ int arch_cpu_init(void)
return 0; }
+void set_env_soc_name(void) +{
- char soc[16];
+#ifdef CONFIG_STM32F4
- snprintf(soc, sizeof(soc), "stm32f4");
+#elif CONFIG_STM32F7
- snprintf(soc, sizeof(soc), "stm32f7");
+#elif CONFIG_STM32H7
- snprintf(soc, sizeof(soc), "stm32h7");
+#endif
Can we move these conditional checks in the background like in some header file inline function & use it like get_soc_name();
Cheers, Vikas
- env_set("soc_name", soc);
+}