summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorTiejunZhou <[email protected]>2023-04-18 18:11:20 +0800
committerGitHub <[email protected]>2023-04-18 18:11:20 +0800
commit23680f5e5f01702f7327160b8766bc893a5e6c54 (patch)
tree0cee1ec2d7e298bcfad386a76fde8870e58a72fb /scripts
parentd64ef2ab064047ab5aed15c7861e5a44ab8022e3 (diff)
Release ARMv7-M and ARMv8-M architecture ports (#249)
* Release ARMv7-M and ARMv8-M architecture ports * Add a pipeline to check ports_arch
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/copy_armv7_m.sh80
-rwxr-xr-xscripts/copy_armv8_m.sh104
-rwxr-xr-xscripts/copy_module_armv7_m.sh64
3 files changed, 248 insertions, 0 deletions
diff --git a/scripts/copy_armv7_m.sh b/scripts/copy_armv7_m.sh
new file mode 100755
index 00000000..825979a2
--- /dev/null
+++ b/scripts/copy_armv7_m.sh
@@ -0,0 +1,80 @@
+#!/bin/bash
+
+# There is only one tx_port.h file that covers three architectures: M3/M4/M7 and four tools: ac5/ac6/gnu/iar.
+# This file is in threadx/ports/armv7-m/inc. We are going to ignore GHS for now, but I’d like to get GHS unified as well.
+
+set -e
+
+ports_folder="ports"
+source_folder="ports_arch/ARMv7-M/threadx"
+target_mcu="cortex_m3 cortex_m4 cortex_m7"
+source_inc_folder="$source_folder/inc"
+target_inc_mcu=$target_mcu
+target_inc_ide="ac5 ac6 gnu iar keil"
+target_inc_folder="inc"
+source_src_ide="ac5 ac6 gnu iar"
+target_src_mcu=$target_mcu
+src_folder="src"
+readme="readme_threadx.txt"
+source_string="Cortex-Mx"
+target_string_pre="Cortex-M"
+
+cd $(dirname `realpath $0`)/..
+
+# Copy port files
+for mcu in $target_mcu;
+do
+ for ide in $target_inc_ide;
+ do
+ # Copy files
+ target=$ports_folder/$mcu/$ide/$target_inc_folder
+ [ -d "$target" ] || continue
+ echo "$source_inc_folder -> $target"
+ rm -rf $target
+ cp -rf $source_inc_folder $target
+
+ # String replacement
+ mcu_string="$target_string_pre${mcu: -1}"
+ if [ "$ide" == "keil" ];
+ then
+ ide_string="Keil"
+ mcu_ide_string="$mcu_string\/$ide_string"
+ else
+ ide_string="${ide^^}"
+ mcu_ide_string="$mcu_string\/$ide_string "
+ fi
+ sed -i "s/ $source_string /$mcu_ide_string/g" $target/*
+ sed -i "s/ThreadX $source_string /ThreadX $mcu_string\/$ide_string /g" $target/*
+ sed -i "s/$source_string/$mcu_string/g" $target/*
+ done
+done
+echo ""
+
+# Copy source files
+for ide in $source_src_ide;
+do
+ for mcu in $target_src_mcu;
+ do
+ # Copy source files
+ src=$source_folder/$ide/$src_folder
+ target=$ports_folder/$mcu/$ide/$src_folder
+ #[ -d "$target" ] || continue
+ echo "$src -> $target"
+ rm -rf $target
+ cp -rf $src $target
+
+ # String replacement
+ sed -i "s/$source_string/$target_string_pre${mcu: -1}/g" $target/*
+
+ # Copy readme files
+ src=$source_folder/$ide/$readme
+ target=$ports_folder/$mcu/$ide/$readme
+ #[ -f "$target" ] || continue
+ echo "$src -> $target"
+ rm -f $target
+ cp -f $src $target
+
+ # String replacement
+ sed -i "s/$source_string/$target_string_pre${mcu: -1}/g" $target
+ done
+done \ No newline at end of file
diff --git a/scripts/copy_armv8_m.sh b/scripts/copy_armv8_m.sh
new file mode 100755
index 00000000..0963ecbe
--- /dev/null
+++ b/scripts/copy_armv8_m.sh
@@ -0,0 +1,104 @@
+#!/bin/bash
+
+# There are two files tx_port.h and tx_secure_interface.h that cover three architectures: M33/M55/M85 and three tools: ac6/gnu/iar.
+# These files are in threadx/ports/armv8-m/inc.
+
+set -e
+
+ports_folder="ports"
+source_folder="ports_arch/ARMv8-M/threadx"
+target_mcu="cortex_m33 cortex_m55 cortex_m85"
+source_inc_folder="$source_folder/inc"
+target_inc_mcu=$target_mcu
+target_inc_ide="ac6 gnu iar"
+target_inc_folder="inc"
+source_src_ide="ac6 gnu iar"
+target_src_mcu=$target_mcu
+src_folder="src"
+readme="readme_threadx.txt"
+cmake="CMakeLists.txt"
+source_string="Cortex-Mxx"
+target_string_pre="Cortex-M"
+
+cd $(dirname `realpath $0`)/..
+
+# Copy port files
+for mcu in $target_mcu;
+do
+ for ide in $target_inc_ide;
+ do
+ # Copy files
+ target=$ports_folder/$mcu/$ide/$target_inc_folder
+ [ -d "$target" ] || mkdir -p $target
+ echo "$source_inc_folder -> $target"
+ rm -rf $target
+ cp -rf $source_inc_folder $target
+
+ # String replacement
+ mcu_string="$target_string_pre${mcu: -2}"
+ if [ "$ide" == "keil" ];
+ then
+ ide_string="Keil"
+ mcu_ide_string="$mcu_string\/$ide_string"
+ else
+ ide_string="${ide^^}"
+ mcu_ide_string="$mcu_string\/$ide_string "
+ fi
+ sed -i "s/ $source_string /$mcu_ide_string/g" $target/*
+ sed -i "s/ThreadX $source_string /ThreadX $mcu_string\/$ide_string /g" $target/*
+ sed -i "s/$source_string/$mcu_string/g" $target/*
+ done
+done
+echo ""
+
+# Copy source files
+for ide in $source_src_ide;
+do
+ for mcu in $target_src_mcu;
+ do
+ # Copy source files
+ src=$source_folder/$ide/$src_folder
+ target=$ports_folder/$mcu/$ide/$src_folder
+ #[ -d "$target" ] || continue
+ echo "$src -> $target"
+ rm -rf $target
+ cp -rf $src $target
+
+ # String replacement
+ sed -i "s/$source_string/$target_string_pre${mcu: -2}/g" $target/*
+
+ # Copy readme files
+ src=$source_folder/$ide/$readme
+ target=$ports_folder/$mcu/$ide/$readme
+ #[ -f "$target" ] || continue
+ echo "$src -> $target"
+ rm -f $target
+ cp -f $src $target
+
+ # String replacement
+ sed -i "s/$source_string/$target_string_pre${mcu: -2}/g" $target
+ done
+done
+
+# Copy CMakeLists files
+for ide in $source_src_ide;
+do
+ for mcu in $target_src_mcu;
+ do
+ # Copy CMakeList files ac6
+ src=$source_folder/ac6/$cmake
+ target=$ports_folder/$mcu/ac6/$cmake
+ #[ -f "$target" ] || continue
+ echo "$src -> $target"
+ rm -f $target
+ cp -f $src $target
+
+ # Copy CMakeList files gnu
+ src=$source_folder/gnu/$cmake
+ target=$ports_folder/$mcu/gnu/$cmake
+ #[ -f "$target" ] || continue
+ echo "$src -> $target"
+ rm -f $target
+ cp -f $src $target
+ done
+done \ No newline at end of file
diff --git a/scripts/copy_module_armv7_m.sh b/scripts/copy_module_armv7_m.sh
new file mode 100755
index 00000000..8dbd834c
--- /dev/null
+++ b/scripts/copy_module_armv7_m.sh
@@ -0,0 +1,64 @@
+#!/bin/bash
+
+# There is only one tx_port.h file that covers three architectures: M3/M4/M7 and four tools: ac5/ac6/gnu/iar.
+# This file is in threadx/ports_module/armv7-m/inc. We are going to ignore GHS.
+
+set -e
+
+ports_folder="ports_arch/ARMv7-M/threadx"
+ports_file_list="tx_thread_context_restore tx_thread_context_save tx_thread_interrupt_control tx_thread_interrupt_disable tx_thread_interrupt_restore tx_thread_stack_build tx_thread_system_return tx_timer_interrupt"
+ports_module_folder="ports_module"
+source_folder="ports_arch/ARMv7-M/threadx_modules"
+target_mcu="cortex_m3 cortex_m4 cortex_m7"
+source_inc_folder="$source_folder/inc"
+target_inc_folder="inc"
+target_ide="ac5 ac6 gnu iar"
+source_common_folder="common/module_manager/src"
+target_common_folder="module_manager"
+source_string="Cortex-Mx"
+target_string_pre="Cortex-M"
+
+
+cd $(dirname `realpath $0`)/..
+
+# Copy IDE specific files
+for mcu in $target_mcu;
+do
+ for ide in $target_ide;
+ do
+ for d in $(ls $source_folder/$ide);
+ do
+ # Copy specific files
+ source=$source_folder/$ide/$d
+ target=$ports_module_folder/$mcu/$ide/$d
+ echo "$source -> $target"
+ rm -rf $target
+ cp -rf $source $target
+
+ # String replacement
+ find $target -type f -exec sed -i "s/$source_string/$target_string_pre${mcu: -1}/g" {} \;
+ done
+
+ # copy common inc directory containing unified tx_port.h
+ target=$ports_module_folder/$mcu/$ide/$target_inc_folder
+ echo "$source_inc_folder -> $target"
+ cp -rf $source_inc_folder/* $target
+ find $target -type f -exec sed -i "s/$source_string/$target_string_pre${mcu: -1}/g" {} \;
+
+ # Copy common files
+ source=$source_folder/$source_common_folder;
+ target=$ports_module_folder/$mcu/$ide/$target_common_folder
+ echo "$source -> $target"
+ cp -rf $source $target
+
+ source=$ports_folder/$ide/src;
+ echo "$source -> $target"
+ for f in $ports_file_list;
+ do
+ cp $source/$f.* $target/src
+ done
+
+ # String replacement
+ find $target -type f -exec sed -i "s/$source_string/$target_string_pre${mcu: -1}/g" {} \;
+ done
+done \ No newline at end of file