Make, .clangd, .clang-format, readme
This commit is contained in:
parent
e83579e442
commit
7f8d9307a1
4 changed files with 123 additions and 0 deletions
16
.clang-format
Normal file
16
.clang-format
Normal file
|
@ -0,0 +1,16 @@
|
|||
BasedOnStyle: LLVM
|
||||
IndentWidth: 4 # Use 4 spaces for indentation
|
||||
TabWidth: 4 # Tab width is also 4 spaces
|
||||
UseTab: Never # Always use spaces instead of tabs
|
||||
ColumnLimit: 120 # Wrap lines after 80 characters
|
||||
AllowShortLoopsOnASingleLine: true
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
BreakConstructorInitializers: BeforeComma
|
||||
AlignConsecutiveDeclarations:
|
||||
Enabled: true
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: false
|
||||
AlignCompound: false
|
||||
AlignFunctionPointers: false
|
||||
PadOperators: false
|
||||
AlignConsecutiveMacros: true
|
14
.clangd
Normal file
14
.clangd
Normal file
|
@ -0,0 +1,14 @@
|
|||
CompileFlags:
|
||||
CompilationDatabase: build
|
||||
Add:
|
||||
- -ferror-limit=0
|
||||
Remove:
|
||||
- -mlong-calls
|
||||
- -mlongcalls
|
||||
- -fstrict-volatile-bitfields
|
||||
- -fno-shrink-wrap
|
||||
- -fno-tree-switch-conversion
|
||||
Diagnostics:
|
||||
Suppress:
|
||||
- unknown_argument
|
||||
- pp_file_not_found
|
60
Makefile
Normal file
60
Makefile
Normal file
|
@ -0,0 +1,60 @@
|
|||
# === Configuration ===
|
||||
PORT ?= /dev/ttyUSB0
|
||||
BAUD ?= 460800
|
||||
TARGET ?= esp32
|
||||
PROJECT := $(shell basename $(CURDIR))
|
||||
BUILD_DIR := build
|
||||
RELEASE_DIR := release
|
||||
|
||||
# === Tool Selection ===
|
||||
ifeq ($(PODMAN),1)
|
||||
IDF := podman run --rm -v $(PWD):/project:Z -w /project docker.io/espressif/idf:latest idf.py
|
||||
ESPTOOL := podman run --rm -v $(PWD):/project:Z -w /project docker.io/espressif/idf:latest esptool.py
|
||||
else
|
||||
IDF := idf.py
|
||||
ESPTOOL := esptool.py
|
||||
endif
|
||||
|
||||
ifeq ($(origin IDF_PATH), undefined)
|
||||
ifeq ($(origin PODMAN), undefined)
|
||||
$(shell printf "\033[1;31mIDF_PATH is not set. Did you forget to source the ESP-IDF environment?\033[0m\n" 1>&2)
|
||||
$(shell printf '\033[1;31mSource the ESP-IDF environment by: "$$ source ~/esp/esp-idf/export.sh"\033[0m\n' 1>&2)
|
||||
endif
|
||||
endif
|
||||
|
||||
help:
|
||||
@echo -e "Makefile for IDFHack\n"
|
||||
@echo -e "Use 'make <target> PODMAN=1' to run in podman.\n"
|
||||
@echo "Available targets:"
|
||||
@echo " build - Build the binary"
|
||||
@echo " menuconfig - Start the idf configuration tui"
|
||||
@echo " release - Assemble release artifacts"
|
||||
@echo " clean - Clean the tree"
|
||||
@echo " nuke - Really clean the tree"
|
||||
@echo " help - Show this help message"
|
||||
@echo -e ""
|
||||
|
||||
menuconfig:
|
||||
$(IDF) menuconfig
|
||||
|
||||
build:
|
||||
$(IDF) build
|
||||
|
||||
flash:
|
||||
$(IDF) flash
|
||||
|
||||
qemu:
|
||||
$(IDF) qemu
|
||||
|
||||
clean:
|
||||
$(IDF) clean
|
||||
rm -rf release
|
||||
|
||||
issues:
|
||||
bash ./scripts/find_issues.sh ./main
|
||||
|
||||
nuke: clean
|
||||
rm -rf build
|
||||
rm -rf .cache
|
||||
|
||||
.PHONY: build clean nuke help
|
33
README.md
Normal file
33
README.md
Normal file
|
@ -0,0 +1,33 @@
|
|||
# Building
|
||||
|
||||
1. Install the ESP-IDF toolchain (See: [Toolchain section](#toolchain]))
|
||||
2. Source the environment `source ~/esp/esp-idf/export.sh` (yes i know)
|
||||
3. idf.py build
|
||||
4. idf.py flash
|
||||
|
||||
A makefile is provided to somewhat remedy this madness.
|
||||
|
||||
## Toolchain
|
||||
|
||||
See: [Standard Toolchain Setup for Linux](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/get-started/linux-macos-setup.html)
|
||||
|
||||
From the official docs, essentially:
|
||||
```sh
|
||||
mkdir -p ~/esp
|
||||
cd ~/esp
|
||||
git clone -b v5.4.2 --recursive https://github.com/espressif/esp-idf.git
|
||||
cd ~/esp/esp-idf
|
||||
./install.sh esp32 # This is the arch for our mcu (esp-wroom-32)
|
||||
```
|
||||
|
||||
For qemu: (The environment needs to be sourced)
|
||||
```sh
|
||||
python $IDF_PATH/tools/idf_tools.py install qemu-xtensa
|
||||
```
|
||||
|
||||
## Help and Resources
|
||||
|
||||
- Espressif docs on the ESP-IDF build system: [Build System](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/build-system.html)
|
||||
- Dependencies found here: [ESP Registry](https://components.espressif.com/)
|
||||
- Custon FreeRTOS to better facilitate the ESP: [ESP-IDF FreeRTOS](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/system/freertos.html)
|
||||
- Vanilla FreeRTOS docs [FreeRTOS Documentation](https://www.freertos.org/Documentation/00-Overview)
|
Loading…
Add table
Reference in a new issue