Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
5993a58
Add required components to blackmagic component
alufers May 28, 2023
e012f1c
Add required components to dap-link component, add missing include
alufers May 28, 2023
22e0ba4
Add esp_timer.h include to the blackmagic component
alufers May 28, 2023
fe1bd49
Add required components to simple-uart component, add missing include
alufers May 28, 2023
de5708e
Add required components to soft-uart component, change include
alufers May 28, 2023
ec7c6b4
change GPIP_PIN_INTR_DISABLE -> GPIO_INTR_DISABLE
alufers May 28, 2023
d5b601c
Add esp-idf managed components
alufers May 28, 2023
0e87b51
Change portTICK_RATE_MS to portTICK_PERIOD_MS
alufers May 28, 2023
1b11ffc
Rename tinyusb component to usbglue, use esp-idf's tinyusb
alufers May 28, 2023
fae3a46
Add missing includes of esp_chip_info.h and esp_mac.h
alufers May 28, 2023
01b8aef
Change usage of nvs_entry_find to suit idf v5.0.2
alufers May 28, 2023
6b1c89f
Temporarily remove reading of IP address
alufers May 28, 2023
e9c4ba7
Rewrite functions that obtain the IP addresses to use esp_netif
alufers May 28, 2023
e992956
Update readme to point to ESP-IDF version v5.0.2
alufers May 28, 2023
ceabc92
Update CI script
alufers May 28, 2023
ff7f7b8
Merge branch 'dev' into pr/40
DrZlo13 Jun 5, 2024
9b4f186
usb-glue: add flush
DrZlo13 Jun 5, 2024
7cecdca
update submodules
DrZlo13 Jun 5, 2024
ebdca0a
ci: empty commit to trigger ci/cd
portasynthinca3 Dec 17, 2024
8255edf
ci: pin component versions
portasynthinca3 Dec 17, 2024
3c22320
ci: upgrade pinned tinyusb
portasynthinca3 Dec 17, 2024
7583d79
ci: downgrade tinyusb to 0.15.0~3
portasynthinca3 Dec 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,12 @@ jobs:
run: npm run build
working-directory: components/svelte-portal

- name: 'Build firmware'
uses: Intake-Health/esp-idf-ci-action@release-v4.4
- name: esp-idf build
uses: espressif/esp-idf-ci-action@v1
with:
esp_idf_version: v5.0.2
target: esp32s2
path: './'

- name: 'Fix ownership'
uses: peter-murray/reset-workspace-ownership-action@v1
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
/build
/sdkconfig.old
/main/wifi-credentials.h
.DS_Store
.DS_Store
managed_components
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
[submodule "components/mlib/mlib"]
path = components/mlib/mlib
url = https://github.com/P-p-H-d/mlib.git
[submodule "components/tinyusb/tinyusb"]
path = components/tinyusb/tinyusb
url = https://github.com/hathach/tinyusb
[submodule "components/dap-link/free-dap"]
path = components/dap-link/free-dap
url = https://github.com/ataradov/free-dap
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ You must recursively clone the submodules, which `--recursive` will do for you.

# Develop with ESP-IDF

