Skip to contentSkip to conversation

board/stm32f469-disco: update board configuration

PATCH New Yauheni Saldatsenka 1 participant 1 message Jul 23, 2021 Arm STM32

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 board/stm32f469-disco: update board configuration

Update STM32F469-disco configuration files to operate with new kernel.

Result of make tinyconfig was taken as a starting point to fit kernel into flash memory.
Current setup fits in 2MB on-chip flash memory with rootfs offloaded to MMC card.

Kernel features enabled:
- MMC card driver
- DRM MIPI-DSI drivers
- Random number generator
Fixes:
- Move kernel to new flash bank due to growth of dtb size
- Fix kernel start address in bootloader
- Remove outdated path which doesn't affect normal operation mode

---
 .../stm32f469-disco/flash.sh                  |  47 +++-
 .../stm32f469-disco/linux/defconfig           | 120 +++++++++
 .../stm32f469-disco/linux/stm32f469-disco.dts | 240 ++++++++++++++++++
 .../0002-kernel-start-address.patch           |  21 ++
 .../patches/afboot-stm32/0003-no-mpu.patch    |  22 ++
 configs/stm32f469_disco_xip_defconfig         |  24 ++
 6 files changed, 465 insertions(+), 9 deletions(-)
 create mode 100644 board/stmicroelectronics/stm32f469-disco/linux/defconfig
 create mode 100644 board/stmicroelectronics/stm32f469-disco/linux/stm32f469-disco.dts
 create mode 100644 board/stmicroelectronics/stm32f469-disco/patches/afboot-stm32/0002-kernel-start-address.patch
 create mode 100644 board/stmicroelectronics/stm32f469-disco/patches/afboot-stm32/0003-no-mpu.patch
 create mode 100644 configs/stm32f469_disco_xip_defconfig
board/stmicroelectronics/stm32f469-disco/flash.sh +38 -9
index 984d2b2599..176e1c9d2c 100755
@@ -1,18 +1,47 @@
 #!/bin/bash
 
 OUTPUT_DIR=$1
+BUILD_TYPE=$2
 
-if ! test -d "${OUTPUT_DIR}" ; then
+if ! test -d "${OUTPUT_DIR}"
+then
     echo "ERROR: no output directory specified."
     echo "Usage: $0 OUTPUT_DIR"
     exit 1
 fi
 
-${OUTPUT_DIR}/host/bin/openocd -f board/stm32f469discovery.cfg \
-  -c "init" \
-  -c "reset init" \
-  -c "flash probe 0" \
-  -c "flash info 0" \
-  -c "flash write_image erase ${OUTPUT_DIR}/images/u-boot.bin 0x08000000" \
-  -c "reset run" \
-  -c "shutdown"
+if  [[ -z "${BUILD_TYPE}" ]]
+then
+    echo "ERROR: no build type specified, please select 'xip' or 'uboot'."
+    echo "Usage: $0 OUTPUT_DIR $1 BUILD_TYPE"
+    exit 1
+fi
+
+case "${BUILD_TYPE}" in
+	"xip")
+		${OUTPUT_DIR}/host/bin/openocd -f board/stm32f469discovery.cfg \
+					 -c "init" \
+					 -c "reset init" \
+					 -c "flash probe 0" \
+					 -c "flash info 0" \
+					 -c "flash write_image erase ${OUTPUT_DIR}/images/stm32f469i-disco.bin 0x08000000" \
+					 -c "flash write_image erase ${OUTPUT_DIR}/images/stm32f469-disco.dtb 0x08004000" \
+					 -c "flash write_image erase ${OUTPUT_DIR}/images/xipImage 0x08010000" \
+					 -c "reset run" \
+					 -c "shutdown"
+		;;
+	"uboot")
+		FLASH_COMMAND=
+		${OUTPUT_DIR}/host/bin/openocd -f board/stm32f469discovery.cfg \
+					 -c "init" \
+					 -c "reset init" \
+					 -c "flash probe 0" \
+					 -c "flash info 0" \
+					 -c "flash write_image erase ${OUTPUT_DIR}/images/u-boot.bin 0x08000000" \
+					 -c "reset run" \
+					 -c "shutdown"
+	    ;;
+	*)
+		echo "Wrong build type. Please select from: xip, uboot"
+		;;
+esac
board/stmicroelectronics/stm32f469-disco/linux/defconfig new file +120 -0

