libmaple offers Arduino like environment for STM32 processors. Unlike Arduino one has to write complete C++ file like blink example. One has to provide a simple Makefile like example Makefile. The LIB_MAPLE_HOME variable point to location of libmaple library. The BOARD variable specifies board to use. For minimal STM32 board that we have we can use the same setting as for Maple Mini, that is BOARD=maple_mini. The MEMORY_TARGET variable chooses between putting program in flash and putting it in RAM. In the example we choose RAM because it makes debugging easier. However, large program may be too big for flash so we would have to put them in flash. Also, program written to ram is lost when board loses power, while program written to flash is persistent.

libmaple was designed to be used with USB bootloader, that is program that uses DFU protocol to upload program to board. But we can also use gdb and st-util program (part of st-link package). st-util connects to board and offers debugging interface on TCP port 4242. gdb can connect to this interface which supports uploading programs, running them, examining variables and registers, single-stepping and breakpoints.

Below is transcritpt of session where we upload program and run it. First in one teminal we start st-util program:

2016-03-31T20:23:55 INFO src/stlink-common.c: Loading device parameters....
2016-03-31T20:23:55 INFO src/stlink-common.c: Device connected is: F1 Medium-density device, id 0x20036410
2016-03-31T20:23:55 INFO src/stlink-common.c: SRAM size: 0x5000 bytes (20 KiB), Flash: 0x10000 bytes (64 KiB) in pages of 1024 bytes
2016-03-31T20:23:55 INFO gdbserver/gdb-server.c: Chip ID is 00000410, Core ID is  1ba01477.
2016-03-31T20:23:55 INFO gdbserver/gdb-server.c: Target voltage is 3550 mV.
2016-03-31T20:23:55 INFO gdbserver/gdb-server.c: Listening at *:4242...
Then we use gdb in another terminal. We start it in directory where we build the example program.
arm-none-eabi-gdb build/maple_mini.elf 
GNU gdb (7.10-1+9) 7.10
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-linux-gnu --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from build/maple_mini.elf...done.
(gdb) target extended-remote :4242
Remote debugging using :4242
0x08001ae0 in ?? ()
(gdb) load
Loading section .text, size 0x2440 lma 0x20000c00
Loading section .ARM.exidx, size 0x8 lma 0x20003040
Loading section .data, size 0x820 lma 0x20003048
Loading section .rodata, size 0x2dc lma 0x20003868
Start address 0x20002500, load size 12100
Transfer rate: 32 KB/sec, 2016 bytes/write.
(gdb) c
Continuing.