--- /dev/null
+#include <libopencm3/cm3/systick.h>
+#include <libopencm3/stm32/rcc.h>
+#include <libopencm3/stm32/gpio.h>
+
+static void delay_ms(unsigned int ms)
+{
+ systick_clear();
+ for (unsigned int i=0; i<ms; i++)
+ while (!systick_get_countflag())
+ ;
+}
+
+int main(void)
+{
+ rcc_clock_setup_in_hse_8mhz_out_72mhz();
+ rcc_periph_clock_enable(RCC_GPIOC);
+
+ // PC13 = BluePill LED
+ gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, GPIO13);
+
+ systick_set_clocksource(STK_CSR_CLKSOURCE_AHB);
+ systick_set_reload(71999);
+ systick_counter_enable();
+
+ for (;;) {
+ gpio_clear(GPIOC, GPIO13);
+ delay_ms(100);
+ gpio_set(GPIOC, GPIO13);
+ delay_ms(500);
+ }
+
+ return 0;
+}