Skip to contentSkip to conversation

socfpga: Modify qts-filter args to allow input for bsp generated files and quartus project directories

PATCH Superseded Dalon Westergreen 2 participants 2 messages Jan 11, 2016

Subsystems (3)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 socfpga: Modify qts-filter args to allow input for bsp generated files and quartus project directories

The hps_isw_handoff and bsp/generated folders are typically not in the same path. This patch adds support for specifying the different input directories for the bsp and quartus projects.

---
 arch/arm/mach-socfpga/qts-filter.sh | 69 ++++++++++++++++++++-----------------
 1 file changed, 38 insertions(+), 31 deletions(-)
arch/arm/mach-socfpga/qts-filter.sh +38 -31
index c1640bc..835ca2c 100755
@@ -3,13 +3,15 @@
 #
 # Process iocsr_config_*.[ch]
 # $1:	SoC type
-# $2:	Input directory
-# $3:	Output directory
+# $2:	Input handoff directory
+# $3:	Input BSP Generated directory
+# $4:	Output directory
 #
 process_iocsr_config() {
 	soc="$1"
-	in_dir="$2"
-	out_dir="$3"
+	in_qts_dir="$2"
+	in_bsp_dir="$3"
+	out_dir="$4"
 
 	(
 	cat << EOF
@@ -26,13 +28,13 @@ EOF
 
 	# Retrieve the scan chain lengths
 	grep 'CONFIG_HPS_IOCSR_SCANCHAIN[0-9]\+_LENGTH'			\
-		${in_dir}/generated/iocsr_config_${soc}.h | tr -d "()"
+		${in_bsp_dir}/generated/iocsr_config_${soc}.h | tr -d "()"
 
 	echo ""
 
 	# Retrieve the scan chain config and zap the ad-hoc length encoding
 	sed -n '/^const/ !b; :next {/^const/ s/(.*)//;p;n;b next}'	\
-		${in_dir}/generated/iocsr_config_${soc}.c
+		${in_bsp_dir}/generated/iocsr_config_${soc}.c
 
 	cat << EOF
 
@@ -49,8 +51,9 @@ EOF
 #
 process_pinmux_config() {
 	soc="$1"
-	in_dir="$2"
-	out_dir="$3"
+	in_qts_dir="$2"
+	in_bsp_dir="$3"
+	out_dir="$4"
 
 	(
 	cat << EOF
@@ -67,7 +70,7 @@ EOF
 
 	# Retrieve the pinmux config and zap the ad-hoc length encoding
 	sed -n '/^unsigned/ !b; :next {/^unsigned/ {s/\[.*\]/[]/;s/unsigned long/const u8/};p;n;b next}' \
-		${in_dir}/generated/pinmux_config_${soc}.c
+		${in_bsp_dir}/generated/pinmux_config_${soc}.c
 
 	cat << EOF
 
@@ -84,8 +87,9 @@ EOF
 #
 process_pll_config() {
 	soc="$1"
-	in_dir="$2"
-	out_dir="$3"
+	in_qts_dir="$2"
+	in_bsp_dir="$3"
+	out_dir="$4"
 
 	(
 	cat << EOF
@@ -102,7 +106,7 @@ EOF
 
 	# Retrieve the pll config and zap parenthesis
 	sed -n '/CONFIG_HPS/ !b; :next {/CONFIG_HPS/ s/[()]//g;/endif/ b;p;n;b next}' \
-		${in_dir}/generated/pll_config.h
+		${in_bsp_dir}/generated/pll_config.h
 
 	cat << EOF
 
@@ -126,8 +130,9 @@ grep_sdram_config() {
 #
 process_sdram_config() {
 	soc="$1"
-	in_dir="$2"
-	out_dir="$3"
+	in_qts_dir="$2"
+	in_bsp_dir="$3"
+	out_dir="$4"
 
 	(
 	cat << EOF
@@ -144,29 +149,29 @@ EOF
 
 	echo "/* SDRAM configuration */"
 	# Retrieve the sdram config, zap broken lines and zap parenthesis
-	sed -n "/\\\\$/ {N;s/ \\\\\n/\t/};p" ${in_dir}/generated/sdram/sdram_config.h |
+	sed -n "/\\\\$/ {N;s/ \\\\\n/\t/};p" ${in_bsp_dir}/generated/sdram/sdram_config.h |
 	sed -n '/CONFIG_HPS/ !b; :next {/CONFIG_HPS/ s/[()]//g;/endif/ b;p;n;b next}' |
 		sort -u | grep_sdram_config
 
 	echo ""
 	echo "/* Sequencer auto configuration */"
 	sed -n "/__RW_MGR/ {s/__//;s/ \+\([^ ]\+\)$/\t\1/p}"		\
-		${in_dir}/hps_isw_handoff/*/sequencer_auto.h | sort -u | grep_sdram_config
+		${in_qts_dir}/hps_isw_handoff/*/sequencer_auto.h | sort -u | grep_sdram_config
 
 	echo ""
 	echo "/* Sequencer defines configuration */"
 	sed -n "/^#define [^_]/ {s/__//;s/ \+\([^ ]\+\)$/\t\1/p}"	\
-		${in_dir}/hps_isw_handoff/*/sequencer_defines.h | sort -u | grep_sdram_config
+		${in_qts_dir}/hps_isw_handoff/*/sequencer_defines.h | sort -u | grep_sdram_config
 
 	echo ""
 	echo "/* Sequencer ac_rom_init configuration */"
 	sed -n '/^const.*\[/ !b; :next {/^const.*\[/ {N;s/\n//;s/alt_u32/u32/;s/\[.*\]/[]/};/endif/ b;p;n;b next}'\
-		${in_dir}/hps_isw_handoff/*/sequencer_auto_ac_init.c
+		${in_qts_dir}/hps_isw_handoff/*/sequencer_auto_ac_init.c
 
 	echo ""
 	echo "/* Sequencer inst_rom_init configuration */"
 	sed -n '/^const.*\[/ !b; :next {/^const.*\[/ {N;s/\n//;s/alt_u32/u32/;s/\[.*\]/[]/};/endif/ b;p;n;b next}'\
-		${in_dir}/hps_isw_handoff/*/sequencer_auto_inst_init.c
+		${in_qts_dir}/hps_isw_handoff/*/sequencer_auto_inst_init.c
 
 	cat << EOF
 
@@ -176,30 +181,32 @@ EOF
 }
 
 usage() {
-	echo "$0 [soc_type] [input_dir] [output_dir]"
+	echo "$0 [soc_type] [input_qts_dir] [input_bsp_dir] [output_dir]"
 	echo "Process QTS-generated headers into U-Boot compatible ones."
 	echo ""
-	echo "  soc_type\t\tType of SoC, either 'cyclone5' or 'arria5',"
-	echo "  input_dir\t\tDirectory with the QTS project."
-	echo "  output_dir\t\tDirectory to store the U-Boot compatible headers."
+	echo "  soc_type - Type of SoC, either 'cyclone5' or 'arria5',"
+	echo "  input_hps_qts_dir - Directory with the compiled Quartus project."
+	echo "  input_bsp_dir - Directory with the generated output of the bsp-editor."
+	echo "  output_dir - Directory to store the U-Boot compatible headers."
 	echo ""
 }
 
 soc="$1"
-in_dir="$2"
-out_dir="$3"
+in_qts_dir="$2"
+in_bsp_dir="$3"
+out_dir="$4"
 
-if [ "$#" -ne 3 ] ; then
+if [ "$#" -ne 4 ] ; then
 	usage
 	exit 1
 fi
 
-if [ ! -d "${in_dir}" -o ! -d "${out_dir}" -o -z "${soc}" ] ; then
+if [ ! -d "${in_qts_dir}" -o ! -d "${in_bsp_dir}" -o ! -d "${out_dir}" -o -z "${soc}" ] ; then
 	usage
 	exit 3
 fi
 
-process_iocsr_config  "${soc}" "${in_dir}" "${out_dir}"
-process_pinmux_config "${soc}" "${in_dir}" "${out_dir}"
-process_pll_config    "${soc}" "${in_dir}" "${out_dir}"
-process_sdram_config  "${soc}" "${in_dir}" "${out_dir}"
+process_iocsr_config  "${soc}" "${in_qts_dir}" "${in_bsp_dir}" "${out_dir}"
+process_pinmux_config "${soc}" "${in_qts_dir}" "${in_bsp_dir}" "${out_dir}"
+process_pll_config    "${soc}" "${in_qts_dir}" "${in_bsp_dir}" "${out_dir}"
+process_sdram_config  "${soc}" "${in_qts_dir}" "${in_bsp_dir}" "${out_dir}"
Signature · 1 line
2.5.0
#1 lore raw

PATCH 1/1 socfpga: Modify qts-filter args to allow input for bsp generated files and quartus project directories

Quoted 3 lines · Dalon Westergreen

The hps_isw_handoff and bsp/generated folders are typically not in the same path. This patch adds support for specifying the different input directories for the bsp and quartus projects.

Next time, please align to 80 chars .

Also the patch should be marked as patch V2, see the rules:
http://www.denx.de/wiki/U-Boot/Patches

But I can fix this. Let's give Dinh/Chin time to catch up and then I'll pick it if they're fine with it.

Quoted 116 lines
---
 arch/arm/mach-socfpga/qts-filter.sh | 69

++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 31 deletions(-)

(quoted diff) +0 -0

b/arch/arm/mach-socfpga/qts-filter.sh index c1640bc..835ca2c 100755

arch/arm/mach-socfpga/qts-filter.sh +15 -11
@@ -3,13 +3,15 @@
 #
 # Process iocsr_config_*.[ch]
 # $1:	SoC type
-# $2:	Input directory
-# $3:	Output directory
+# $2:	Input handoff directory
+# $3:	Input BSP Generated directory
+# $4:	Output directory
 #
 process_iocsr_config() {
 	soc="$1"
-	in_dir="$2"
-	out_dir="$3"
+	in_qts_dir="$2"
+	in_bsp_dir="$3"
+	out_dir="$4"
 
 	(
 	cat << EOF
@@ -26,13 +28,13 @@ EOF
 
 	# Retrieve the scan chain lengths
 	grep 'CONFIG_HPS_IOCSR_SCANCHAIN[0-9]\+_LENGTH'			\
-		${in_dir}/generated/iocsr_config_${soc}.h | tr -d "()"
+		${in_bsp_dir}/generated/iocsr_config_${soc}.h | tr -d "()"
 
 	echo ""
 
 	# Retrieve the scan chain config and zap the ad-hoc length encoding
 	sed -n '/^const/ !b; :next {/^const/ s/(.*)//;p;n;b next}'	\
-		${in_dir}/generated/iocsr_config_${soc}.c
+		${in_bsp_dir}/generated/iocsr_config_${soc}.c
 
 	cat << EOF
 
@@ -49,8 +51,9 @@ EOF
 #
 process_pinmux_config() {
 	soc="$1"
-	in_dir="$2"
-	out_dir="$3"
+	in_qts_dir="$2"
+	in_bsp_dir="$3"
+	out_dir="$4"
 
 	(
 	cat << EOF
@@ -67,7 +70,7 @@ EOF
 
 	# Retrieve the pinmux config and zap the ad-hoc length encoding
 	sed -n '/^unsigned/ !b; :next {/^unsigned/ {s/\[.*\]/[]/;s/unsigned
 long/const u8/};p;n;b next}' \
-		${in_dir}/generated/pinmux_config_${soc}.c
+		${in_bsp_dir}/generated/pinmux_config_${soc}.c
 
 	cat << EOF
@@ -84,8 +87,9 @@ EOF
 #
 process_pll_config() {
 	soc="$1"
-	in_dir="$2"
-	out_dir="$3"
+	in_qts_dir="$2"
+	in_bsp_dir="$3"
+	out_dir="$4"
 
 	(
 	cat << EOF
@@ -102,7 +106,7 @@ EOF
 
 	# Retrieve the pll config and zap parenthesis
 	sed -n '/CONFIG_HPS/ !b; :next {/CONFIG_HPS/ s/[()]//g;/endif/ b;p;n;b

next}' \ - ${in_dir}/generated/pll_config.h

arch/arm/mach-socfpga/qts-filter.sh +4 -3
+		${in_bsp_dir}/generated/pll_config.h
 
 	cat << EOF
@@ -126,8 +130,9 @@ grep_sdram_config() {
 #
 process_sdram_config() {
 	soc="$1"
-	in_dir="$2"
-	out_dir="$3"
+	in_qts_dir="$2"
+	in_bsp_dir="$3"
+	out_dir="$4"
 
 	(
 	cat << EOF
@@ -144,29 +149,29 @@ EOF
 
 	echo "/* SDRAM configuration */"
 	# Retrieve the sdram config, zap broken lines and zap parenthesis
-	sed -n "/\\\\$/ {N;s/ \\\\\n/\t/};p"

${in_dir}/generated/sdram/sdram_config.h | + sed -n "/\\\\$/ {N;s/
\\\\\n/\t/};p" ${in_bsp_dir}/generated/sdram/sdram_config.h | sed -n '/CONFIG_HPS/ !b; :next {/CONFIG_HPS/ s/[()]//g;/endif/ b;p;n;b next}' | sort -u | grep_sdram_config

arch/arm/mach-socfpga/qts-filter.sh +0 -1
 	echo ""
 	echo "/* Sequencer auto configuration */"
 	sed -n "/__RW_MGR/ {s/__//;s/ \+\([^ ]\+\)$/\t\1/p}"		\
-		${in_dir}/hps_isw_handoff/*/sequencer_auto.h | sort -u |
Quoted 1 line

grep_sdram_config + ${in_qts_dir}/hps_isw_handoff/*/sequencer_auto.h

|

Quoted 7 lines

sort -u | grep_sdram_config

arch/arm/mach-socfpga/qts-filter.sh +0 -1
 	echo ""
 	echo "/* Sequencer defines configuration */"
 	sed -n "/^#define [^_]/ {s/__//;s/ \+\([^ ]\+\)$/\t\1/p}"	\
-		${in_dir}/hps_isw_handoff/*/sequencer_defines.h | sort -u |

grep_sdram_config +

${in_qts_dir}/hps_isw_handoff/*/sequencer_defines.h |

Quoted 21 lines

sort -u | grep_sdram_config

arch/arm/mach-socfpga/qts-filter.sh +0 -0
 	echo ""
 	echo "/* Sequencer ac_rom_init configuration */"
 	sed -n '/^const.*\[/ !b; :next {/^const.*\[/

{N;s/\n//;s/alt_u32/u32/;s/\[.*\]/[]/};/endif/ b;p;n;b next}'\

arch/arm/mach-socfpga/qts-filter.sh +1 -1
-		${in_dir}/hps_isw_handoff/*/sequencer_auto_ac_init.c
+		${in_qts_dir}/hps_isw_handoff/*/sequencer_auto_ac_init.c
 
 	echo ""
 	echo "/* Sequencer inst_rom_init configuration */"
 	sed -n '/^const.*\[/ !b; :next {/^const.*\[/

{N;s/\n//;s/alt_u32/u32/;s/\[.*\]/[]/};/endif/ b;p;n;b next}'\

arch/arm/mach-socfpga/qts-filter.sh +1 -1
-		${in_dir}/hps_isw_handoff/*/sequencer_auto_inst_init.c
+		${in_qts_dir}/hps_isw_handoff/*/sequencer_auto_inst_init.c
 
 	cat << EOF
@@ -176,30 +181,32 @@ EOF
 }
 

arch/arm/mach-socfpga/qts-filter.sh EOF · line 188

Quoted 10 lines
arch/arm/mach-socfpga/qts-filter.sh +3 -4
 usage() {
-	echo "$0 [soc_type] [input_dir] [output_dir]"
+	echo "$0 [soc_type] [input_qts_dir] [input_bsp_dir] [output_dir]"
 	echo "Process QTS-generated headers into U-Boot compatible ones."
 	echo ""
-	echo "  soc_type\t\tType of SoC, either 'cyclone5' or 'arria5',"
-	echo "  input_dir\t\tDirectory with the QTS project."
-	echo "  output_dir\t\tDirectory to store the U-Boot compatible headers."
+	echo "  soc_type - Type of SoC, either 'cyclone5' or 'arria5',"
+	echo "  input_hps_qts_dir - Directory with the compiled Quartus 

project."

Quoted 33 lines
arch/arm/mach-socfpga/qts-filter.sh +1 -0
+	echo "  input_bsp_dir - Directory with the generated output of the

bsp-editor." + echo " output_dir - Directory to store the U-Boot
compatible headers." echo ""
}

soc="$1"

arch/arm/mach-socfpga/qts-filter.sh +6 -9
-in_dir="$2"
-out_dir="$3"
+in_qts_dir="$2"
+in_bsp_dir="$3"
+out_dir="$4"
 
-if [ "$#" -ne 3 ] ; then
+if [ "$#" -ne 4 ] ; then
 	usage
 	exit 1
 fi
 
-if [ ! -d "${in_dir}" -o ! -d "${out_dir}" -o -z "${soc}" ] ; then
+if [ ! -d "${in_qts_dir}" -o ! -d "${in_bsp_dir}" -o ! -d "${out_dir}" -o
-z "${soc}" ] ; then usage
 	exit 3
 fi
 
-process_iocsr_config  "${soc}" "${in_dir}" "${out_dir}"
-process_pinmux_config "${soc}" "${in_dir}" "${out_dir}"
-process_pll_config    "${soc}" "${in_dir}" "${out_dir}"
-process_sdram_config  "${soc}" "${in_dir}" "${out_dir}"
+process_iocsr_config  "${soc}" "${in_qts_dir}" "${in_bsp_dir}"

"${out_dir}" +process_pinmux_config "${soc}" "${in_qts_dir}"
"${in_bsp_dir}" "${out_dir}" +process_pll_config "${soc}"
"${in_qts_dir}" "${in_bsp_dir}" "${out_dir}" +process_sdram_config "${soc}" "${in_qts_dir}" "${in_bsp_dir}" "${out_dir}"