Skip to content

Commit b892aef

Browse files
authored
Jenkins: Add STM32F1 support (#972)
1 parent 9663d4c commit b892aef

File tree

6 files changed

+48
-11
lines changed

6 files changed

+48
-11
lines changed

.ci/arduino.groovy

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def parseWarnings(String key) {
2626
excludePattern: '''.*/EEPROM\\.h,.*/Dns\\.cpp,.*/socket\\.cpp,.*/util\\.h,.*/Servo\\.cpp,
2727
.*/Adafruit_NeoPixel\\.cpp,.*/UIPEthernet.*,.*/SoftwareSerial\\.cpp,
2828
.*/pins_arduino\\.h,.*/Stream\\.cpp,.*/USBCore\\.cpp,.*/Wire\\.cpp,
29-
.*/hardware/esp8266.*,.*/libraries/SD/.*''',
29+
.*/hardware/STM32F1.*,.*/hardware/esp8266.*,.*/libraries/SD/.*''',
3030
healthy: '', includePattern: '', messagesPattern: '',
3131
parserConfigurations: [[parserName: 'Arduino/AVR', pattern: 'compiler_'+key+'.log']],
3232
unHealthy: '', unstableNewAll: '0', unstableTotalAll: '0'
@@ -164,6 +164,37 @@ def buildArduinoMega(config, sketches, String key) {
164164
}
165165
}
166166

167+
def buildSTM32F1(config, sketches, String key) {
168+
def fqbn = '-fqbn stm32duino:STM32F1:genericSTM32F103C:device_variant=STM32F103C8,upload_method=DFUUploadMethod,cpu_speed=speed_72mhz,opt=osstd'
169+
config.pr.setBuildStatus(config, 'PENDING', 'Toll gate (STM32F1 - '+key+')', 'Building...', '${BUILD_URL}flowGraphTable/')
170+
try {
171+
for (sketch = 0; sketch < sketches.size(); sketch++) {
172+
if (sketches[sketch].path != config.library_root+'examples/GatewayESP8266/GatewayESP8266.ino' &&
173+
sketches[sketch].path != config.library_root+'examples/GatewayESP8266MQTTClient/GatewayESP8266MQTTClient.ino' &&
174+
sketches[sketch].path != config.library_root+'examples/GatewayESP8266OTA/GatewayESP8266OTA.ino' &&
175+
sketches[sketch].path != config.library_root+'examples/SensebenderGatewaySerial/SensebenderGatewaySerial.ino') {
176+
buildArduino(config, fqbn, sketches[sketch].path, key+'_STM32F1')
177+
}
178+
}
179+
} catch (ex) {
180+
echo "Build failed with: "+ ex.toString()
181+
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (STM32F1 - '+key+')', 'Build error', '${BUILD_URL}')
182+
throw ex
183+
} finally {
184+
parseWarnings(key+'_STM32F1')
185+
}
186+
if (currentBuild.currentResult == 'UNSTABLE') {
187+
config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (STM32F1 - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new')
188+
if (config.is_pull_request) {
189+
error 'Termiated due to warnings found'
190+
}
191+
} else if (currentBuild.currentResult == 'FAILURE') {
192+
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (STM32F1 - '+key+')', 'Build error', '${BUILD_URL}')
193+
} else {
194+
config.pr.setBuildStatus(config, 'SUCCESS', 'Toll gate (STM32F1 - '+key+')', 'Pass', '')
195+
}
196+
}
197+
167198
def buildEsp8266(config, sketches, String key) {
168199
def fqbn = '-fqbn esp8266:esp8266:generic -prefs build.f_cpu=80000000 -prefs build.mcu=esp8266'
169200
config.pr.setBuildStatus(config, 'PENDING', 'Toll gate (ESP8266 - '+key+')', 'Building...', '${BUILD_URL}flowGraphTable/')

.ci/pipeline.groovy

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ def call(Closure body) {
109109
stage('ESP8266 (tests)') {
110110
arduino.buildEsp8266(config, config.tests, 'Tests')
111111
}
112+
stage('STM32F1 (tests)') {
113+
arduino.buildSTM32F1(config, config.tests, 'Tests')
114+
}
112115
stage('ArduinoUno (tests)') {
113116
arduino.buildArduinoUno(config, config.tests, 'Tests')
114117
}
@@ -139,6 +142,12 @@ def call(Closure body) {
139142
stage('ESP8266 (examples)') {
140143
arduino.buildEsp8266(config, config.examples, 'Examples')
141144
}
145+
// No point in building examples for STM32F1 yet
146+
/*
147+
stage('STM32F1 (Examples)') {
148+
arduino.buildSTM32F1(config, config.tests, 'Examples')
149+
}
150+
*/
142151
stage('ArduinoUno (examples)') {
143152
arduino.buildArduinoUno(config, config.examples, 'Examples')
144153
}

drivers/RF24/RF24.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ _SPI;
105105
#include <stdio.h>
106106
#include <string.h>
107107

108+
#if !defined(_BV)
108109
#define _BV(x) (1<<(x)) //!< _BV()
110+
#endif
109111

110112
#if defined(__arm__) || defined(__linux__)
111113
#include <SPI.h>

hal/architecture/MyHwSTM32F1.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ void hwRandomNumberInit(void)
126126
regs->SMPR1 |= ADC_SMPR1_SMP16;
127127

128128
uint32_t seed = 0;
129-
uint16_t currentValue, newValue = 0;
129+
uint16_t currentValue = 0;
130+
uint16_t newValue = 0;
130131

131132
for (uint8_t i = 0; i<32; i++) {
132133
const uint32_t timeout = hwMillis() + 20;

hal/architecture/MyHwSTM32F1.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
* The MySensors Arduino library handles the wireless radio link and protocol
33
* between your home built sensors/actuators and HA controller of choice.
44
* The sensors forms a self healing radio network with optional repeaters. Each
@@ -38,13 +38,9 @@
3838
#define snprintf_P snprintf
3939
#define vsnprintf_P vsnprintf
4040
#define strncpy_P strncpy
41+
#define printf_P printf
4142
#define yield() // not defined
4243

43-
// emulated EEPROM (experimental)
44-
#define EEPROM_PAGE_SIZE (uint16_t)1024
45-
#define EEPROM_SIZE (uint16_t)2048
46-
#define EEPROM_START_ADDRESS ((uint32_t)(0x8000000 + 128 * EEPROM_PAGE_SIZE - 2 * EEPROM_PAGE_SIZE))
47-
4844
#ifndef MY_SERIALDEVICE
4945
#define MY_SERIALDEVICE Serial
5046
#endif
@@ -76,4 +72,4 @@ uint8_t hwReadConfig(const int addr);
7672
#define MY_CRITICAL_SECTION
7773
#endif /* DOXYGEN */
7874

79-
#endif
75+
#endif

hal/architecture/MyMainSTM32F1.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
* version 2 as published by the Free Software Foundation.
1818
*/
1919

20-
extern "C" void __libc_init_array(void);
21-
2220
// Force init to be called *first*, i.e. before static object allocation.
2321
// Otherwise, statically allocated objects that need libmaple may fail.
2422
__attribute__(( constructor (101))) void premain()

0 commit comments

Comments
 (0)