Skip to content

Commit 63cf66d

Browse files
committed
Update compiler flags for debugging and enhance development guide structure
1 parent cd4fec3 commit 63cf66d

2 files changed

Lines changed: 37 additions & 14 deletions

File tree

cmake/gcc-arm-none-eabi.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TARGET_FLAGS}")
2828
set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} -x assembler-with-cpp -MMD -MP")
2929
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wpedantic -fdata-sections -ffunction-sections")
3030

31-
set(CMAKE_C_FLAGS_DEBUG "-O0 -g3")
31+
set(CMAKE_C_FLAGS_DEBUG "-Og -g3") # Optimize for debugging on constrained 32KB flash
3232
set(CMAKE_C_FLAGS_RELEASE "-Os -g0")
33-
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3")
33+
set(CMAKE_CXX_FLAGS_DEBUG "-Og -g3")
3434
set(CMAKE_CXX_FLAGS_RELEASE "-Os -g0")
3535

3636
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -fno-rtti -fno-exceptions -fno-threadsafe-statics")
Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,51 @@
11
---
2-
title: Build
2+
title: Development Guide
33
page_id: build
44
---
55

6-
## Prerequisites
6+
## Building
7+
8+
### Prerequisites
9+
10+
- CMake
11+
- ARM GCC toolchain
12+
13+
### Build Commands
14+
15+
```bash
16+
cmake --preset Release
17+
cmake --build build/Release
18+
```
19+
20+
This will generate the firmware binary at `build/Release/color-led.elf`.
21+
22+
## Flashing
23+
24+
Once built, flash the firmware to the board using probe-rs:
25+
26+
```bash
27+
probe-rs download --chip stm32c011f6ux build/Release/color-led.elf
28+
```
29+
30+
## Debugging
31+
32+
For a more advanced development workflow with debugging capabilities:
33+
34+
### Prerequisites
735

836
- **VSCode** with the STM32Cube extension (see [.vscode/extensions.json](../../.vscode/extensions.json))
937

1038
The STM32Cube VSCode extension will automatically install and configure dependencies.
1139

12-
## Setup
40+
### Setup
1341

1442
1. Clone the repository
1543
2. Open the project in VSCode
1644
3. Install the recommended extensions when prompted
1745
4. The STM32Cube extension will set up the build environment automatically
1846

19-
## Building
20-
21-
- Press `Ctrl+Shift+B` to build
22-
- Or click the build button in the CMake extension toolbar
23-
24-
## Debugging
47+
### Debug Session
2548

26-
To flash and debug:
27-
- Press `F5` to build, flash, and start debugging
28-
- Or click the debug button in the VSCode debug panel
49+
To build, flash, and debug in one step:
50+
- Press `F5` to start a debug session
51+
- Or click the debug button in the VSCode debug panel

0 commit comments

Comments
 (0)