I’m not sure if my last (very first) post was successful as I can’t find any reference to it.
I have got B4R compiling and running for the stm32NucleoF1 board.
Several changes were required to overcome incompatibility between the stm32 libraries and the arduino avr libraries and B4R underlying C source files.
Below are my changes.
Mods for STM32F1
==============
This file details the changes made in implementing the Arduino_STM32
libraries and B4R libraries so that B4R can successfully compile to
target a STM32F103RB Nucleo Dev board.
Other changes may still need to be made as further libraries and
hardware support are confirmed.
I have only made changes to support the STM32F1 series.
The Arduino_STM32 libraries appear to support the other
microcontrollers in the ST family.
Last Revised: 10th June 2016
-------------------------------------------------------------------------
Added the following to lines to the STM32 file:
..//Arduino_STM32/STM32/STM32F1/cores/maple/print.h
size_t print(const Printable&);
size_t println(const Printable&);
Also added:
#include "printable.h"
This file was already in the maple folder just not included.
---------------------------------------------------------------------------
Seems that the STM32 libraries use an enumerated type (WiringPinMode)
for the pin mode value. STM32 supports many more pin modes.
In Arduino the pin mode is a numeric value only
defined as INPUT, OUTPUT and INPUT_PULLUP.
A type mismatch error occurs at compilation.
To translate the types, I edited the SetMode function in
the B4R file.
..//B4R/Libraries/rCore/B4RArduino.cpp
void Pin::setMode(Byte arduino_Mode) {
#ifdef USING_STM32
WiringPinMode stm32_Mode;
switch (arduino_Mode) {
case INPUT:
stm32_Mode = INPUT;
break;
case OUTPUT:
stm32_Mode = OUTPUT;
break;
case INPUT_PULLUP:
stm32_Mode = INPUT_PULLUP;
break;
}
pinMode(PinNumber, stm32_Mode);
#else
pinMode(PinNumber, arduino_Mode);
#endif
if (arduino_Mode == INPUT_PULLUP)
CurrentValue = true;
}
You need to define a compiler symbol "USING_STM32"to
..//B4R/Defines-Template.h
#define USING_STM32
Remove this define to compile B4R code for microcontrollers other
than stm32.
-------------------------------------------------------------------
Also need to extend the process timeout in B4R so that the
compilation results get displayed.
Menu: Tools/IDE-Options/Configure-Process-Timeout
Set it to 45 seconds.
------------------------------------------------------------------