Set up __ESP-IDF v4.4__ following [Espressif's instructions](https://docs.espressif.com/projects/esp-idf/en/release-v4.4/esp32/get-started/index.html). Make sure `idf.py` is in your PATH and you can successfully run the program.
Set up __ESP-IDF v5.0.2__ following [Espressif's instructions](https://docs.espressif.com/projects/esp-idf/en/v5.0.2/esp32/get-started/index.html). Make sure `idf.py` is in your PATH and you can successfully run the program.

## Build with ESP-IDF

Expand Down
4 changes: 2 additions & 2 deletions components/blackmagic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@ execute_process(
message(STATUS "BM version: ${BM_GIT_DESC}")

idf_component_register(SRCS ${BM_SOURCES} ${BM_TARGETS}
INCLUDE_DIRS ${BM_INCLUDE})
INCLUDE_DIRS ${BM_INCLUDE} REQUIRES driver esp_timer)

target_compile_options(${COMPONENT_LIB} PRIVATE -DPC_HOSTED=0 -DFIRMWARE_VERSION="${BM_GIT_DESC}" -Wno-char-subscripts -Wno-attributes -std=gnu11)
target_compile_options(${COMPONENT_LIB} PRIVATE -DPC_HOSTED=0 -DFIRMWARE_VERSION="${BM_GIT_DESC}" -Wno-char-subscripts -Wno-attributes -std=gnu11)
3 changes: 2 additions & 1 deletion components/blackmagic/esp32-platform/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <hal/gpio_ll.h>
#include <esp_rom_gpio.h>
#include "esp_timer.h"

uint32_t swd_delay_cnt = 0;
// static const char* TAG = "gdb-platform";
Expand Down Expand Up @@ -131,4 +132,4 @@ bool platform_nrst_get_val() {

void platform_target_clk_output_enable(bool enable) {
(void)enable;
}
}
2 changes: 1 addition & 1 deletion components/dap-link/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
idf_component_register(SRCS "free-dap/dap.c"
PRIV_INCLUDE_DIRS "."
INCLUDE_DIRS "." "free-dap")
INCLUDE_DIRS "." "free-dap" REQUIRES driver)
3 changes: 2 additions & 1 deletion components/dap-link/dap_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <rom/ets_sys.h>
#include <hal/gpio_ll.h>
#include <esp_rom_gpio.h>
#include <esp_attr.h>

/*- Definitions -------------------------------------------------------------*/
// #define DAP_CONFIG_ENABLE_JTAG
Expand Down Expand Up @@ -192,4 +193,4 @@ __attribute__((always_inline)) static inline void DAP_CONFIG_DELAY(uint32_t cycl
register int32_t cnt;
for(cnt = cycles; --cnt > 0;)
;
}
}
2 changes: 1 addition & 1 deletion components/simple-uart/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
idf_component_register(SRCS "simple-uart.c"
INCLUDE_DIRS ".")
INCLUDE_DIRS "." REQUIRES driver)
11 changes: 9 additions & 2 deletions components/simple-uart/simple-uart.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#include <driver/gpio.h>
#include <driver/uart.h>
#include <driver/periph_ctrl.h>
#include <hal/uart_ll.h>
#include <hal/uart_hal.h>

#include <hal/gpio_hal.h>
#include <esp_rom_gpio.h>
#include <esp_check.h>

#include "simple-uart.h"

Expand Down Expand Up @@ -185,8 +187,13 @@ static void simple_uart_isr(void* arg) {
}

void simple_uart_set_baud_rate(uint8_t uart_num, uint32_t baud_rate) {
uart_sclk_t src_clk;
uint32_t sclk_freq;
uart_config[uart_num].baud_rate = baud_rate;
uart_hal_set_baudrate(UART_HAL(uart_num), baud_rate);

uart_hal_get_sclk(&(uart_context[uart_num].hal), &src_clk);
uart_get_sclk_freq(src_clk, &sclk_freq);
uart_hal_set_baudrate(UART_HAL(uart_num), baud_rate, sclk_freq);
}

void simple_uart_set_stop_bits(uint8_t uart_num, uart_stop_bits_t stop_bits) {
Expand Down Expand Up @@ -218,4 +225,4 @@ uart_parity_t simple_uart_get_parity(uint8_t uart_num) {

uart_word_length_t simple_uart_get_data_bits(uint8_t uart_num) {
return uart_config[uart_num].data_bits;
}
}
2 changes: 1 addition & 1 deletion components/soft-uart/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
idf_component_register(SRCS "soft-uart.c"
INCLUDE_DIRS ".")
INCLUDE_DIRS "." REQUIRES driver)
6 changes: 3 additions & 3 deletions components/soft-uart/soft-uart.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "soft-uart.h"
#include <string.h>
#include <freertos/portmacro.h>
#include <esp32/clk.h>
#include "esp_private/esp_clk.h"
#include <driver/gpio.h>

struct SoftUart {
Expand Down Expand Up @@ -56,7 +56,7 @@ SoftUart* soft_uart_init(uint32_t baudrate, uint8_t tx_pin) {

uart->bit_time = (esp_clk_cpu_freq() / uart->baudrate);

gpio_pad_select_gpio(uart->tx_pin);
esp_rom_gpio_pad_select_gpio(uart->tx_pin);
gpio_set_direction(uart->tx_pin, GPIO_MODE_OUTPUT);
gpio_set_level(uart->tx_pin, !uart->invert);
return uart;
Expand All @@ -66,4 +66,4 @@ void soft_uart_transmit(SoftUart* uart, const uint8_t* data, uint32_t data_size)
for(size_t i = 0; i < data_size; i++) {
soft_uart_transmit_byte(uart, data[i]);
}
}
}
65 changes: 0 additions & 65 deletions components/tinyusb/CMakeLists.txt

This file was deleted.

1 change: 0 additions & 1 deletion components/tinyusb/tinyusb
Submodule tinyusb deleted from dd30f2
41 changes: 41 additions & 0 deletions components/usbglue/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
idf_component_register(REQUIRES esp_rom app_update spi_flash freertos soc driver)

idf_component_get_property(FREERTOS_ORIG_INCLUDE_PATH freertos ORIG_INCLUDE_PATH)

idf_build_get_property(idf_target IDF_TARGET)

if(${idf_target} STREQUAL "esp32s2")
target_compile_options(${COMPONENT_TARGET} INTERFACE
"-DCFG_TUSB_MCU=OPT_MCU_ESP32S2"
)
endif()

if(${idf_target} STREQUAL "esp32s3")
target_compile_options(${COMPONENT_TARGET} INTERFACE
"-DCFG_TUSB_MCU=OPT_MCU_ESP32S3"
)
endif()

idf_component_get_property(tusb_lib espressif__tinyusb COMPONENT_LIB)
target_include_directories(${tusb_lib} PRIVATE ./config)

target_include_directories(${COMPONENT_TARGET} INTERFACE
"${FREERTOS_ORIG_INCLUDE_PATH}"
"${COMPONENT_DIR}/config/"
"${COMPONENT_DIR}/drivers/"
"${COMPONENT_DIR}/drivers/dual-cdc/"
"${COMPONENT_DIR}/tinyusb/hw/bsp/"
"${COMPONENT_DIR}/tinyusb/src/"
"${COMPONENT_DIR}/tinyusb/src/device"
"${COMPONENT_DIR}/tinyusb/src/class"
)

target_sources(${COMPONENT_TARGET} INTERFACE
"${COMPONENT_DIR}/drivers/usb-glue.c"

# "${COMPONENT_DIR}/drivers/dual-cdc/dual-cdc-driver.c"
"${COMPONENT_DIR}/drivers/dual-cdc/dual-cdc-descriptors.c"

# "${COMPONENT_DIR}/drivers/dap-link/vendor_device.c"
"${COMPONENT_DIR}/drivers/dap-link/dap-link-descriptors.c"
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#include <tusb.h>
#include <esp_mac.h>
#include <esp_log.h>

#include "dap-link/dap-link-descriptors.h"
#include "dual-cdc/dual-cdc-descriptors.h"
#include "usb-glue.h"
Expand Down Expand Up @@ -247,6 +250,9 @@ void tud_cdc_line_coding_cb(uint8_t interface, cdc_line_coding_t const* p_line_c
#include <esp_log.h>
#include <esp_check.h>

#define GPIO_FUNC_IN_HIGH 0x38
#define GPIO_FUNC_IN_LOW 0x3C

static void usb_hal_init_pins(usb_hal_context_t* usb) {
/* usb_periph_iopins currently configures USB_OTG as USB Device.
* Introduce additional parameters in usb_hal_context_t when adding support
Expand Down Expand Up @@ -274,7 +280,7 @@ static void usb_hal_init_pins(usb_hal_context_t* usb) {

static void usb_hal_bus_reset() {
gpio_config_t io_conf;
io_conf.intr_type = GPIO_PIN_INTR_DISABLE;
io_conf.intr_type = GPIO_INTR_DISABLE;
io_conf.mode = GPIO_MODE_OUTPUT_OD;
io_conf.pin_bit_mask = ((1 << USBPHY_DM_NUM) | (1 << USBPHY_DP_NUM));
io_conf.pull_down_en = GPIO_PULLDOWN_ENABLE;
Expand Down Expand Up @@ -443,6 +449,9 @@ size_t usb_glue_gdb_receive(uint8_t* buf, size_t len) {
void usb_glue_dap_send(const uint8_t* buf, size_t len, bool flush) {
if(usb_device_type == USBDeviceTypeDapLink) {
tud_vendor_write(buf, len);
if(flush) {
tud_vendor_write_flush();
}
} else {
esp_system_abort("Wrong USB device type");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ void usb_glue_dap_send(const uint8_t* buf, size_t len, bool flush);

void usb_glue_dap_set_receive_callback(void (*callback)(void* context), void* context);

size_t usb_glue_dap_receive(uint8_t* buf, size_t len);
size_t usb_glue_dap_receive(uint8_t* buf, size_t len);
7 changes: 7 additions & 0 deletions components/usbglue/idf_component.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## IDF Component Manager Manifest File
dependencies:
## Required IDF version
idf:
version: ">=4.1.0"
tinyusb:
version: "==0.15.0~3"
21 changes: 21 additions & 0 deletions dependencies.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
dependencies:
espressif/mdns:
component_hash: 31117d76cae83a6d83ffd7f035f6fdae5bd05b914fc30b641afeb208b84de19a
source:
service_url: https://api.components.espressif.com/
type: service
version: 1.3.2
espressif/tinyusb:
component_hash: 256fd8aee92ae9f1014538b8601508907a2da386b64f6d42f35a67f9288d1b20
source:
service_url: https://api.components.espressif.com/
type: service
version: 0.15.0~9
idf:
component_hash: null
source:
type: idf
version: 5.0.0
manifest_hash: 04b3564edaaf5e6104c57c153c7731c16711f464deb0b5ef2fd604b5c46a79bc
target: esp32s2
version: 1.0.0
2 changes: 1 addition & 1 deletion main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ message(STATUS "FW branch num: ${FW_GIT_BRANCH_NUM}")
message(STATUS "FW version: ${FW_GIT_VERSION}")

set_property(SOURCE "cli/cli-commands-device-info.c" APPEND PROPERTY COMPILE_OPTIONS ${INFO_FLAGS})
set_property(SOURCE "network-http.c" APPEND PROPERTY COMPILE_OPTIONS ${INFO_FLAGS})
set_property(SOURCE "network-http.c" APPEND PROPERTY COMPILE_OPTIONS ${INFO_FLAGS})
7 changes: 6 additions & 1 deletion main/cli/cli-commands-config.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,12 @@ void cli_nvs_dump(Cli* cli, mstring_t* args) {
cli_write_eol(cli);

do {
nvs_iterator_t it = nvs_entry_find(partitions[i], NULL, NVS_TYPE_ANY);
nvs_iterator_t it;
if(nvs_entry_find(partitions[i], NULL, NVS_TYPE_ANY, &it) != ESP_OK) {
cli_write_str(cli, "ERR");
cli_write_eol(cli);
break;
}
while(it != NULL) {
nvs_entry_info_t info;
nvs_entry_info(it, &info);
Expand Down
3 changes: 2 additions & 1 deletion main/cli/cli-commands-device-info.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <gdb-glue.h>
#include <esp_mac.h>
#include <esp_system.h>
#include "esp_chip_info.h"

void cli_device_info(Cli* cli, mstring_t* args) {
uint8_t mac_addr[8] = {0};
Expand Down Expand Up @@ -156,4 +157,4 @@ void cli_device_info(Cli* cli, mstring_t* args) {
cli,
"chip_feature_IEEE802154: %s",
(chip_info.features & CHIP_FEATURE_IEEE802154) ? "true" : "false");
}
}
Loading