summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/device/board_test/CMakeLists.txt13
-rw-r--r--examples/make.mk2
-rw-r--r--examples/rules.mk28
3 files changed, 28 insertions, 15 deletions
diff --git a/examples/device/board_test/CMakeLists.txt b/examples/device/board_test/CMakeLists.txt
index c09ffe215..ee0d7ef58 100644
--- a/examples/device/board_test/CMakeLists.txt
+++ b/examples/device/board_test/CMakeLists.txt
@@ -1,15 +1,16 @@
-# The following five 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.5)
# TOP is absolute path to root directory of TinyUSB git repo
set(TOP "../../..")
get_filename_component(TOP "${TOP}" REALPATH)
-# Add example src and bsp directories
-set(EXTRA_COMPONENT_DIRS "src" "${TOP}/hw/bsp/esp32s2/boards" "${TOP}/hw/bsp/esp32s2/components")
+# Check for -DFAMILY=
+if(NOT DEFINED FAMILY)
+ message(FATAL_ERROR "Invalid FAMILY specified")
+endif()
-include($ENV{IDF_PATH}/tools/cmake/project.cmake)
-set(SUPPORTED_TARGETS esp32s2)
+include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
project(board_test)
+
+include(${TOP}/hw/bsp/${FAMILY}/family_extra.cmake OPTIONAL)
diff --git a/examples/make.mk b/examples/make.mk
index bf3b36a62..da0f60d2f 100644
--- a/examples/make.mk
+++ b/examples/make.mk
@@ -40,7 +40,7 @@ ifeq ($(FAMILY),)
include $(TOP)/hw/bsp/$(BOARD)/board.mk
else
# Include Family and Board specific defs
- include $(TOP)/$(FAMILY_PATH)/family.mk
+ -include $(TOP)/$(FAMILY_PATH)/family.mk
SRC_C += $(subst $(TOP)/,,$(wildcard $(TOP)/$(FAMILY_PATH)/*.c))
endif
diff --git a/examples/rules.mk b/examples/rules.mk
index fb1fe76c2..b61af1d55 100644
--- a/examples/rules.mk
+++ b/examples/rules.mk
@@ -2,34 +2,46 @@
# Common make rules for all examples
# ---------------------------------------
-ifeq ($(CROSS_COMPILE),xtensa-esp32s2-elf-)
+ifeq ($(FAMILY),esp32s2)
# Espressif IDF use CMake build system, this add wrapper target to call idf.py
.PHONY: all clean flash
.DEFAULT_GOAL := all
all:
- idf.py -B$(BUILD) -DBOARD=$(BOARD) build
+ idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) build
build: all
clean:
- idf.py -B$(BUILD) -DBOARD=$(BOARD) clean
+ idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) clean
+
+fullclean:
+ idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) fullclean
flash:
- idf.py -B$(BUILD) -DBOARD=$(BOARD) flash
+ idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) flash
bootloader-flash:
- idf.py -B$(BUILD) -DBOARD=$(BOARD) bootloader-flash
+ idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) bootloader-flash
app-flash:
- idf.py -B$(BUILD) -DBOARD=$(BOARD) app-flash
+ idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) app-flash
erase:
- idf.py -B$(BUILD) -DBOARD=$(BOARD) erase_flash
+ idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) erase_flash
monitor:
- idf.py -B$(BUILD) -DBOARD=$(BOARD) monitor
+ idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) monitor
+
+else ifeq ($(FAMILY),rp2040)
+
+all:
+ [ -d $(BUILD) ] || cmake -S . -B $(BUILD) -DFAMILY=$(FAMILY) -DPICO_BUILD_DOCS=0
+ $(MAKE) -C $(BUILD)
+
+clean:
+ $(RM) -rf $(BUILD)
else
# GNU Make build system