Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# uC-Makefile

A Makefile for popular Microcontrollers supporting Energia (msp430 and
tivac boards) and Arduino-1.8.x (avr, attiny, esp8266 and esp32 boards).
A Makefile for popular Microcontrollers supporting Arduino-2.3.x (avr, attiny, esp8266, esp32 and pico boards).

If:
- You'd prefer to be using vi or emacs to the Arduino IDE
Expand Down Expand Up @@ -42,15 +41,19 @@ See the [documentation](docs/README.md).
- [avr](https://github.com/arduino/ArduinoCore-avr), 1.8.6
- [attiny](https://github.com/SpenceKonde/ATTinyCore), 1.5.2
- Arduino [esp8266](https://github.com/esp8266/Arduino), 3.1.2
- Arduino [esp32](https://github.com/espressif/arduino-esp32), 2.0.17
- Energia [tivac](https://github.com/energia/tivac-core), 1.0.4 (requires editing SD.h for Stellarpad)
- Arduino [esp32](https://github.com/espressif/arduino-esp32), 3.3.7
- [stm32](https://github.com/stm32duino/Arduino_Core_STM32), 2.6.0
- [rp2040](https://github.com/earlephilhower/arduino-pico), 5.4.4
- Energia [tivac](https://github.com/energia/tivac-core), 1.0.4
- Energia [msp430](https://github.com/energia/msp430-lg-core), 1.0.7
- [stm32](https://github.com/stm32duino/Arduino_Core_STM32), 2.5.0
- [rp2040](https://github.com/earlephilhower/arduino-pico), 4.1.1 (new!)

Note: Energia is no longer developed. Its cores are now integrated with Arduino via
[this repository](https://github.com/Andy4495/TI_Platform_Cores_For_Arduino).

## Dependencies

`uC-Makefile` requires `pcre2grep` to be installed.

## Credits

- elpaso's [Makefile](https://github.com/elpaso/energia-makefile) for msp430 provided inspiration.
Expand Down
9 changes: 6 additions & 3 deletions build-targets.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ DEPS := $(foreach s,$(OBJECTS), $(s:.o=.d))

TERMINAL ?= minicom
TERMINAL_FLAGS ?= -D $(SERIAL_PORT) -b $(TERMINAL_SPEED) $(TERMINAL_EXTRA_FLAGS)
CPPFLAGS += -DTERMINAL_SPEED=$(TERMINAL_SPEED)
CPPFLAGS += -DTERMINAL_SPEED=$(TERMINAL_SPEED) -DBOARD=$(BOARD)

SKETCHBOOK ?= $(HOME)/Arduino
LIBRARY_PATH := $(LOCAL_LIBRARY_PATH) $(SKETCHBOOK)/libraries $(runtime.platform.path)/libraries
Expand Down Expand Up @@ -178,6 +178,9 @@ $(build.path):
build-variables:
$(foreach v, $(sort $(filter build.%, $(.VARIABLES))), $(info $(v) = $($(v))))

menu-variables:
$(foreach v, $(sort $(filter menu.%, $(.VARIABLES))), $(info $(v) = $($(v))))

PREBUILD_HOOKS := $(sort $(filter recipe.hooks.prebuild.%.pattern, $(.VARIABLES)))

$(foreach h,$(PREBUILD_HOOKS), $(eval $(call define-hook,$h)))
Expand All @@ -195,10 +198,10 @@ term:
$(TERMINAL) $(TERMINAL_FLAGS)

build-summary:
$(eval FLASH_SIZE = $(shell $(recipe.size.pattern) | pcregrep -o1 "$(recipe.size.regex)" | paste -sd "+" | bc))
$(eval FLASH_SIZE = $(shell $(recipe.size.pattern) | pcre2grep -o1 "$(recipe.size.regex)" | paste -sd "+" | bc))
$(eval FLASH_PC = $(shell echo $(FLASH_SIZE) "* 100 /" $(upload.maximum_size) | bc))
@echo program: $(FLASH_SIZE) / $(upload.maximum_size) bytes \($(FLASH_PC)%\)
$(eval DATA_SIZE = $(shell $(recipe.size.pattern) | pcregrep -o1 "$(recipe.size.regex.data)" | paste -sd "+" | bc))
$(eval DATA_SIZE = $(shell $(recipe.size.pattern) | pcre2grep -o1 "$(recipe.size.regex.data)" | paste -sd "+" | bc))
$(eval DATA_PC = $(shell echo $(DATA_SIZE) "* 100 /" $(upload.maximum_data_size) | bc))
@echo data: $(DATA_SIZE) / $(upload.maximum_data_size) bytes \($(DATA_PC)%\)

Expand Down
26 changes: 18 additions & 8 deletions docs/avr.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ when the programmer is `avrdude` there are some extra targets:
### avr

menu options:
- CPU: the chip (and clock speed) of the cpu, if required by the chosen board
- cpu: the chip (and clock speed) of the cpu, if required by the chosen board

other variables and their defaults:
- UPLOAD_VERBOSE: `quiet` (`verbose`)
Expand All @@ -24,14 +24,24 @@ other variables and their defaults:
### attiny

menu options:
- CHIP: _mandatory_
- CLOCK: _mandatory_
- PINMAPPING: anew (old)
- chip: _mandatory_
- clock: _mandatory_
- sketchclock: depends on board
- pinmapping: anew (old)
- INITIALIZE_SECONDARY_TIMERS: 0 (1)
- TimerClockSource: default (pll, lowpll)
- LTO: enable (disable)
- BOD: 1v8 (2v7, 4v3)
- EESAVE: aenable (disable)
- MILLIS: enable (disable)
- NEOPIXELPORT: porta (portb)
- wiremode: amaster (slave, both)
- neopixelport: porta (portb, portc, portd)
- millis: enable (disable)
- burnmode: upgrade (install)
- bootentry: always (safereset, fastpoweron, saferesetwdt, fastpoweronwdt, notwdt, aggressive)
- resetpin: reset (gpio)
- bootUART: UART0 (UART1)
- eesave: aenable (disable)
- bod: 1v8 (2v7, 4v3)
- bodact: disabled (enabled, sampled)
- bodpd: disabled (enabled)

other variables:
- UPLOAD_VERBOSE: `quiet` (`verbose`)
Expand Down
60 changes: 30 additions & 30 deletions docs/esp.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
### esp8266

menu options:
- XTAL: 80 (160)
- VT: flash (heap, iram)
- EXCEPTION: disabled (enabled)
- STACKSMASH: disabled (enabled)
- SSL: all (basic)
- MMU: 3232 (4816, 4816H, 3216, ext128k, ext8192k)
- NON32XFER: fast (safe)
- RESETMETHOD: nodemcu (ck, nodtr_nosync)
- CRYSTALFREQ: 26 (40)
- FLASHFREQ: 40 (80, 20, 26)
- FLASHMODE: dout (dio, quot, qio)
- EESZ: _mandatory_ (1M64, 1M128, 1M144, 1M160, 1M192, 1M256, 1M512, 1M, 2M64, 2M128, 2M256, 2M512, 2M1M, 2M, 4M2M, 4M3M, 4M1M, 4M,
- xtal: 80 (160)
- vt: flash (heap, iram)
- exception: disabled (enabled)
- stacksmash: disabled (enabled)
- ssl: all (basic)
- mmu: 3232 (4816, 4816H, 3216, ext128k, ext8192k)
- non32xfer: fast (safe)
- ResetMethod: nodemcu (ck, nodtr_nosync)
- CrystalFreq: 26 (40)
- FlashFreq: 40 (80, 20, 26)
- FlashMode: dout (dio, quot, qio)
- eesz: _mandatory_ (1M64, 1M128, 1M144, 1M160, 1M192, 1M256, 1M512, 1M, 2M64, 2M128, 2M256, 2M512, 2M1M, 2M, 4M2M, 4M3M, 4M1M, 4M,
8M6M, 8M7M, 8M, 16M14M, 16M15M, 16M, 512K32, 512K64, 512K128, 512K)
- LED: 2 (0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)
- SDK: nonosdk_190703 (nonosdk_191122, nonosdk_191105, nonosdk_191024, nonosdk_190313, nonosdk221, nonosdk305)
- IP: lm2f (hb2f, lm2n, hb2n, lm6f, hb6f, hb1)
- DBG: Disabled (Serial, Serial1)
- LVL: None____ (SSL, TLS_MEM, HTTP_CLIENT, HTTP_SERVER, SSLTLS_MEM, SSLHTTP_CLIENT, SSLHTTP_SERVER, TLS_MEMHTTP_CLIENT, TLS_MEMHTTP_SERVER, HTTP_CLIENTHTTP_SERVER,
- led: 2 (0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)
- sdk: nonosdk_190703 (nonosdk_191122, nonosdk_191105, nonosdk_191024, nonosdk_190313, nonosdk221, nonosdk305)
- ip: lm2f (hb2f, lm2n, hb2n, lm6f, hb6f, hb1)
- dbg: Disabled (Serial, Serial1)
- lvl: None____ (SSL, TLS_MEM, HTTP_CLIENT, HTTP_SERVER, SSLTLS_MEM, SSLHTTP_CLIENT, SSLHTTP_SERVER, TLS_MEMHTTP_CLIENT, TLS_MEMHTTP_SERVER, HTTP_CLIENTHTTP_SERVER,
SSLTLS_MEMHTTP_CLIENT, SSLTLS_MEMHTTP_SERVER, SSLHTTP_CLIENTHTTP_SERVER, TLS_MEMHTTP_CLIENTHTTP_SERVER, SSLTLS_MEMHTTP_CLIENTHTTP_SERVER, HTTP_UPDATE,
CORE, WIFI, UPDATER, OTA, OOM, MDNS, HWDT, COREWIFIHTTP_UPDATEUPDATEROTAOOMMDNS, COREWIFIHTTP_UPDATEUPDATEROTAOOMMDNSHWDT,
COREWIFIHTTP_UPDATEUPDATEROTAOOMMDNSHWDT_NOEXTRA4K, SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOMMDNS,
SLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOMMDNSHWDT, SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOMMDNSHWDT_NOEXTRA4K,
NoAssert-NDEBUG)
- WIPE: none (sdk, all)
- BAUD: 115200 (57600, 230400, 256000, 460800, 512000, 921600, 3000000)
- wipe: none (sdk, all)
- baud: 115200 (57600, 230400, 256000, 460800, 512000, 921600, 3000000)

other variables:
- UPLOAD_VERBOSE: quiet
Expand All @@ -46,18 +46,18 @@ targets:
### esp32

menu options:
- JTAGADAPTER: default (external, bridge)
- JTAGAdapter: default (external, bridge)
- PSRAM: disabled (enabled)
- PARTITIONSCHEME: default (minimal, no_ota, noota_3g, noota_ffat, noota_3gffat, huge_app, min_spiffs, fatflash, app3M_fat9M_16MB, rainmaker)
- CPUFREQ: 240 (160, 80, 40, 26, 20, 13, 10)
- FLASHMODE: qio (dio, qout, dout)
- FLASHFREQ: 80 (40)
- FLASHSIZE: 4M (8M, 2M, 16M)
- UPLOADSPEED: 921600 (115200, 256000, 230400, 460800, 512000)
- LOOPCORE: 1 (0)
- EVENTSCORE: 1 (0)
- DEBUGLEVEL: none (error, warn, info, debug, verbose)
- ERASEFLASH: none (all)
- PartitionScheme: default (minimal, no_ota, noota_3g, noota_ffat, noota_3gffat, huge_app, min_spiffs, fatflash, app3M_fat9M_16MB, rainmaker)
- CPUFreq: 240 (160, 80, 40, 26, 20, 13, 10)
- FlashMode: qio (dio, qout, dout)
- FlashFreq: 80 (40)
- FlashSize: 4M (8M, 2M, 16M)
- UploadSpeed: 921600 (115200, 256000, 230400, 460800, 512000)
- LoopCore: 1 (0)
- EventsCore: 1 (0)
- DebugLevel: none (error, warn, info, debug, verbose)
- EraseFlash: none (all)

other variables:
- FS_DIR: data
Expand Down
33 changes: 21 additions & 12 deletions docs/rp2040.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
### rp2040

menu items:
- FLASH: _mandatory_
- FREQ: ```133``` (```50```, ```120```, ```125```, ```128```, ```150```, ```175```, ```200```, ```225```, ```240```, ```250```, ```276```, ```300``` )
- OPT: ```Small``` (```Optimize```, ```Optimize2```, ```Optimize3```, ```Fast```, ```Debug```)
- RTTI: ```Disabled``` (```Enabled```)
- STACKPROTECT: ```Disabled``` (```Enabled```)
- EXCEPTIONS: ```Disabled``` (```Enabled```)
- DBGPORT: ```Disabled``` (```Serial```, ```Serial1```, ```Serial2```)
- DBGLVL: ```None``` (```Core```, ```SPI```, ```Wire```, ```Bluetooth```, ```All```, ```NDEBUG```)
- USBSTACK: ```picousb``` (```tinyusb```, ```nousb```)
- IPBTSTACK: ```ipv4only``` (```ipv4ipv6```, ```ipv4btcble```, ```ipv4ipv6btcble```, ```ipv4onlybig```, ```ipv4ipv6big```, ```ipv4btcblebig```, ```ipv4ipv6btcblebig```)
- BOOT2: ```boot2_w25q080_2_padded_checksum``` (```boot2_w25q080_4_padded_checksum```)
- UPLOADMETHOD: ```default``` (```picotool```, ```picoprobe_cmsis_dap```)
- BoardModel
- variantchip: ```RP2350A``` (```RP2530B```)
- flash: _mandatory_
- psramcs: ```GPIOnone``` (```GPIO0```, etc)
- psram: ```0mb``` (```2mb```, ```4mb```, ```8mb```)
- psramfreq: ```freq109``` (```freq133```)
- freq: ```133``` (```50```, ```120```, ```125```, ```128```, ```150```, ```175```, ```200```, ```225```, ```240```, ```250```, ```276```, ```300``` )
- arch: ```arm``` (```riscv```)
- opt: ```Small``` (```Optimize```, ```Optimize2```, ```Optimize3```, ```Fast```, ```Debug```)
- os: ```none``` (```freertos```)
- profile: ```Disabled``` (```Enabled```)
- rtti: ```Disabled``` (```Enabled```)
- stackprotect: ```Disabled``` (```Enabled```)
- exceptions: ```Disabled``` (```Enabled```)
- dbgport: ```Disabled``` (```Serial```, ```Serial1```, ```Serial2```)
- dbglvl: ```None``` (```Core```, ```SPI```, ```Wire```, ```Bluetooth```, ```All```, ```NDEBUG```)
- boot2: ```boot2_w25q080_2_padded_checksum``` (```boot2_w25q080_4_padded_checksum```)
- wificountry
- usbstack: ```picousb``` (```tinyusb```, ```nousb```)
- ipbtstack: ```ipv4only``` (```ipv4ipv6```, ```ipv4btcble```, ```ipv4ipv6btcble```, ```ipv4onlybig```, ```ipv4ipv6big```, ```ipv4btcblebig```, ```ipv4ipv6btcblebig```)
- uploadmethod: ```default``` (```picotool```, ```picoprobe_cmsis_dap```)

other variables:
- SERIAL_PORT: ```/dev/ttyACM0```
Expand Down
17 changes: 9 additions & 8 deletions docs/stm32.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
### stm32

menu items:
- PNUM: _mandatory_
- XSERIAL: ```generic``` (```none```, ```disabled```)
- USB: ```CDCgen``` (```none```, ```CDC```, ```HID```)
- XUSB: ```FS``` (```HS```, ```HSFS```)
- OPT: ```osstd``` (```oslto```, ```o1std```, ```o1lto```, ```o2std```, ```o2lto```, ```o3std```, ```o3lto```, ```ogstd```, ```o0std```)
- DBG: ```none``` (```enable_sym```, ```enable_log```, ```enable_all```)
- RTLIB: ```nano``` (```nanofp```, ```nanofs```, ```nanofps```, ```full```)
- UPLOAD_METHOD: ```dfu2Method``` (```swdMethod```, ```dfuMethod```, ```bmpMethod```, ```hidMethod```, ```serialMethod```, ```dfuoMethod```)
- pnum: _mandatory_
- xserial: ```generic``` (```none```, ```disabled```)
- usb: ```CDCgen``` (```none```, ```CDC```, ```HID```)
- xusb: ```FS``` (```HS```, ```HSFS```)
- virtio: ```disable``` (```generic```, ```enabled```)
- opt: ```osstd``` (```oslto```, ```o1std```, ```o1lto```, ```o2std```, ```o2lto```, ```o3std```, ```o3lto```, ```ogstd```, ```o0std```)
- dbg: ```none``` (```enable_sym```, ```enable_log```, ```enable_all```)
- rtlib: ```nano``` (```nanofp```, ```nanofs```, ```nanofps```, ```full```)
- upload_method: ```dfu2Method``` (```swdMethod```, ```dfuMethod```, ```bmpMethod```, ```hidMethod```, ```serialMethod```, ```dfuoMethod```)

other variables:
- SERIAL_PORT: ```/dev/ttyACM0```
Expand Down
22 changes: 11 additions & 11 deletions esp32.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ SPIFFS_IMAGE ?= spiffs.img
LITTLEFS_IMAGE ?= littlefs.img

# menus
JTAGADAPTER ?= default
JTAGAdapter ?= default
PSRAM ?= disabled
PARTITIONSCHEME ?= default
CPUFREQ ?= 240
FLASHMODE ?= qio
FLASHFREQ ?= 80
FLASHSIZE ?= 4M
UPLOADSPEED ?= 921600
LOOPCORE ?= 1
EVENTSCORE ?= 1
DEBUGLEVEL ?= none
ERASEFLASH ?= none
PartitionScheme ?= default
CPUFreq ?= 240
FlashMode ?= qio
FlashFreq ?= 80
FlashSize ?= 4M
UploadSpeed ?= 921600
LoopCore ?= 1
EventsCore ?= 1
DebugLevel ?= none
EraseFlash ?= none

VENDOR := esp32
PROCESSOR_FAMILY := esp32
Expand Down
43 changes: 21 additions & 22 deletions esp8266.mk
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
ifndef EESZ
$(error EESZ required)
endif

UPLOAD_VERBOSE ?= quiet
SERIAL_PORT ?= /dev/ttyUSB0
FS_DIR ?= data
SPIFFS_IMAGE ?= spiffs.img
LITTLEFS_IMAGE ?= littlefs.img

# menus
XTAL ?= 80
VT ?= flash
EXCEPTION ?= disabled
STACKSMASH ?= disabled
SSL ?= all
MMU ?= 3232
NON32XFER ?= fast
RESETMETHOD ?= nodemcu
CRYSTALFREQ ?= 26
FLASHFREQ ?= 40
FLASHMODE ?= dout
LED ?= 2
SDK ?= nonosdk_190703
IP ?= lm2f
DBG ?= Disabled
LVL ?= None____
WIPE ?= none
BAUD ?= 115200
led ?= 2
baud ?= 115200
xtal ?= 80
CrystalFreq ?= 26
ifndef eesz
$(error eesz required)
endif
FlashMode ?= dout
FlashFreq ?= 40
ResetMethod ?= nodemcu
dbg ?= Disabled
lvl ?= None____
ip ?= lm2f
vt ?= flash
exception ?= disabled
stacksmash ?= disabled
wipe ?= none
sdk ?= nonosdk_190703
ssl ?= all
mmu ?= 3232
non32xfer ?= fast

VENDOR := esp8266
PROCESSOR_FAMILY := esp8266
Expand Down
2 changes: 1 addition & 1 deletion hardware.mk
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ $(foreach v,$(filter $1.%, $(.VARIABLES)), $(eval $(call define-variable,$(v:$1.
endef

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

define define-menus
Expand Down
35 changes: 20 additions & 15 deletions rp2040.mk
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
ifndef FLASH
$(error FLASH required)
endif

SERIAL_PORT ?= /dev/ttyACM0
LITTLEFS_IMAGE ?= littlefs.bin
FS_DIR ?= data

VENDOR := rp2040
PROCESSOR_FAMILY := rp2040

FREQ ?= 133
OPT ?= Small
RTTI ?= Disabled
STACKPROTECT ?= Disabled
EXCEPTIONS ?= Disabled
DBGPORT ?= Disabled
DBGLVL ?= None
USBSTACK ?= picosdk
IPBTSTACK ?= ipv4only
BOOT2 ?= boot2_w25q080_2_padded_checksum
UPLOADMETHOD ?= default
ifndef flash
$(error flash required)
endif
freq ?= 133
psramcs ?= GPIOnone
psram ?= 0mb
psramfreq ?= freq109
arch ?= arm
opt ?= Small
os ?= none
profile ?= Disabled
rtti ?= Disabled
stackprotect ?= Disabled
exceptions ?= Disabled
dbgport ?= Disabled
dbglvl ?= None
boot2 ?= boot2_w25q080_2_padded_checksum
usbstack ?= picousb
ipbtstack ?= ipv4only
uploadmethod ?= default

-include hardware.mk

Expand Down
Loading