Skip to content

Commit

Permalink
processing menu-items automatically (#35)
Browse files Browse the repository at this point in the history
* processing menu-items automatically

* remove echo
  • Loading branch information
jscrane authored May 18, 2023
1 parent ce3e41c commit 6de6310
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 16 deletions.
2 changes: 0 additions & 2 deletions avr.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ PROCESSOR_FAMILY := avr

-include hardware.mk

$(call define-menu-variables,cpu)

serial.port := $(SERIAL_PORT)
upload.verbose := $(tools.$(upload.tool).upload.params.$(UPLOAD_VERBOSE))
upload.verify := $(UPLOAD_VERIFY)
Expand Down
2 changes: 0 additions & 2 deletions esp32.mk
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ build.target := esp32
# this is required for recipel.hooks.prebuild.4.pattern (but shouldn't be)
tools.esptool_py.cmd := $(call os-override,tools.esptool_py.cmd)

$(call define-menus,JTAGAdapter PSRAM PartitionScheme CPUFreq FlashMode FlashFreq FlashSize UploadSpeed LoopCore EventsCore DebugLevel EraseFlash)

SUFFIX_EEP := partitions.bin

-include build-targets.mk
Expand Down
2 changes: 0 additions & 2 deletions esp8266.mk
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ PROCESSOR_FAMILY := esp8266

-include hardware.mk

$(call define-menus,xtal vt exception stacksmash ssl mmu non32xfer ResetMethod CrystalFreq FlashFreq FlashMode eesz led sdk ip dbg lvl wipe baud)

# ???
upload.maximum_size := $(menu.eesz.autoflash.upload.maximum_size)
upload.verbose = $(tools.$(upload.tool).upload.params.$(UPLOAD_VERBOSE))
Expand Down
8 changes: 5 additions & 3 deletions hardware.mk
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ $1 = $2
endef

define define-prefix-variables
$(foreach v, $(filter $1.%, $(.VARIABLES)), $(eval $(call define-variable,$(v:$1.%=%), $($(v)))))
$(foreach v,$(filter $1.%, $(.VARIABLES)), $(eval $(call define-variable,$(v:$1.%=%),$($(v)))))
endef

define define-menu-variables
$(call define-prefix-variables,menu.$1.$($(shell echo $1 | tr a-z A-Z)))
$(call define-prefix-variables,$(BOARD).menu.$1.$($(shell echo $1 | tr a-z A-Z)))
endef

define define-menus
Expand All @@ -57,13 +57,15 @@ endef

$(call define-prefix-variables,$(BOARD))

$(call define-menus,$(foreach m,$(filter menu.%,$(.VARIABLES)),$(m:menu.%=%)))

SKETCH ?= $(wildcard *.ino)
COMPILER_WARNINGS ?= default

build.project_name := $(SKETCH)
build.arch := $(PROCESSOR_FAMILY)
build.fqbn := $(VENDOR):$(PROCESSOR_FAMILY):$(BOARD)
build.core.path := $(runtime.platform.path)/cores/$(build.core)
build.core.path = $(runtime.platform.path)/cores/$(build.core)
build.variant.path = $(runtime.platform.path)/variants/$(build.variant)
build.system.path = $(runtime.platform.path)/system
build.path := .build
Expand Down
8 changes: 1 addition & 7 deletions tiny.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ COMPILER_PATH := $(lastword $(wildcard $(PACKAGES)/arduino/tools/$(COMPILER_FAMI

runtime.tools.$(COMPILER_FAMILY).path := $(COMPILER_PATH)

-include hardware.mk

# menus
PINMAPPING ?= anew
LTO ?= enable
Expand All @@ -26,11 +24,7 @@ EESAVE ?= aenable
MILLIS ?= enabled
NEOPIXELPORT ?= porta

CHIP := $(firstword $(chip) $(CHIP))
CLOCK := $(firstword $(clock) $(CLOCK))
PINMAPPING := $(firstword $(pinmapping) $(PINMAPPING))

$(call define-menus,chip clock pinmapping LTO bod eesave millis neopixelport)
-include hardware.mk

serial.port := $(SERIAL_PORT)
upload.verbose := $(tools.$(upload.tool).upload.params.$(UPLOAD_VERBOSE))
Expand Down

0 comments on commit 6de6310

Please sign in to comment.