Skip to content

Commit 2e1e076

Browse files
authored
Merge pull request #5 from stm32duino/master
Update 23 diciembre 2020
2 parents d22095e + b626ed2 commit 2e1e076

File tree

494 files changed

+296163
-100495
lines changed

Some content is hidden

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

494 files changed

+296163
-100495
lines changed

Diff for: .github/workflows/Continuous-Integration.yml

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
- CI/**
1111
- '!CI/build/arduino-cli.py'
1212
- '!CI/build/platformio-builder.py'
13+
- '!CI/build/examples/**'
1314
- tools/**
1415
- '!tools/platformio-build.py'
1516
pull_request:
@@ -20,6 +21,7 @@ on:
2021
- CI/**
2122
- '!CI/build/arduino-cli.py'
2223
- '!CI/build/platformio-builder.py'
24+
- '!CI/build/examples/**'
2325
- tools/**
2426
- '!tools/platformio-build.py'
2527
jobs:

Diff for: CI/build/arduino-cli.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ def find_board():
486486
for fqbn in fqbn_list_tmp:
487487
try:
488488
output = subprocess.check_output(
489-
[arduino_cli, "board", "details", "--format", "json", fqbn],
489+
[arduino_cli, "board", "details", "--additional-urls", stm32_url, "--format", "json", fqbn],
490490
stderr=subprocess.STDOUT,
491491
).decode("utf-8")
492492
except subprocess.CalledProcessError as e:

Diff for: CI/build/examples/BareMinimum/BareMinimum.ino

+53-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,36 @@
1515
#include <SoftwareSerial.h>
1616
#include <Wire.h>
1717

18+
#include <CMSIS_DSP.h>
19+
/* ----------------------------------------------------------------------
20+
Defines each of the tests performed
21+
------------------------------------------------------------------- */
22+
#define MAX_BLOCKSIZE 2
23+
#define DELTA (0.0001f)
24+
/* ----------------------------------------------------------------------
25+
Test input data for Floating point sin_cos example for 32-blockSize
26+
Generated by the MATLAB randn() function
27+
------------------------------------------------------------------- */
28+
const float32_t testInput_f32[MAX_BLOCKSIZE] =
29+
{
30+
-1.244916875853235400, -4.793533929171324800
31+
};
32+
const float32_t testRefOutput_f32 = 1.000000000;
33+
/* ----------------------------------------------------------------------
34+
Declare Global variables
35+
------------------------------------------------------------------- */
36+
uint32_t blockSize = 2;
37+
float32_t testOutput;
38+
float32_t cosOutput;
39+
float32_t sinOutput;
40+
float32_t cosSquareOutput;
41+
float32_t sinSquareOutput;
42+
/* ----------------------------------------------------------------------
43+
Max magnitude FFT Bin test
44+
------------------------------------------------------------------- */
45+
arm_status status;
46+
/* CMSIS_DSP */
47+
1848
#ifndef USER_BTN
1949
#define USER_BTN 2
2050
#endif
@@ -103,6 +133,28 @@ void setup() {
103133
Wire.endTransmission();
104134
Wire.requestFrom(2, 1);
105135
Wire.end();
136+
137+
// CMSIS DSP
138+
float32_t diff;
139+
for (uint32_t i = 0; i < blockSize; i++) {
140+
cosOutput = arm_cos_f32(testInput_f32[i]);
141+
sinOutput = arm_sin_f32(testInput_f32[i]);
142+
arm_mult_f32(&cosOutput, &cosOutput, &cosSquareOutput, 1);
143+
arm_mult_f32(&sinOutput, &sinOutput, &sinSquareOutput, 1);
144+
arm_add_f32(&cosSquareOutput, &sinSquareOutput, &testOutput, 1);
145+
/* absolute value of difference between ref and test */
146+
diff = fabsf(testRefOutput_f32 - testOutput);
147+
/* Comparison of sin_cos value with reference */
148+
status = (diff > DELTA) ? ARM_MATH_TEST_FAILURE : ARM_MATH_SUCCESS;
149+
if ( status == ARM_MATH_TEST_FAILURE) {
150+
break;
151+
}
152+
}
153+
if (status != ARM_MATH_SUCCESS) {
154+
Serial.printf("FAILURE\n");
155+
} else {
156+
Serial.printf("SUCCESS\n");
157+
}
106158
}
107159

