[Buildroot] [PATCH 3/3] [PATCH v3 1/1] configs/stm32f469_disco_xip_defconfig: alternative defconfig for XIP

Yauheni Saldatsenka eugentoo at gmail.com
Wed Aug 25 18:18:58 UTC 2021


Result of make tinyconfig was taken as a starting point to fit kernel
into flash memory.
Current setup kernel + rootfs fits in 1.6MB on-chip flash memory.

Fixes:
    - Move kernel to new flash bank due to growth of dtb size
    - Fix kernel start address in bootloader

For better binary size optimization gcc LTO is turned on.

Signed-off-by: Yauheni Saldatsenka <eugentoo at gmail.com>

----
v2 -> v3:
- Create separate readme.txt for xip configuration
- Create separate flash.sh script for xip configuration

Signed-off-by: Yauheni Saldatsenka <eugentoo at gmail.com>
---
 .../stm32f469-disco/flash.sh                  | 45 ++++---------------
 .../stm32f469-disco/flash_xip.sh              | 20 +++++++++
 .../stm32f469-disco/readme.txt                | 26 +++--------
 .../stm32f469-disco/readme_xip.txt            | 22 +++++++++
 4 files changed, 57 insertions(+), 56 deletions(-)
 create mode 100644 board/stmicroelectronics/stm32f469-disco/flash_xip.sh
 create mode 100644 board/stmicroelectronics/stm32f469-disco/readme_xip.txt

diff --git a/board/stmicroelectronics/stm32f469-disco/flash.sh b/board/stmicroelectronics/stm32f469-disco/flash.sh
index 0e130908aa..984d2b2599 100755
--- a/board/stmicroelectronics/stm32f469-disco/flash.sh
+++ b/board/stmicroelectronics/stm32f469-disco/flash.sh
@@ -1,45 +1,18 @@
 #!/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
 
-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
+${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"
diff --git a/board/stmicroelectronics/stm32f469-disco/flash_xip.sh b/board/stmicroelectronics/stm32f469-disco/flash_xip.sh
new file mode 100644
index 0000000000..b5a067cee5
--- /dev/null
+++ b/board/stmicroelectronics/stm32f469-disco/flash_xip.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+OUTPUT_DIR=$1
+
+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/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"
diff --git a/board/stmicroelectronics/stm32f469-disco/readme.txt b/board/stmicroelectronics/stm32f469-disco/readme.txt
index 646f340382..c1e1d30e69 100644
--- a/board/stmicroelectronics/stm32f469-disco/readme.txt
+++ b/board/stmicroelectronics/stm32f469-disco/readme.txt
@@ -4,37 +4,23 @@ STM32F469 Discovery
 This tutorial describes how to use the predefined Buildroot
 configuration for the STM32F469 Discovery evaluation platform.
 
-There are two setups supported:
-1. Internal flash memory is fully occupied with u-boot bootloader which boots kernel with
-   root filesystem from MMC.
-2. Internal flash memory stores simple afboot-stm32 bootloader, device tree and
-   in place (XIP) kernel with built-in initramfs.
-   Kernel is based on tinyconfig.
-
 Building
 --------
-  Type
-  "make stm32f469_disco_defconfig"
-  to build u-boot setup
-  or
-  "make stm32f469_disco_xip_defconfig"
-  to build xip setup
-
-  Then
 
-  "make"
+  make stm32f469_disco_defconfig
+  make
 
 Flashing
 --------
 
-  ./board/stmicroelectronics/stm32f469-disco/flash.sh output/ <BUILD_TYPE>
+  ./board/stmicroelectronics/stm32f469-disco/flash.sh output/
 
-  <BUILD_TYPE> can be "xip" or "uboot"
+It will flash the U-boot bootloader.
 
-Creating SD card for u-boot setup
+Creating SD card
 ----------------
 
-Buildroot prepares an "sdcard.img" image in the output/images/ directory,
+Buildroot prepares an"sdcard.img" image in the output/images/ directory,
 ready to be dumped on a SD card. Launch the following command as root:
 
   dd if=output/images/sdcard.img of=/dev/<your-sd-device>
diff --git a/board/stmicroelectronics/stm32f469-disco/readme_xip.txt b/board/stmicroelectronics/stm32f469-disco/readme_xip.txt
new file mode 100644
index 0000000000..c4c93cef6c
--- /dev/null
+++ b/board/stmicroelectronics/stm32f469-disco/readme_xip.txt
@@ -0,0 +1,22 @@
+STM32F469 Discovery
+===================
+
+This tutorial describes how to use the predefined Buildroot
+configuration for the STM32F469 Discovery evaluation platform.
+
+Internal flash memory stores simple afboot-stm32 bootloader, device tree and
+in place (XIP) kernel with built-in initramfs.
+Kernel is based on tinyconfig.
+
+Building
+--------
+
+  make stm32f469_disco_xip_defconfig
+  make
+
+Flashing
+--------
+
+  ./board/stmicroelectronics/stm32f469-disco/flash.sh output/
+
+It will flash binary to internal flash memory.
-- 
2.32.0



More information about the buildroot mailing list