Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c3b1908

Browse files
committed
both stm32 and esp32s2 enumerated
1 parent fd45127 commit c3b1908

7 files changed

Lines changed: 49 additions & 48 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/ports/*/_build/
12
/ports/*/build/
23
/sdkconfig
34
.settings/

ports/esp32s2/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ if(NOT (DEFINED BOARD AND EXISTS "${CMAKE_SOURCE_DIR}/components/boards/${BOARD}
2020
message(FATAL_ERROR "Invalid BOARD specified")
2121
endif()
2222

23-
set(EXTRA_COMPONENT_DIRS "../../src")
23+
# TOP is absolute path to root directory
24+
set(TOP "../..")
25+
get_filename_component(TOP "${TOP}" REALPATH)
26+
27+
set(EXTRA_COMPONENT_DIRS "${TOP}/src")
2428

2529
set(SDKCONFIG_DEFAULTS sdkconfig.defaults components/boards/${BOARD}/sdkconfig)
2630
set(SDKCONFIG build/sdkconfig)

ports/esp32s2/Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Espressif IDF use CMake build system, this add wrapper target to call idf.py
2+
3+
.PHONY: all clean flash
4+
.DEFAULT_GOAL := all
5+
6+
# Build directory
7+
BUILD = _build/build-$(BOARD)
8+
9+
all:
10+
idf.py -B$(BUILD) -DBOARD=$(BOARD) build
11+
12+
clean:
13+
idf.py -B$(BUILD) -DBOARD=$(BOARD) clean
14+
15+
flash:
16+
idf.py -B$(BUILD) -DBOARD=$(BOARD) flash

ports/esp32s2/components/tinyusb/CMakeLists.txt

Lines changed: 0 additions & 25 deletions
This file was deleted.
File renamed without changes.

ports/rules.mk

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,7 @@
11
# ---------------------------------------
2-
# Common make rules for all examples
2+
# Common make rules for all
33
# ---------------------------------------
44

5-
ifeq ($(CROSS_COMPILE),xtensa-esp32s2-elf-)
6-
# Espressif IDF use CMake build system, this add wrapper target to call idf.py
7-
8-
.PHONY: all clean flash
9-
.DEFAULT_GOAL := all
10-
11-
all:
12-
idf.py -B$(BUILD) -DBOARD=$(BOARD) build
13-
14-
clean:
15-
idf.py -B$(BUILD) -DBOARD=$(BOARD) clean
16-
17-
flash:
18-
idf.py -B$(BUILD) -DBOARD=$(BOARD) flash
19-
20-
else
21-
# GNU Make build system
22-
235
# libc
246
LIBS += -lgcc -lm -lnosys -lc
257

@@ -31,6 +13,7 @@ ifeq ($(BOARD), msp_exp430f5529lp)
3113
else
3214
LDFLAGS += $(CFLAGS) -fshort-enums -Wl,-T,$(TOP)/$(LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections -specs=nosys.specs -specs=nano.specs
3315
endif
16+
3417
ASFLAGS += $(CFLAGS)
3518

3619
# Assembly files can be name with upper case .S, convert it to .s
@@ -144,5 +127,3 @@ flash-stlink: $(BUILD)/$(BOARD)-firmware.elf
144127
flash-pyocd: $(BUILD)/$(BOARD)-firmware.hex
145128
pyocd flash -t $(PYOCD_TARGET) $<
146129
pyocd reset -t $(PYOCD_TARGET)
147-
148-
endif # Make target

src/CMakeLists.txt

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
11
idf_component_register(SRCS ghostfat.c images.c main.c msc.c screen.c usb_descriptors.c
22
INCLUDE_DIRS "."
3-
REQUIRES app_update boards led_strip spi_flash tinyusb lcd)
3+
REQUIRES app_update boards led_strip spi_flash lcd)
4+
5+
idf_component_get_property( FREERTOS_ORIG_INCLUDE_PATH freertos ORIG_INCLUDE_PATH)
6+
7+
target_include_directories(${COMPONENT_TARGET} PUBLIC
8+
"${FREERTOS_ORIG_INCLUDE_PATH}"
9+
"${TOP}/lib/tinyusb/src"
10+
"${TOP}/ports/esp32s2"
11+
)
12+
13+
target_sources(${COMPONENT_TARGET} PUBLIC
14+
"${TOP}/lib/tinyusb/src/tusb.c"
15+
"${TOP}/lib/tinyusb/src/common/tusb_fifo.c"
16+
"${TOP}/lib/tinyusb/src/device/usbd.c"
17+
"${TOP}/lib/tinyusb/src/device/usbd_control.c"
18+
"${TOP}/lib/tinyusb/src/class/cdc/cdc_device.c"
19+
"${TOP}/lib/tinyusb/src/class/dfu/dfu_rt_device.c"
20+
"${TOP}/lib/tinyusb/src/class/hid/hid_device.c"
21+
"${TOP}/lib/tinyusb/src/class/midi/midi_device.c"
22+
"${TOP}/lib/tinyusb/src/class/msc/msc_device.c"
23+
"${TOP}/lib/tinyusb/src/class/net/net_device.c"
24+
"${TOP}/lib/tinyusb/src/class/usbtmc/usbtmc_device.c"
25+
"${TOP}/lib/tinyusb/src/class/vendor/vendor_device.c"
26+
"${TOP}/lib/tinyusb/src/portable/espressif/esp32s2/dcd_esp32s2.c"
27+
)

0 commit comments

Comments
 (0)