108160
void loop() {
@@ -120,4 +172,4 @@ void receiveEvent(int) {
120172
// this function is registered as an event, see setup()
121173
void requestEvent() {
122174
Wire.write("x");
123-
}
175+
}

Diff for: CI/utils/stm32update.py

+66-23
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,16 @@ def checkVersion(serie, repo_path):
232232
"stm32{}xx_hal.c".format(lserie),
233233
)
234234
cube_HAL_versions[serie] = parseVersion(HAL_file)
235-
HAL_file = os.path.join(
236-
hal_dest_path,
237-
"STM32{}xx_HAL_Driver".format(userie),
238-
"Src",
239-
"stm32{}xx_hal.c".format(lserie),
240-
)
241-
core_HAL_versions[serie] = parseVersion(HAL_file)
235+
if upargs.add:
236+
core_HAL_versions[serie] = "0.0.0"
237+
else:
238+
HAL_file = os.path.join(
239+
hal_dest_path,
240+
"STM32{}xx_HAL_Driver".format(userie),
241+
"Src",
242+
"stm32{}xx_hal.c".format(lserie),
243+
)
244+
core_HAL_versions[serie] = parseVersion(HAL_file)
242245

243246
CMSIS_file = os.path.join(
244247
repo_path,
@@ -248,13 +251,16 @@ def checkVersion(serie, repo_path):
248251
"stm32{}xx.h".format(lserie),
249252
)
250253
cube_CMSIS_versions[serie] = parseVersion(CMSIS_file)
251-
CMSIS_file = os.path.join(
252-
cmsis_dest_path,
253-
"STM32{}xx".format(userie),
254-
"Include",
255-
"stm32{}xx.h".format(lserie),
256-
)
257-
core_CMSIS_versions[serie] = parseVersion(CMSIS_file)
254+
if upargs.add:
255+
core_CMSIS_versions[serie] = "0.0.0"
256+
else:
257+
CMSIS_file = os.path.join(
258+
cmsis_dest_path,
259+
"STM32{}xx".format(userie),
260+
"Include",
261+
"stm32{}xx.h".format(lserie),
262+
)
263+
core_CMSIS_versions[serie] = parseVersion(CMSIS_file)
258264

259265
# print("STM32Cube" + serie + " HAL version: " + cube_HAL_versions[serie])
260266
# print("STM32Core " + serie + " HAL version: " + core_HAL_versions[serie])
@@ -417,7 +423,9 @@ def updateCore():
417423
core_CMSIS_version = core_CMSIS_versions[serie]
418424
cube_CMSIS_version = cube_CMSIS_versions[serie]
419425
cube_version = cube_versions[serie]
420-
regexmd = re.compile(rf"(STM32{serie}:\s+)\d+.\d+.\d+")
426+
regexmd_up = re.compile(rf"(STM32{serie}:\s+)\d+.\d+.\d+")
427+
regexmd_serie = re.compile(r"STM32(\w+):\s+\d+.\d+.\d+")
428+
regexmd_add = re.compile(r"(STM32)\w+(:\s+)\d+.\d+.\d+")
421429
HAL_updated = False
422430
CMSIS_updated = False
423431
hal_commit_msg = """[{0}] Update STM32{0}xx HAL Drivers to v{1}
@@ -453,9 +461,22 @@ def updateCore():
453461
)
454462
copyFolder(HAL_serie_cube_path, HAL_serie_core_path, {"*.chm"})
455463
# Update MD file
456-
for line in fileinput.input(md_HAL_path, inplace=True):
457-
line = regexmd.sub(rf"\g<1>{cube_HAL_version}", line)
458-
print(line, end="")
464+
if upargs.add: # Add the new STM32YY entry
465+
added = False
466+
for line in fileinput.input(md_HAL_path, inplace=True):
467+
m = regexmd_serie.search(line)
468+
if not added and m and m.group(1) > serie.upper():
469+
print(
470+
regexmd_add.sub(
471+
rf"\g<1>{serie}\g<2>{cube_HAL_version}", line
472+
),
473+
end="",
474+
)
475+
added = True
476+
print(line, end="")
477+
else: # Update the version
478+
for line in fileinput.input(md_HAL_path, inplace=True):
479+
print(regexmd_up.sub(rf"\g<1>{cube_HAL_version}", line), end="")
459480
# Commit all HAL files
460481
commitFiles(core_path, hal_commit_msg)
461482
HAL_updated = True
@@ -480,9 +501,22 @@ def updateCore():
480501
)
481502
copyFolder(CMSIS_serie_cube_path, CMSIS_serie_dest_path, {"iar", "arm"})
482503
# Update MD file
483-
for line in fileinput.input(md_CMSIS_path, inplace=True):
484-
line = regexmd.sub(rf"\g<1>{cube_CMSIS_version}", line)
485-
print(line, end="")
504+
if upargs.add: # Add the new STM32YY entry
505+
added = False
506+
for line in fileinput.input(md_CMSIS_path, inplace=True):
507+
m = regexmd_serie.search(line)
508+
if not added and m and m.group(1) > serie.upper():
509+
print(
510+
regexmd_add.sub(
511+
rf"\g<1>{serie}\g<2>{cube_CMSIS_version}", line
512+
),
513+
end="",
514+
)
515+
added = True
516+
print(line, end="")
517+
else: # Update the version
518+
for line in fileinput.input(md_CMSIS_path, inplace=True):
519+
print(regexmd_up.sub(rf"\g<1>{cube_CMSIS_version}", line), end="")
486520
# Commit all CMSIS files
487521
commitFiles(core_path, cmsis_commit_msg)
488522
CMSIS_updated = True
@@ -506,9 +540,13 @@ def updateCore():
506540
upparser.add_argument(
507541
"-c", "--check", help="Check versions. Default all.", action="store_true"
508542
)
509-
upparser.add_argument(
543+
group = upparser.add_mutually_exclusive_group()
544+
group.add_argument(
510545
"-s", "--serie", metavar="pattern", help="Pattern of the STM32 serie(s) to update"
511546
)
547+
group.add_argument(
548+
"-a", "--add", metavar="name", help="STM32 serie name to add. Ex: 'F1'"
549+
)
512550

513551
upargs = upparser.parse_args()
514552

@@ -519,8 +557,13 @@ def main():
519557
checkConfig()
520558
updateCoreRepo()
521559
stm32_list = genSTM32List(hal_dest_path, upargs.serie)
560+
if upargs.add:
561+
if upargs.add.upper() not in stm32_list:
562+
stm32_list = [upargs.add.upper()]
563+
else:
564+
print(upargs.add + " can't be added as it already exists!")
565+
exit(1)
522566
updateSTRepo()
523-
524567
if upargs.check:
525568
printVersion()
526569
else:

Diff for: CI/utils/stm32wrapper.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,16 @@ def print_LL_header(open_file, name):
9898

9999

100100
def printCMSISStartup(log):
101-
filelist = glob.glob(
102-
os.path.join(
103-
CMSIS_Device_ST_path, "STM32*", "Source", "Templates", "gcc", "startup_*.s",
101+
filelist = sorted(
102+
glob.glob(
103+
os.path.join(
104+
CMSIS_Device_ST_path,
105+
"STM32*",
106+
"Source",
107+
"Templates",
108+
"gcc",
109+
"startup_*.s",
110+
)
104111
)
105112
)
106113
if len(filelist):
@@ -131,9 +138,9 @@ def printCMSISStartup(log):
131138
# File name
132139
fn = os.path.basename(fp)
133140
valueline = re.split("_|\\.", fn)
134-
upper = (
135-
valueline[1].upper().replace("X", "x").replace("MP15xx", "MP1xx")
136-
)
141+
if "stm32mp15" in valueline[1] and not valueline[1].endswith("xx"):
142+
valueline[1] += "xx"
143+
upper = valueline[1].upper().replace("X", "x")
137144
out_file.write(
138145
""" #elif defined({})
139146
#define CMSIS_STARTUP_FILE \"{}\"

Diff for: cores/arduino/HardwareSerial.cpp

+14-4
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,11 @@
9595
#endif
9696

9797
#if defined(HAVE_HWSERIAL10)
98-
HardwareSerial Serial10(UART10);
98+
#if defined(USART10)
99+
HardwareSerial Serial10(USART10);
100+
#else
101+
HardwareSerial Serial10(UART10);
102+
#endif
99103
void serialEvent10() __attribute__((weak));
100104
#endif
101105

@@ -218,16 +222,22 @@ HardwareSerial::HardwareSerial(void *peripheral, HalfDuplexMode_t halfDuplex)
218222
setTx(PIN_SERIAL8_TX);
219223
} else
220224
#endif
221-
#if defined(PIN_SERIAL9_TX) && defined(UART9)
225+
#if defined(PIN_SERIAL9_TX) && defined(UART9_BASE)
222226
if (peripheral == UART9) {
223227
#if defined(PIN_SERIAL9_RX)
224228
setRx(PIN_SERIAL9_RX);
225229
#endif
226230
setTx(PIN_SERIAL9_TX);
227231
} else
228232
#endif
229-
#if defined(PIN_SERIAL10_TX) && defined(UART10)
230-
if (peripheral == UART10) {
233+
#if defined(PIN_SERIAL10_TX) &&\
234+
(defined(USART10_BASE) || defined(UART10_BASE))
235+
#if defined(USART10_BASE)
236+
if (peripheral == USART10)
237+
#elif defined(UART10_BASE)
238+
if (peripheral == UART10)
239+
#endif
240+
{
231241
#if defined(PIN_SERIAL10_RX)
232242
setRx(PIN_SERIAL10_RX);
233243
#endif

Diff for: cores/arduino/HardwareSerial.h

+33-11
Original file line numberDiff line numberDiff line change
@@ -173,16 +173,38 @@ class HardwareSerial : public Stream {
173173
void configForLowPower(void);
174174
};
175175

176-
extern HardwareSerial Serial1;
177-
extern HardwareSerial Serial2;
178-
extern HardwareSerial Serial3;
179-
extern HardwareSerial Serial4;
180-
extern HardwareSerial Serial5;
181-
extern HardwareSerial Serial6;
182-
extern HardwareSerial Serial7;
183-
extern HardwareSerial Serial8;
184-
extern HardwareSerial Serial9;
185-
extern HardwareSerial Serial10;
186-
extern HardwareSerial SerialLP1;
176+
#if defined(USART1)
177+
extern HardwareSerial Serial1;
178+
#endif
179+
#if defined(USART2)
180+
extern HardwareSerial Serial2;
181+
#endif
182+
#if defined(USART3)
183+
extern HardwareSerial Serial3;
184+
#endif
185+
#if defined(UART4) || defined(USART4)
186+
extern HardwareSerial Serial4;
187+
#endif
188+
#if defined(UART5) || defined(USART5)
189+
extern HardwareSerial Serial5;
190+
#endif
191+
#if defined(USART6)
192+
extern HardwareSerial Serial6;
193+
#endif
194+
#if defined(UART7) || defined(USART7)
195+
extern HardwareSerial Serial7;
196+
#endif
197+
#if defined(UART8) || defined(USART8)
198+
extern HardwareSerial Serial8;
199+
#endif
200+
#if defined(UART9)
201+
extern HardwareSerial Serial9;
202+
#endif
203+
#if defined(UART10) || defined(USART10)
204+
extern HardwareSerial Serial10;
205+
#endif
206+
#if defined(LPUART1)
207+
extern HardwareSerial SerialLP1;
208+
#endif
187209

188210
#endif

0 commit comments

Comments
 (0)