Skip to content

Commit 46b0b31

Browse files
committed
2 parents 1d40ed3 + f5be507 commit 46b0b31

2,820 files changed

Lines changed: 5211765 additions & 5211118 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[*.sh]
2+
# like -i=2
3+
indent_style = space
4+
indent_size = 2
5+
6+
#shell_variant = posix # like -ln=posix
7+
#binary_next_line = true # like -bn
8+
switch_case_indent = true # like -ci
9+
space_redirects = true # like -sr
10+
#keep_padding = true # like -kp

.gitattributes

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Set the default behavior, in case people don't have core.autocrlf set.
2+
* text=auto
3+
4+
# Explicitly declare text files you want to always be normalized and converted
5+
# to native line endings on checkout.
6+
*.c text
7+
*.cpp text
8+
*.h text
9+
*.s text
10+
*.S text
11+
*.ld text
12+
*.txt text
13+
*.xml text
14+
*.py text
15+
*.md text
16+
*.json text
17+
18+
# Denote all files that are truly binary and should not be modified.
19+
*.png binary
20+
*.jpg binary

CI/build/arduino-cli.py

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@
8080
skip_count = 0
8181

8282
# format
83-
build_format = "| {:8} | {:44} | {:9} "
83+
build_format_header = "| {:^8} | {:42} | {:^10} | {:^7} |"
84+
build_format_result = "| {:^8} | {:42} | {:^19} | {:^6.2f}s |"
8485
build_separator = "-" * 80
8586

8687

@@ -495,31 +496,37 @@ def check_status(status, build_conf, boardKo):
495496
elif status[1] == 1:
496497
# Check if failed due to a region overflowed
497498
logFile = os.path.join(build_conf[3], sketch_name + ".log")
499+
error_pattern = re.compile(":\\d+:\\d+:\\serror:\\s")
498500
ld_pattern = re.compile("arm-none-eabi/bin/ld:")
499501
overflow_pattern = re.compile(
500502
"will not fit in region|region .+ overflowed by [\\d]+ bytes"
501503
)
504+
error_found = False
502505
for i, line in enumerate(open(logFile)):
503-
if ld_pattern.search(line):
506+
if error_pattern.search(line):
507+
error_found = True
508+
elif ld_pattern.search(line):
504509
# If one ld line is not for region overflowed --> failed
505510
if overflow_pattern.search(line) is None:
506-
result = "\033[31mfailed\033[0m "
507-
boardKo.append(build_conf[0])
508-
if args.ci:
509-
cat(logFile)
510-
nb_build_failed += 1
511-
break
511+
error_found = True
512+
if error_found:
513+
result = "\033[31mfailed\033[0m"
514+
boardKo.append(build_conf[0])
515+
if args.ci:
516+
cat(logFile)
517+
nb_build_failed += 1
518+
break
512519
else:
513520
# else consider it succeeded
514-
result = "\033[32msucceeded\033[0m"
521+
result = "\033[32msucceeded*\033[0m"
515522
if args.bin:
516523
empty_bin(build_conf[0], sketch_name)
517524
nb_build_passed += 1
518525
else:
519-
result = "\033[31merror\033[0m "
526+
result = "\033[31merror\033[0m"
520527

