Files
threadx/scripts/copy_armv8_m.sh
T
Armchina_JidongMeiandFrédéric Desbiens 090f8edc56 Added Cortex-M52 (Armv8.1-M) port (#519)
* ports: add Cortex-M52 (Armv8.1-M) port support

Add ThreadX port for Cortex-M52, supporting three toolchains:
- GNU (GCC)
- AC6 (Arm Compiler 6)
- IAR

Cortex-M52 is an Armv8.1-M Mainline processor sharing the same
architecture profile as Cortex-M55 and Cortex-M85. The port is
functionally identical to the existing Cortex-M85 port.

* ports: update cortex_m52 port copy script,using it update content

-Add cortex_m52 in threadx/scriprts/copy_armv8m.sh
-Using updated copy_armv8m.sh to generate new cortex_m52 port content

* Regenerated the Cortex-M52 port against dev and wired it into the checks

The port was generated from ports_arch/ARMv8-M as it stood on master, which has
since moved on. Rebasing onto dev and running scripts/copy_armv8_m.sh again
brings the twelve stale files into line, which is the point of generating them:
the core picks up every ARMv8-M fix made since without anyone porting it by hand.

Among what it picks up: "MOV r0, 0" becomes "MOV r0, #0" in the schedule and
system-return paths, the non-canonical immediate form that GNU as tolerates and
LLVM's assembler rejects; and gnu/src/tx_initialize_low_level.S goes away, since
the shared source no longer has it.

Two integration points exist only on dev, so the original change could not have
included them.

cmake/cortex_m52.cmake, so the port can be selected the documented way. Every
other Cortex-M core has one. It uses the hard float ABI, as Cortex-M55 and
Cortex-M85 do.

An entry in scripts/check_clang.sh, likewise with -mfloat-abi=hard. That flag is
not decoration: -mcpu=cortex-m52 implies Helium, and building it soft-float ends
in "multilib configuration error: No library available for MVE with soft-float
ABI" on every file, which reads as a broken port rather than a missing flag.

Verified after regenerating: scripts/copy_armv8_m.sh is a no-op, so the tree
matches its source; all 14 assembly sources and 188 C sources compile for
cortex-m52 with Arm Toolchain for Embedded 22.1.0.

Note for anyone building with GNU tools: arm-none-eabi-gcc 13.2.1 rejects
-mcpu=cortex-m52 outright. Support arrives in GCC 14.

---------

Co-authored-by: Frédéric Desbiens <frederic.desbiens@eclipse-foundation.org>
Assisted-by: Claude Code (Opus 5) <noreply@anthropic.com>
2026-08-16 08:29:46 -04:00

116 lines
3.3 KiB
Bash
Executable File

#!/bin/bash
##############################################################################
# Copyright (c) 2024 Microsoft Corporation
# Copyright (c) 2026 Eclipse ThreadX contributors
#
# This program and the accompanying materials are made available under the
# terms of the MIT License which is available at
# https://opensource.org/licenses/MIT.
#
# SPDX-License-Identifier: MIT
##############################################################################
# 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_m52 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