I'm trying to build a simple blinker hello world project using libopencm3. It is a big complicated project and it's using Makefile to build. So far I tried compiling it with SEGGER compiler as CC parameter for the Makefile and creating a Library project in SES importing all the code that I need, but couldn't get it built.
My target microcontroller is STM32F103C8T6 and the code is based on this example:
Display All
What would be the correct approach to compile this in SES using libopencm3?
My target microcontroller is STM32F103C8T6 and the code is based on this example:
C Source Code: main.c
- #include <libopencm3/stm32/rcc.h>
- #include <libopencm3/stm32/gpio.h>
- static void gpio_setup() {
- rcc_periph_clock_enable(RCC_GPIOC);
- gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_2_MHZ,
- GPIO_CNF_OUTPUT_PUSHPULL, GPIO12);
- }
- int main() {
- gpio_setup();
- while (1) {
- gpio_toggle(GPIOC, GPIO12);
- for (int i = 0; i < 800000; i++)
- __asm__("nop");
- }
- return 0;
- }