521528
print(
522-
(build_format + "| {:5.2f}s |").format(
529+
(build_format_result).format(
523530
"{}/{}".format(build_conf[1], build_conf[2]),
524531
build_conf[0],
525532
result,
@@ -730,12 +737,12 @@ def build_config(sketch, boardSkipped):
730737
for pattern in na_sketch_pattern[build_conf_list[idx][0]]:
731738
if re.search(pattern, sketch, re.IGNORECASE):
732739
print(
733-
(build_format + "| {:5.2f}s |").format(
740+
(build_format_result).format(
734741
"{}/{}".format(
735742
build_conf_list[idx][1], build_conf_list[idx][2]
736743
),
737744
build_conf_list[idx][0],
738-
"\033[33mskipped\033[0m ",
745+
"\033[33mskipped\033[0m",
739746
0.00,
740747
)
741748
)
@@ -782,7 +789,7 @@ def build_all():
782789
for line in wrapped_path_:
783790
print("| {:^76} |".format("{}".format(line)))
784791
print(build_separator)
785-
print((build_format + "| {:6} |").format("Num", "Board", "Result", "Time"))
792+
print((build_format_header).format("Num", "Board", "Result", "Time"))
786793
print(build_separator)
787794

788795
build_conf_list = build_config(sketch, boardSkipped)

CI/utils/gen_wrapper.sh

Lines changed: 77 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash -
2-
set -o nounset # Treat unset variables as an error
2+
set -o nounset # Treat unset variables as an error
33

44
# Base path
55
Core_path=../..
@@ -23,40 +23,41 @@ LLoutInc_path=$Core_path/cores/arduino/stm32/LL
2323
CMSIS_Startupfile=$Core_path/cores/arduino/stm32/stm32_def_build.h
2424

2525
# Variables
26-
series=(`ls -d $HALDrivers_path/STM32*/ | sed -e "s#$HALDrivers_path/STM32##g" | sed -e "s#xx_HAL_Driver/##g"`)
26+
series=($(find $HALDrivers_path -maxdepth 1 -type d -name "STM32*" | sed -e "s#$HALDrivers_path/STM32##g" -e "s#xx_HAL_Driver##g" | sort))
27+
2728
all_LL_file=stm32yyxx_ll.h
2829

2930
# Create the file
3031
print_C_header() {
31-
if [[ $1 = *"template"* ]]; then
32-
echo "#if 0" > $1
33-
else
34-
touch $1
35-
fi
32+
if [[ $1 = *"template"* ]]; then
33+
echo "#if 0" > "$1"
34+
else
35+
touch "$1"
36+
fi
3637
}
3738

3839
# Add some pragma to ll header files to avoid several warnings
3940
# which will be corrected along Cube update
4041
print_LL_header() {
41-
upper=`echo $1 | awk '{print toupper($1)}' | sed -e "s/\./_/g"`
42-
echo "#ifndef _${upper}_
42+
upper=$(echo "$1" | awk '{print toupper($1)}' | sed -e "s/\./_/g")
43+
echo "#ifndef _${upper}_
4344
#define _${upper}_
4445
/* LL raised several warnings, ignore them */
4546
#pragma GCC diagnostic push
4647
#pragma GCC diagnostic ignored \"-Wunused-parameter\"
4748
#pragma GCC diagnostic ignored \"-Wstrict-aliasing\"
48-
" > $LLoutInc_path/$1
49+
" > $LLoutInc_path/"$1"
4950
}
5051

5152
print_CMSIS_Startup_header() {
52-
echo "#ifndef _STM32_DEF_BUILD_
53+
echo "#ifndef _STM32_DEF_BUILD_
5354
#define _STM32_DEF_BUILD_
5455
5556
#if !defined(CMSIS_STARTUP_FILE) && !defined(CUSTOM_STARTUP_FILE)" > $CMSIS_Startupfile
5657
}
5758

5859
print_CMSIS_Startup_footer() {
59-
echo "#else
60+
echo "#else
6061
#error UNKNOWN CHIP
6162
#endif
6263
#else
@@ -66,29 +67,31 @@ echo "#else
6667
}
6768

6869
print_CMSIS_Startup_list() {
69-
# Handle first elements
70-
# File name
71-
local f=`echo ${list[0]} | awk -F/ '{print $NF}'`
72-
local upper=`echo $f | awk -F'[_.]' '{print toupper($2)}' | tr X x`
73-
echo "#if defined($upper)
70+
# Handle first elements
71+
# File name
72+
local f
73+
local upper
74+
f=$(echo "${list[0]}" | awk -F/ '{print $NF}')
75+
upper=$(echo "$f" | awk -F'[_.]' '{print toupper($2)}' | tr X x)
76+
echo "#if defined($upper)
7477
#define CMSIS_STARTUP_FILE \"$f\"" >> $CMSIS_Startupfile
7578

76-
if [ ${#list[@]} -gt 1 ]; then
77-
for fp in ${list[@]:1}
78-
do
79-
# File name
80-
f=`echo $fp | awk -F/ '{print $NF}'`
81-
upper=`echo $f | awk -F'[_.]' '{print toupper($2)}' | tr X x`
82-
echo "#elif defined($upper)
79+
if [ ${#list[@]} -gt 1 ]; then
80+
for fp in "${list[@]:1}"; do
81+
# File name
82+
f=$(echo "$fp" | awk -F/ '{print $NF}')
83+
upper=$(echo "$f" | awk -F'[_.]' '{print toupper($2)}' | tr X x)
84+
upper="${upper//MP15xx/MP1xx}"
85+
echo "#elif defined($upper)
8386
#define CMSIS_STARTUP_FILE \"$f\"" >> $CMSIS_Startupfile
84-
done
85-
fi
87+
done
88+
fi
8689
}
8790

8891
# main
8992
# Check if this is the right place
9093
if [ ! -d $HALDrivers_path ]; then
91-
echo "Could not find $HAL_outSrcpath!"
94+
echo "Could not find $HALDrivers_path!"
9295
echo "Launch $0 from scripts folder!"
9396
exit 1
9497
fi
@@ -97,51 +100,52 @@ fi
97100
rm -f $HALoutSrc_path/* $LLoutSrc_path/* $LLoutInc_path/* $CMSIS_Startupfile
98101

99102
# Search all files for each series
100-
for serie in ${series[@]}
101-
do
102-
if [ -d $HALDrivers_path/STM32${serie}xx_HAL_Driver/Src ]; then
103-
lower=`echo $serie | awk '{print tolower($0)}'`
103+
for serie in "${series[@]}"; do
104+
if [ -d $HALDrivers_path/STM32"${serie}"xx_HAL_Driver/Src ]; then
105+
lower=$(echo "$serie" | awk '{print tolower($0)}')
104106
echo -n "Generating for $serie..."
105107

106108
# Generate stm32yyxx_[hal|ll]*.c file
107-
filelist=(`find $HALDrivers_path/STM32${serie}xx_HAL_Driver/Src -maxdepth 1 -name "stm32${lower}xx_*.c"`)
108-
for fp in ${filelist[@]}
109-
do
109+
filelist=($(find $HALDrivers_path/STM32"${serie}"xx_HAL_Driver/Src -maxdepth 1 -name "stm32${lower}xx_*.c"))
110+
for fp in "${filelist[@]}"; do
110111
outp=$HALoutSrc_path
111112
# File name
112-
f=`echo $fp | awk -F/ '{print $NF}'`
113+
f=$(echo "$fp" | awk -F/ '{print $NF}')
113114
# Compute generic file name
114-
g=`echo $f | sed -e "s/$lower/yy/g"`
115-
if [[ $f = *"_ll_"* ]]; then
115+
g="${f//$lower/yy}"
116+
if [[ $f = *"_ll_"* ]]; then
116117
outp=$LLoutSrc_path
117118
fi
118-
if [ ! -f $outp/$g ]; then
119-
print_C_header $outp/$g
119+
if [ ! -f $outp/"$g" ]; then
120+
print_C_header $outp/"$g"
120121
fi
121122
# Amend file name under serie switch
122-
echo "#ifdef STM32${serie}xx" >> $outp/$g
123-
echo "#include \"$f\"" >> $outp/$g
124-
echo "#endif" >> $outp/$g
123+
{
124+
echo "#ifdef STM32${serie}xx"
125+
echo "#include \"$f\""
126+
echo "#endif"
127+
} >> $outp/"$g"
125128
done
126129

127130
# Generate stm32yyxx_ll_*.h file
128-
filelist=(`find $HALDrivers_path/STM32${serie}xx_HAL_Driver/Inc -maxdepth 2 -name "stm32${lower}xx_ll_*.h"`)
129-
for fp in ${filelist[@]}
130-
do
131+
filelist=($(find $HALDrivers_path/STM32"${serie}"xx_HAL_Driver/Inc -maxdepth 2 -name "stm32${lower}xx_ll_*.h"))
132+
for fp in "${filelist[@]}"; do
131133
# File name
132-
f=`echo $fp | awk -F/ '{print $NF}'`
134+
f=$(echo "$fp" | awk -F/ '{print $NF}')
133135
# Compute generic file name
134-
g=`echo $f | sed -e "s/$lower/yy/g"`
136+
g="${f//$lower/yy}"
135137

136-
if [ ! -f $LLoutInc_path/$g ]; then
137-
print_LL_header $g
138+
if [ ! -f $LLoutInc_path/"$g" ]; then
139+
print_LL_header "$g"
138140
fi
139141
# Amend full LL header file
140142
echo "#include \"$g\"" >> $LLoutInc_path/${all_LL_file}.tmp
141143
# Amend file name under serie switch
142-
echo "#ifdef STM32${serie}xx" >> $LLoutInc_path/$g
143-
echo "#include \"$f\"" >> $LLoutInc_path/$g
144-
echo "#endif" >> $LLoutInc_path/$g
144+
{
145+
echo "#ifdef STM32${serie}xx"
146+
echo "#include \"$f\""
147+
echo "#endif"
148+
} >> $LLoutInc_path/"$g"
145149
done
146150
echo "done"
147151
fi
@@ -156,30 +160,28 @@ sort -u $LLoutInc_path/${all_LL_file}.tmp >> $LLoutInc_path/${all_LL_file}
156160
rm -f $LLoutInc_path/${all_LL_file}.tmp
157161

158162
# Search all template file to end "#if 0"
159-
filelist=(`find $HALoutSrc_path -maxdepth 1 -name "stm32*_template.c"`)
160-
for fp in ${filelist[@]}
161-
do
162-
echo "#endif /* 0 */" >> $fp
163+
filelist=($(find $HALoutSrc_path -maxdepth 1 -name "stm32*_template.c"))
164+
for fp in "${filelist[@]}"; do
165+
echo "#endif /* 0 */" >> "$fp"
163166
done
164167

165168
# Search all LL header files to end guard
166-
filelist=(`find $LLoutInc_path -maxdepth 1 -name "stm32yyxx_ll*.h"`)
167-
for fp in ${filelist[@]}
168-
do
169-
upper=`basename $fp | awk '{print toupper($1)}' | sed -e "s/\./_/g"`
170-
echo "#pragma GCC diagnostic pop" >> $fp
171-
echo "#endif /* _${upper}_ */" >> $fp
169+
filelist=($(find $LLoutInc_path -maxdepth 1 -name "stm32yyxx_ll*.h"))
170+
for fp in "${filelist[@]}"; do
171+
upper=$(basename "$fp" | awk '{print toupper($1)}' | sed -e "s/\./_/g")
172+
echo "#pragma GCC diagnostic pop" >> "$fp"
173+
echo "#endif /* _${upper}_ */" >> "$fp"
172174
done
173175

174176
# CMSIS startup files
175-
list=(`find $CMSIS_Device_ST_path -name "startup_*.s" | grep gcc | sort -u`)
177+
list=($(find $CMSIS_Device_ST_path -name "startup_*.s" | grep gcc | sort -du))
176178
if [ ${#list[@]} -ne 0 ]; then
177-
echo "Number of startup files: ${#list[@]}"
178-
print_CMSIS_Startup_header
179-
print_CMSIS_Startup_list
180-
print_CMSIS_Startup_footer
179+
echo "Number of startup files: ${#list[@]}"
180+
print_CMSIS_Startup_header
181+
print_CMSIS_Startup_list
182+
print_CMSIS_Startup_footer
181183
else
182-
echo "No startup files found!"
184+
echo "No startup files found!"
183185
fi
184186

185187
# CMSIS DSP C source files
@@ -189,16 +191,15 @@ if [ ! -d $CMSIS_DSPSrc_path ]; then
189191
echo "Skip CMSIS DSP generation."
190192
else
191193
# Remove old file
192-
rm -fr $CMSIS_DSP_outSrc_path/*/
194+
rm -fr "${CMSIS_DSP_outSrc_path:?}"/*/
193195

194-
filelist=(`find $CMSIS_DSPSrc_path -name "*.c" | sed -e "s#$CMSIS_DSPSrc_path/##g" | sort -u`)
195-
for fp in ${filelist[@]}
196-
do
196+
filelist=($(find $CMSIS_DSPSrc_path -name "*.c" | sed -e "s#$CMSIS_DSPSrc_path/##g" | sort -u))
197+
for fp in "${filelist[@]}"; do
197198
# Directory name
198-
d=`echo $fp | awk -F/ '{print $(NF-1)}'`
199-
if [ ! -d $CMSIS_DSP_outSrc_path/$d ]; then
200-
mkdir $CMSIS_DSP_outSrc_path/$d
201-
echo "#include \"../Source/$d/$d.c\"" > $CMSIS_DSP_outSrc_path/$d/$d.c
199+
d=$(echo "$fp" | awk -F/ '{print $(NF-1)}')
200+
if [ ! -d $CMSIS_DSP_outSrc_path/"$d" ]; then
201+
mkdir $CMSIS_DSP_outSrc_path/"$d"
202+
echo "#include \"../Source/$d/$d.c\"" > $CMSIS_DSP_outSrc_path/"$d"/"$d".c
202203
fi
203204
done
204205
fi

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Arduino core support for STM32 based boards
22
[![forums](https://img.shields.io/badge/join-the%20forums-blue.svg)](https://www.stm32duino.com/)
33
[![wiki](https://img.shields.io/badge/browse-the%20wiki-orange.svg)](https://github.com/stm32duino/wiki/wiki)
4-
![Continuous Integration](https://github.com/stm32duino/Arduino_Core_STM32/workflows/STM32%20Core%20Continuous%20Integration/badge.svg)
4+
![STM32 Core Continuous Integration](https://github.com/stm32duino/Arduino_Core_STM32/workflows/STM32%20Core%20Continuous%20Integration/badge.svg?branch=master)
55

66
[![GitHub release](https://img.shields.io/github/release/stm32duino/Arduino_Core_STM32.svg)](https://github.com/stm32duino/Arduino_Core_STM32/releases/latest)
77
![GitHub All Releases](https://img.shields.io/github/downloads/stm32duino/Arduino_Core_STM32/total.svg?label=downloads%20since%201.4.0)
@@ -77,6 +77,7 @@ User can add a STM32 based board following this [wiki](https://github.com/stm32d
7777

7878
| Status | [Nucleo 32](https://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-eval-tools/stm32-mcu-eval-tools/stm32-nucleo-boards.html) | Release | Comment |
7979
| :---: | --- | :---: | :--- |
80+
| :yellow_heart: | [Nucleo F031K6](https://www.st.com/en/evaluation-tools/nucleo-f031k6.html) | **1.9.0** | |
8081
| :green_heart: | [Nucleo F303K8](http://www.st.com/en/evaluation-tools/nucleo-f303k8.html) | *1.1.0* | |
8182
| :green_heart: | [Nucleo G431KB](https://www.st.com/en/evaluation-tools/nucleo-g431kb.html) | *1.7.0* | |
8283
| :green_heart: | [Nucleo L031K6](http://www.st.com/en/evaluation-tools/nucleo-l031k6.html) | *1.1.1* | |

0 commit comments

Comments
 (0)