Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mkdir STM32_example_blink
- cd STM32_example_blink
- git -c http.sslVerify=false clone --recurse-submodules https://github.com/STMicroelectronics/STM32CubeF1
- cat <<EOF >> blink.c #include "stm32f1xx.h"
- #include "stm32f1xx_ll_bus.h"
- #include "stm32f1xx_ll_gpio.h"
- void GPIO_config(void) {
- LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOC);
- LL_GPIO_SetPinMode(GPIOC, LL_GPIO_PIN_13, LL_GPIO_MODE_OUTPUT);
- LL_GPIO_SetPinOutputType(GPIOC, LL_GPIO_PIN_13, LL_GPIO_OUTPUT_PUSHPULL);
- LL_GPIO_SetPinSpeed(GPIOC, LL_GPIO_PIN_13, LL_GPIO_SPEED_FREQ_LOW);
- }
- int main(void) {
- GPIO_config();
- for (;;) {
- LL_GPIO_ResetOutputPin(GPIOC, LL_GPIO_PIN_13);
- for (volatile int i = 0; i < 100000; i++);
- LL_GPIO_SetOutputPin(GPIOC, LL_GPIO_PIN_13);
- for (volatile int i = 0; i < 100000; i++);
- }
- }
- EOF
- arm-none-eabi-gcc -DSTM32F103xB -I./STM32CubeF1/Drivers/CMSIS/Device/ST/STM32F1xx/Include -I./STM32CubeF1/Drivers/CMSIS/Include -I./STM32CubeF1/Drivers/STM32F1xx_HAL_Driver/Inc -mcpu=cortex-m3 -mthumb -std=c99 -ffunction-sections -fdata-sections -c blink.c
- arm-none-eabi-gcc -DSTM32F103xB -I./STM32CubeF1/Drivers/CMSIS/Device/ST/STM32F1xx/Include -I./STM32CubeF1/Drivers/CMSIS/Include -I./STM32CubeF1/Drivers/STM32F1xx_HAL_Driver/Inc -mcpu=cortex-m3 -mthumb -std=c99 -ffunction-sections -fdata-sections -c ./STM32CubeF1/Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c
- arm-none-eabi-gcc -x assembler-with-cpp -mthumb -c ./STM32CubeF1/Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103xb.s
- arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -std=c99 -ffunction-sections -fdata-sections -pipe --specs=nosys.specs -Wl,--gc-sections -ffreestanding "-T./STM32CubeF1/Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/linker/STM32F103XB_FLASH.ld" blink.o startup_stm32f103xb.o system_stm32f1xx.o -o blink.elf
- arm-none-eabi-objcopy -Oihex blink.elf blink.hex
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement