Skip to content

Commit 489abfa

Browse files
committed
feat(core): first step of the migration: foundation (enums and types)
Signed-off-by: Aymane Bahssain <[email protected]>
1 parent 4ebecb1 commit 489abfa

File tree

878 files changed

+1265
-5482
lines changed

Some content is hidden

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

878 files changed

+1265
-5482
lines changed

.github/workflows/Arduino-build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ jobs:
3535
steps:
3636
# First of all, clone the repo using the checkout action.
3737
- name: Checkout
38-
uses: actions/checkout@v4
38+
uses: actions/checkout@main
39+
with:
40+
submodules: true
3941

4042
- name: Compilation
4143
id: Compile

.github/workflows/Cmake.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ jobs:
5353

5454
steps:
5555
- name: Checkout
56-
uses: actions/checkout@v4
56+
uses: actions/checkout@main
57+
with:
58+
submodules: true
5759

5860
- name: Get latest CMake and Ninja
5961
uses: lukka/get-cmake@latest

.github/workflows/astyle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
steps:
3232
# First of all, clone the repo using the checkout action.
3333
- name: Checkout
34-
uses: actions/checkout@v4
34+
uses: actions/checkout@v5
3535

3636
- name: Astyle check
3737
id: Astyle

.gitmodules

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[submodule "cores/arduino/api"]
22
path = cores/arduino/api
3-
url = https://github.com/stm32duino/ArduinoCore-API.git
3+
url = https://github.com/Aymane-ST/ArduinoCore-API.git
4+
branch = dev

CI/astyle/.astyleignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.git
22
BUILD
33
CI
4-
system
4+
system
5+
cores/arduino/api

CI/build/examples/BareMinimum/BareMinimum.ino

Lines changed: 0 additions & 162 deletions
Original file line numberDiff line numberDiff line change
@@ -3,171 +3,9 @@
33
* It allows to test build of built-in libraries
44
* and can not be executed.
55
*/
6-
7-
#include <EEPROM.h>
8-
#ifndef STM32MP1xx
9-
#include <IWatchdog.h>
10-
#endif
11-
#ifdef TIMER_SERVO
12-
#include <Servo.h>
13-
#endif
14-
#include <SPI.h>
15-
#include <SoftwareSerial.h>
16-
#include <Wire.h>
17-
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-
-1.244916875853235400, -4.793533929171324800
30-
};
31-
const float32_t testRefOutput_f32 = 1.000000000;
32-
/* ----------------------------------------------------------------------
33-
Declare Global variables
34-
------------------------------------------------------------------- */
35-
uint32_t blockSize = 2;
36-
float32_t testOutput;
37-
float32_t cosOutput;
38-
float32_t sinOutput;
39-
float32_t cosSquareOutput;
40-
float32_t sinSquareOutput;
41-
/* ----------------------------------------------------------------------
42-
Max magnitude FFT Bin test
43-
------------------------------------------------------------------- */
44-
arm_status status;
45-
/* CMSIS_DSP */
46-
47-
#ifndef USER_BTN
48-
#define USER_BTN 2
49-
#endif
50-
51-
#ifndef LED_BUILTIN
52-
#define LED_BUILTIN 13
53-
#endif
54-
55-
#ifndef PIN_SERIAL_RX
56-
#define PIN_SERIAL_RX 0
57-
#endif
58-
59-
#ifndef PIN_SERIAL_TX
60-
#define PIN_SERIAL_TX 1
61-
#endif
62-
63-
#ifndef Serial
64-
HardwareSerial Serial(PIN_SERIAL_RX, PIN_SERIAL_TX);
65-
#endif
66-
67-
#ifdef TIMER_SERVO
68-
Servo servo;
69-
#endif
70-
SoftwareSerial swSerial(10, 11);
71-
726
void setup() {
73-
// Serial HW & SW
74-
#if (!defined(USBD_USE_CDC) && !defined(DISABLE_GENERIC_SERIALUSB)) && (!defined(VIRTIOCON) && !defined(DISABLE_GENERIC_SERIALVIRTIO))
75-
Serial.setRx(PIN_SERIAL_RX);
76-
Serial.setTx(digitalPinToPinName(PIN_SERIAL_TX));
77-
#endif
78-
Serial.begin(9600); // start serial for output
79-
while (!Serial) {};
80-
81-
swSerial.begin(4800);
82-
swSerial.write("x");
83-
if (!swSerial.isListening()) {
84-
swSerial.listen();
85-
if (swSerial.available()) {
86-
swSerial.read();
87-
}
88-
}
89-
swSerial.end();
90-
91-
// EEPROM
92-
byte value = EEPROM.read(0x01);
93-
EEPROM.write(EEPROM.length() - 1, value);
94-
95-
#ifndef STM32MP1xx
96-
// IWDG
97-
if (!IWatchdog.isReset(true)) {
98-
IWatchdog.begin(10000000);
99-
IWatchdog.isEnabled();
100-
}
101-
IWatchdog.reload();
102-
#endif
103-
104-
#ifdef TIMER_SERVO
105-
// Servo
106-
servo.attach(3, 900, 2100);
107-
servo.write(1500);
108-
servo.detach();
109-
#endif
110-
111-
// SPI
112-
SPISettings settings(SPI_SPEED_CLOCK_DEFAULT, MSBFIRST, SPI_MODE0);
113-
SPI.setMISO(PIN_SPI_MISO);
114-
SPI.setMOSI(PIN_SPI_MOSI);
115-
SPI.setSCLK(PIN_SPI_SCK);
116-
SPI.setSSEL(digitalPinToPinName(PIN_SPI_SS));
117-
SPI.begin();
118-
SPI.beginTransaction(settings);
119-
SPI.endTransaction();
120-
SPI.transfer(1);
121-
SPI.end();
122-
123-
// Wire
124-
Wire.setSCL(PIN_WIRE_SCL);
125-
Wire.setSDA(digitalPinToPinName(PIN_WIRE_SDA));
126-
Wire.setClock(400000);
127-
Wire.begin(4);
128-
Wire.onRequest(requestEvent);
129-
Wire.onReceive(receiveEvent);
130-
Wire.beginTransmission(4);
131-
Wire.endTransmission();
132-
Wire.requestFrom(2, 1);
133-
Wire.end();
134-
135-
// CMSIS DSP
136-
float32_t diff;
137-
for (uint32_t i = 0; i < blockSize; i++) {
138-
cosOutput = arm_cos_f32(testInput_f32[i]);
139-
sinOutput = arm_sin_f32(testInput_f32[i]);
140-
arm_mult_f32(&cosOutput, &cosOutput, &cosSquareOutput, 1);
141-
arm_mult_f32(&sinOutput, &sinOutput, &sinSquareOutput, 1);
142-
arm_add_f32(&cosSquareOutput, &sinSquareOutput, &testOutput, 1);
143-
/* absolute value of difference between ref and test */
144-
diff = fabsf(testRefOutput_f32 - testOutput);
145-
/* Comparison of sin_cos value with reference */
146-
status = (diff > DELTA) ? ARM_MATH_TEST_FAILURE : ARM_MATH_SUCCESS;
147-
if (status == ARM_MATH_TEST_FAILURE) {
148-
break;
149-
}
150-
}
151-
if (status != ARM_MATH_SUCCESS) {
152-
Serial.printf("FAILURE\n");
153-
} else {
154-
Serial.printf("SUCCESS\n");
155-
}
1567
}
1578