120 lines not on this page · raw message

board/stmicroelectronics/stm32f469-disco/linux/stm32f469-disco.dts new file +240 -0

240 lines not on this page · raw message

board/stmicroelectronics/stm32f469-disco/patches/afboot-stm32/0002-kernel-start-address.patch new file +21 -0
new file mode 100644
index 0000000000..614effa85b
@@ -0,0 +1,21 @@
+diff --git a/stm32f469i-disco.c b/stm32f469i-disco.c
+index 2da1f4b65f..96e4dff65e 100644
+--- a/stm32f469i-disco.c
++++ b/stm32f469i-disco.c
+@@ -6,6 +6,7 @@
+ #include "gpio.h"
+ #include "mpu.h"
+ 
++#define KERNEL_ADDR     0x08010000
+ #define CONFIG_HSE_HZ	8000000
+ #define CONFIG_PLL_M	8
+ #define CONFIG_PLL_N	360
+@@ -85,7 +86,7 @@ static void fmc_wait_busy(void)
+ 
+ void start_kernel(void)
+ {
+-	void (*kernel)(uint32_t reserved, uint32_t mach, uint32_t dt) = (void (*)(uint32_t, uint32_t, uint32_t))(0x08008000 | 1);
++	void (*kernel)(uint32_t reserved, uint32_t mach, uint32_t dt) = (void (*)(uint32_t, uint32_t, uint32_t))(KERNEL_ADDR | 1);
+ 
+ 	kernel(0, ~0UL, 0x08004000);
+ }
board/stmicroelectronics/stm32f469-disco/patches/afboot-stm32/0003-no-mpu.patch new file +22 -0
new file mode 100644
index 0000000000..bc66d2d0ef
@@ -0,0 +1,22 @@
+diff --git a/stm32f469i-disco.c b/stm32f469i-disco.c
+index d4d0909831..03f823f288 100644
+--- a/stm32f469i-disco.c
++++ b/stm32f469i-disco.c
+@@ -127,7 +127,7 @@ int main(void)
+ 
+ 	int i;
+ 
+-	mpu_config(0x0);
++	mpu_config(0xc0000000); 
+ 
+ 	if (*FLASH_CR & FLASH_CR_LOCK) {
+ 		*FLASH_KEYR = 0x45670123;
+@@ -229,7 +229,7 @@ int main(void)
+ 	usart_setup(usart_base, 45000000);
+ 	usart_putch(usart_base, '.');
+ 
+-	*SYSCFG_MEMRMP = 0x4;
++	/* *SYSCFG_MEMRMP = 0x4; */
+ 
+ 	start_kernel();
+ 
configs/stm32f469_disco_xip_defconfig new file +24 -0
new file mode 100644
index 0000000000..81bdb0d6d6
@@ -0,0 +1,24 @@
+BR2_arm=y
+BR2_cortex_m4=y
+BR2_GLOBAL_PATCH_DIR="board/stmicroelectronics/stm32f469-disco/patches"
+BR2_KERNEL_HEADERS_5_13=y
+# BR2_UCLIBC_INSTALL_UTILS is not set
+BR2_GCC_VERSION_11_X=y
+BR2_GCC_ENABLE_LTO=y
+BR2_ROOTFS_POST_BUILD_SCRIPT="board/stmicroelectronics/common/stm32f4xx/stm32-post-build.sh"
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/stmicroelectronics/stm32f469-disco/linux/defconfig"
+BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM=y
+BR2_LINUX_KERNEL_XZ=y
+BR2_LINUX_KERNEL_IMAGE_TARGET_NAME="xipImage"
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="stm32f469-disco"
+BR2_LINUX_KERNEL_CUSTOM_DTS_PATH="board/stmicroelectronics/stm32f469-disco/linux/stm32f469-disco.dts"
+BR2_PACKAGE_BUSYBOX_CONFIG="package/busybox/busybox-minimal.config"
+BR2_PACKAGE_ZLIB=y
+BR2_TARGET_ROOTFS_INITRAMFS=y
+# BR2_TARGET_ROOTFS_TAR is not set
+BR2_TARGET_AFBOOT_STM32=y
+BR2_PACKAGE_HOST_OPENOCD=y
+BR2_PACKAGE_HOST_UTIL_LINUX=y
Signature · 6 lines
2.32.0

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot