STM32, Maple and Maple mini port to IDE 1.5.x

Having just received a low cost Marple Mini board, I wanted to move a project including u8glib and M2tklib from an Arduino Mega to this board due to the smaller dimensions. The memory of an arduino mini is not big enough for the menu system, and as I came across the Marple mini, it looked promising due to (kind of) Arduino compatibility.
I have Kubuntu 14.10 with Arduino Ide 1.6.1 and latest maplemini installed.

As @PaulRB, #1883, I had the same errors showing up with regard to the u8glib (avr version).
What follows is just my observations and results after some changes to the maple files.

The error messages showed function declarations either including default values or the same function name with different number of arguments.

After investigating the header files in STM32F1/cores/maple, I discovered that some of the header files have function declarations including c++ syntax, like default values for arguments.
And bool gave problems too.

The Arduino.h includes wirish.h and this then includes the header files, giving problems in .c files.

To test it out, I moved the default argument values from io.h to wirish_digital.cpp and added bool/boolean definitions to wirish_types.h.
At the end I changed the wirish.h to include/exclude headers depending on c/c++.

#include <pwm.h>
#ifdef __cplusplus
#include <ext_interrupts.h>
#include <wirish_math.h>
#endif
#include <wirish_debug.h>
#include <wirish_time.h>
#include <wirish_constants.h>

#ifdef __cplusplus
#if STM32_MCU_SERIES == STM32_SERIES_F1 /* FIXME [0.0.13?] port to F2 */
//#include <HardwareSPI.h>
#endif

#include <HardwareSerial.h>
#include <HardwareTimer.h>
#include <usb_serial.h>

#include <wirish_types.h>
#endif
#include <libmaple/libmaple.h>

The compilation then ended like this:

/tmp/build5739652790951924273.tmp/core.a -Wl,--no-whole-archive -Wl,--end-group 
/tmp/build5739652790951924273.tmp/U8glib/utility/u8g_com_arduino_common.c.o: In function `u8g_com_arduino_digital_write':
/home/cbp/sketchbook/libraries/U8glib/utility/u8g_com_arduino_common.c:55: warning: undefined reference to `digitalWrite'
/tmp/build5739652790951924273.tmp/U8glib/utility/u8g_com_arduino_common.c.o: In function `u8g_com_arduino_assign_pin_output_high':
/home/cbp/sketchbook/libraries/U8glib/utility/u8g_com_arduino_common.c:67: warning: undefined reference to `pinMode'
/home/cbp/sketchbook/libraries/U8glib/utility/u8g_com_arduino_common.c:68: warning: undefined reference to `digitalWrite'
/tmp/build5739652790951924273.tmp/U8glib/utility/u8g_com_arduino_std_sw_spi.c.o: In function `u8g_arduino_sw_spi_shift_out':
/home/cbp/sketchbook/libraries/U8glib/utility/u8g_com_arduino_std_sw_spi.c:55: warning: undefined reference to `digitalWrite'
/home/cbp/sketchbook/libraries/U8glib/utility/u8g_com_arduino_std_sw_spi.c:59: warning: undefined reference to `digitalWrite'
/home/cbp/sketchbook/libraries/U8glib/utility/u8g_com_arduino_std_sw_spi.c:62: warning: undefined reference to `digitalWrite'
/tmp/build5739652790951924273.tmp/U8glib/utility/u8g_delay.c.o: In function `u8g_Delay':
/home/cbp/sketchbook/libraries/U8glib/utility/u8g_delay.c:191: warning: undefined reference to `delayMicroseconds'
/tmp/build5739652790951924273.tmp/U8glib/utility/u8g_delay.c.o: In function `u8g_MicroDelay':
/home/cbp/sketchbook/libraries/U8glib/utility/u8g_delay.c:198: warning: undefined reference to `delayMicroseconds'
/tmp/build5739652790951924273.tmp/M2tklib/utility/m2esarduino.c.o: In function `m2_arduino_check_key':
/home/cbp/sketchbook/libraries/M2tklib/utility/m2esarduino.c:85: warning: undefined reference to `digitalRead'
/tmp/build5739652790951924273.tmp/M2tklib/utility/m2esarduino.c.o: In function `m2_arduino_setup_key':
/home/cbp/sketchbook/libraries/M2tklib/utility/m2esarduino.c:55: warning: undefined reference to `pinMode'
/home/cbp/sketchbook/libraries/M2tklib/utility/m2esarduino.c:56: warning: undefined reference to `digitalWrite'
/tmp/build5739652790951924273.tmp/M2tklib/utility/m2esarduino.c.o: In function `m2_get_rot_enc_get_key':
/home/cbp/sketchbook/libraries/M2tklib/utility/m2esarduino.c:215: warning: undefined reference to `delay'
/home/cbp/work/arduino/ide/arduino-1.6.1/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/arm-none-eabi-objcopy -O binary /tmp/build5739652790951924273.tmp/HotHandHeldSPI.cpp.elf /tmp/build5739652790951924273.tmp/HotHandHeldSPI.cpp.bin 

Sketch uses 51.620 bytes (47%) of program storage space. Maximum is 108.000 bytes.
Global variables use 6.968 bytes of dynamic memory

As explained on the u8glib wiki, some functions need to be defined for the arm, this fits the undefined references.
I have not yet looked into this as I do not know if it is a good idea to continue fixing the issues.
I might be wrong, but it appears that the Arduino compatibility needs an overhaul in order to use existing Arduino code/libraries where possible without a major re-write.

Haven't tried upload yet.