1589
void loop() {
15910
}
16011

161-
// Wire
162-
// function that executes whenever data is received from master
163-
// this function is registered as an event, see setup()
164-
void receiveEvent(int) {
165-
while (1 < Wire.available()) {
166-
Wire.read();
167-
}
168-
}
169-
// function that executes whenever data is requested by master
170-
// this function is registered as an event, see setup()
171-
void requestEvent() {
172-
Wire.write("x");
173-
}

CI/build/examples/BareMinimum/CMakeLists.txt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ cmake_minimum_required(VERSION 3.21)
77
# STEP 1: set up bases of environment
88
# -----------------------------------------------------------------------------
99

10+
add_definitions(-DEXTENDED_PIN_MODE)
11+
1012
file(REAL_PATH "../../../../" CORE_PATH EXPAND_TILDE)
1113
file(TO_CMAKE_PATH "${CORE_PATH}" CORE_PATH)
1214

@@ -40,12 +42,12 @@ include(build_sketch)
4042
build_sketch(TARGET "BareMinimum"
4143
SOURCES
4244
BareMinimum.ino
43-
DEPENDS
44-
CMSIS_DSP
45-
EEPROM
46-
IWatchdog
47-
Servo
48-
SoftwareSerial
49-
SPI
50-
Wire
45+
# DEPENDS
46+
# CMSIS_DSP
47+
# EEPROM
48+
# IWatchdog
49+
# Servo
50+
# SoftwareSerial
51+
# SPI
52+
# Wire
5153
)

CI/codespell/.codespellrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[codespell]
22
check-filenames =
33
check-hidden =
4-
skip = ./.git,./CI,./system/Drivers,./system/Middlewares
4+
skip = ./.git,./CI,./system/Drivers,./system/Middlewares,./cores/arduino/api
55
ignore-words = ./CI/codespell/.codespellignore

0 commit comments

Comments
 (0)