# STM32 Bluepill Quickstart ## Temporary files Create files and directories within the project temp directory e.g.: `~/.gemini/tmp/d9929d1c794fb414052498bc12a08fef640ff8b7c30d9190d0699962781facbf` ## Compilation To compile the sketch, run the following command from the project root: ```bash arduino-cli compile --fqbn STMicroelectronics:stm32:GenF1:pnum=BLUEPILL_F103CB,upload_method=OpenOCDDapLink --build-path /tmp/$(basename $(pwd)) . ``` ## Flashing To flash the sketch use `openocd` to flash the sketch. ```bash openocd -d2 -f interface/cmsis-dap.cfg -f target/stm32f1x.cfg -c "program {/tmp/$(basename $(pwd))/$(basename $(pwd)).ino.elf} verify reset exit" ``` ## Viewing Logs The best way for me to read the logs is to capture the output from the serial port to a file, and then read that file. 1. First, I'd configure the serial port settings without starting an interactive session using `stty`. 2. Then, I'd use a command like `head` to read a specific number of lines from the serial port and save them to a temporary file. This command will exit automatically after reading the lines. 3. Finally, I would use `read_file` to read the contents of that temporary file.