This commit is contained in:
2026-02-06 15:08:06 +01:00
commit 9b2f64b766
6 changed files with 58 additions and 0 deletions

3
.envrc Normal file
View File

@@ -0,0 +1,3 @@
source /home/pluc/esp/v5.5/esp-idf/export.sh
export PORT="/dev/serial/by-id/usb-Espressif_USB_JTAG_serial_*"

8
CMakeLists.txt Normal file
View File

@@ -0,0 +1,8 @@
# The following lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.22)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
idf_build_set_property(MINIMAL_BUILD ON)
project(hello_world)

9
README.md Normal file
View File

@@ -0,0 +1,9 @@
## Init
idf.py set-target esp32c2
## Build and flash
idf.py build
idf.py -p /dev/serial/by-id/usb-Espressif* flash

3
main/CMakeLists.txt Normal file
View File

@@ -0,0 +1,3 @@
idf_component_register(SRCS "hello_world_main.c"
PRIV_REQUIRES spi_flash esp_driver_gpio
INCLUDE_DIRS "")

34
main/hello_world_main.c Normal file
View File

@@ -0,0 +1,34 @@
#include <stdio.h>
#include <inttypes.h>
#include "sdkconfig.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_chip_info.h"
#include "esp_flash.h"
#include "esp_system.h"
#include "driver/gpio.h"
#define LED_GPIO 15
void app_main(void)
{
gpio_config_t io_conf = {
.pin_bit_mask = LED_GPIO,
.mode = GPIO_MODE_OUTPUT,
.pull_up_en = GPIO_PULLUP_DISABLE,
.pull_down_en = GPIO_PULLDOWN_DISABLE,
.intr_type = GPIO_INTR_DISABLE, // No interrupt for now
};
esp_err_t ret = gpio_config(&io_conf);
while(1) {
printf("hello");
vTaskDelay(1000 / portTICK_PERIOD_MS);
gpio_set_level(LED_GPIO, 1);
vTaskDelay(1000 / portTICK_PERIOD_MS);
gpio_set_level(LED_GPIO, 0);
}
}

1
sdkconfig.defaults Normal file
View File

@@ -0,0 +1 @@
CONFIG_ESP_CONSOLE_USB_CDC=y