Compare commits
No commits in common. "df3a988ff6f6193e846de3041344810ab43782fa" and "0d1e25433be626536c76b601baaf26e23dfbdbc6" have entirely different histories.
df3a988ff6
...
0d1e25433b
|
|
@ -1,34 +0,0 @@
|
||||||
# ESP32_Project
|
|
||||||
|
|
||||||
## Description
|
|
||||||
|
|
||||||
This is a template for **C** project for esp32 boards using PlatformIO with the esp-idf framework, better than Arduino but proprietary.
|
|
||||||
|
|
||||||
## Setup
|
|
||||||
|
|
||||||
To make this template work you will need to install PlatformIO.
|
|
||||||
For this use this link : [super quick install](https://docs.platformio.org/en/latest/core/installation/methods/installer-script.html#super-quick-macos-linux)
|
|
||||||
|
|
||||||
During installation select all boards.
|
|
||||||
|
|
||||||
Then in the project's platformio.ini change the board id to the one that you can find by using :
|
|
||||||
```bash
|
|
||||||
pio boards your_board
|
|
||||||
```
|
|
||||||
|
|
||||||
And finally in the project dir run :
|
|
||||||
```bash
|
|
||||||
pio project init
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
In vscode open your task runner and use the different tasks :
|
|
||||||
- **Build** : Build the current project
|
|
||||||
- **Build and Upload** : Build project and upload to device
|
|
||||||
- **Clean** : Clean build directory
|
|
||||||
|
|
||||||
They correspond to calling make with the following :
|
|
||||||
- **Build** : pio run
|
|
||||||
- **Build and Upload** : pio run --target upload
|
|
||||||
- **Clean** : pio run --target clean
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
{
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"name": "Default",
|
|
||||||
"includePath": [
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"version": 1
|
|
||||||
}
|
|
||||||
|
|
@ -6,9 +6,9 @@
|
||||||
"detail": "Build project",
|
"detail": "Build project",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "make",
|
"command": "make",
|
||||||
"args": [
|
//"args": [
|
||||||
"-j$(nproc)"
|
// "-j$(nproc)"
|
||||||
],
|
//],
|
||||||
"group": "build",
|
"group": "build",
|
||||||
"presentation": {
|
"presentation": {
|
||||||
"echo": true,
|
"echo": true,
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,10 @@ SOURCES := \
|
||||||
OUTPUT := GCC_Project
|
OUTPUT := GCC_Project
|
||||||
|
|
||||||
# Compiler and flags
|
# Compiler and flags
|
||||||
CC = gcc
|
CXX = ccache gcc
|
||||||
CCFLAGS = -Wall -Wextra -std=c17
|
CXXFLAGS = -Wall -Wextra -std=c17 -g
|
||||||
LDFLAGS =
|
|
||||||
|
|
||||||
# Include directories
|
|
||||||
INCLUDE_DIRS =
|
INCLUDE_DIRS =
|
||||||
|
LDFLAGS =
|
||||||
|
|
||||||
# Change output location
|
# Change output location
|
||||||
OUTPUT := $(BUILD_DIR)/$(OUTPUT)
|
OUTPUT := $(BUILD_DIR)/$(OUTPUT)
|
||||||
|
|
@ -47,14 +45,14 @@ build_dir:
|
||||||
# Link target
|
# Link target
|
||||||
$(OUTPUT): $(OBJECTS)
|
$(OUTPUT): $(OBJECTS)
|
||||||
@echo "[100%] $(YELLOW)Linking $(OUTPUT)$(RESET)"
|
@echo "[100%] $(YELLOW)Linking $(OUTPUT)$(RESET)"
|
||||||
$(Q)$(CC) $(LDFLAGS) -o $@ $(OBJECTS)
|
$(Q)$(CXX) $(LDFLAGS) -o $@ $(OBJECTS)
|
||||||
|
|
||||||
# Build .o files from .c
|
# Build .o files from .c
|
||||||
$(BUILD_DIR)/%.o: %.c
|
$(BUILD_DIR)/%.o: %.c
|
||||||
$(eval CURRENT_FILE := $(shell echo $$(($(CURRENT_FILE)+1))))
|
$(eval CURRENT_FILE := $(shell echo $$(($(CURRENT_FILE)+1))))
|
||||||
$(eval PERCENTAGE := $(shell echo $$(($(CURRENT_FILE)*100/$(TOTAL_FILES)))))
|
$(eval PERCENTAGE := $(shell echo $$(($(CURRENT_FILE)*100/$(TOTAL_FILES)))))
|
||||||
@echo "[$(PERCENTAGE)%] $(GREEN)Building C object $@$(RESET)"
|
@echo "[$(PERCENTAGE)%] $(GREEN)Building C object $@$(RESET)"
|
||||||
$(Q)$(CC) $(CCFLAGS) $(INCLUDE_DIRS:%=-I%) -MMD -MP -c $< -o $@
|
$(Q)$(CXX) $(CXXFLAGS) $(INCLUDE_DIRS:%=-I%) -MMD -MP -c $< -o $@
|
||||||
|
|
||||||
# Source files dependencies
|
# Source files dependencies
|
||||||
-include $(OBJECTS:.o=.d)
|
-include $(OBJECTS:.o=.d)
|
||||||
|
|
@ -70,6 +68,7 @@ end: $(OUTPUT)
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
$(Q)rm -rf $(BUILD_DIR)
|
$(Q)rm -rf $(BUILD_DIR)
|
||||||
|
$(Q)rm -rf $(dir $(FXCONV_CONVERTERS))/__pycache__
|
||||||
|
|
||||||
# Run executable
|
# Run executable
|
||||||
.PHONY: run
|
.PHONY: run
|
||||||
|
|
|
||||||
|
|
@ -1,77 +0,0 @@
|
||||||
# GCC_Project
|
|
||||||
|
|
||||||
## Description
|
|
||||||
|
|
||||||
This is a template for **C** projects using make and gcc.
|
|
||||||
|
|
||||||
## Setup
|
|
||||||
|
|
||||||
To make this template work you will need to install make and gcc.
|
|
||||||
|
|
||||||
On Debian 13 the command is :
|
|
||||||
```bash
|
|
||||||
sudo apt install make gcc
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
In vscode open your task runner and use the different tasks :
|
|
||||||
- **Build** : Build the current project
|
|
||||||
- **Clean** : Clean build directory
|
|
||||||
- **Run** : Run the compiled executable
|
|
||||||
- **Build Verbose** : Build with verbosity on (show the commands called by make while building the project)
|
|
||||||
|
|
||||||
They correspond to calling make with the following :
|
|
||||||
- **Build** : make
|
|
||||||
- **Clean** : make clean
|
|
||||||
- **Run** : make run
|
|
||||||
- **Verbosity on** : make ... VERBOSE=1 ; You can add verbosity to any task that you want
|
|
||||||
|
|
||||||
If you want to add more source files in your project, add their path in the SOURCES variable in the Makefile.
|
|
||||||
For exemple to add src/wifi/udp_client.c you should do something like this :
|
|
||||||
```bash
|
|
||||||
# Source files
|
|
||||||
SOURCES := \
|
|
||||||
src/main.c \
|
|
||||||
src/wifi/udp_client.c
|
|
||||||
```
|
|
||||||
|
|
||||||
You can also add include drectories for headers :
|
|
||||||
TIP : Add the same path to your c_cpp_properties.json in the .vscode folder in the includePath list, like this you don't have include errors by IntelliSense
|
|
||||||
```bash
|
|
||||||
# Include directories
|
|
||||||
INCLUDE_DIRS = lib/super_extra/include/
|
|
||||||
```
|
|
||||||
|
|
||||||
> .vscode/c_cpp_properties.json
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"name": "Default",
|
|
||||||
"includePath": [
|
|
||||||
"lib/super_extra/include/"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"version": 1
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
You can change the name of the executable and the build dir too (don't forget to change it in the .gitignore):
|
|
||||||
```bash
|
|
||||||
# Build folder
|
|
||||||
BUILD_DIR = build_dir
|
|
||||||
|
|
||||||
#...
|
|
||||||
|
|
||||||
# Output target name
|
|
||||||
OUTPUT := BestExecOfHumanity
|
|
||||||
```
|
|
||||||
|
|
||||||
And change the compiler and linker args as you want :
|
|
||||||
```bash
|
|
||||||
# Flags
|
|
||||||
CCFLAGS = -Wall -Wextra -std=c17 -g -no-pie
|
|
||||||
LDFLAGS = -no-pie
|
|
||||||
```
|
|
||||||
23
README.md
23
README.md
|
|
@ -1,23 +0,0 @@
|
||||||
# Projects Templates
|
|
||||||
|
|
||||||
## Description
|
|
||||||
|
|
||||||
This is a compilation of many differents project templates, mainly configured for vscode.
|
|
||||||
Every template has a default program so you can start by there after configuring them.
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
## Setup
|
|
||||||
|
|
||||||
### Per-project setup
|
|
||||||
|
|
||||||
Each project template has a README to explain how to configure it on Debian 13 and how to use it.
|
|
||||||
Other distributions than Debian should work but configuration might not be applicable.
|
|
||||||
|
|
||||||
### Global setup
|
|
||||||
|
|
||||||
Many of the templates - if not all - are using the task runner in vscode, so it's highly recommended to setup a shortcut to open the task runner.
|
|
||||||
|
|
||||||
You may also want to install the extensions in vscode.
|
|
||||||
For the moment you should install, at least, the **C/C++** default extension (not the extension pack) by *microsoft* to get IntelliSense highlighting and code browsing.
|
|
||||||
I use the **Teleplot** extension by *alexnesnes* too. It's useful to communicate over serial port to external devices like RPI Pico or ESP32 boards.
|
|
||||||
Loading…
Reference in New Issue