jscrane / uc-makefile Goto Github PK
View Code? Open in Web Editor NEWMakefile for Microcontrollers
License: GNU General Public License v2.0
Makefile for Microcontrollers
License: GNU General Public License v2.0
fs:
mkspiffs -c $(SPIFFS_DIR) -b $(SPIFFS_BLOCKSIZE) -p $(SPIFFS_PAGESIZE) -s $(SPIFFS_SIZE) $(IMAGE)
Move all of the different upload implementations into build-targets.mk
LWIP_OPTS ?= lm2f
LWIP_INC = $(shell sed -ne "s/$(BOARD).menu.ip.$(IP_OPTS).build.lwip_include=\(.*\)/\1/p" $(BOARDS))
LWIP_LIB = $(shell sed -ne "s/$(BOARD).menu.ip.$(IP_OPTS).build.lwip_lib=\(.*\)/\1/p" $(BOARDS))
LWIP_FLAGS = $(shell sed -ne "s/$(BOARD).menu.ip.$(IP_OPTS).build.lwip_flags=\(.*\)/\1/p" $(BOARDS))
clean up the output of "size" command: look at recipe.size.regex and friends in platform.txt
should be possible to use in stm32 Makefiles
BOARD := GenF1
PNUM := HY-TINY...
however there are issues with variable substitution around this.
.arduino15/preferences.txt
boardsmanager.additional.urls=http://arduino.esp8266.com/stable/package_esp8266com_index.json,https://dl.espressif.com/dl/package_esp32_index.json,http://drazzy.com/package_drazzy.com_index.json
(menu names are enumerated at the beginning of boards.txt
.)
There is usually only one choice, use that, maybe with a warning.
Have a single include for all architectures, with defines for each scoped by processor family.
Aim is to allow a single makefile to build a sketch for multiple architectures.
Should read and parse library.properties. Useful flags are, in order:
This would be a good solution to the problem of tracking changes in each release.
Simple preprocessing with sed allows it to be read into gnu make:
$ sed -e "s/{/\${/g" -e "/^\#/d" -e "/^$/d" < ~/.arduino15/packages/esp8266/hardware/esp8266/2.5.1/platform.txt
Problems:
/home/steve/sketchbook/hardware/esp8266com/esp8266/libraries/ESP8266WiFi/src/CertStoreSDBearSSL.cpp:20:16: fatal error: SD.h: No such file or directory
#include <SD.h>
^
compilation terminated.
ucmk.mk:78: recipe for target '.lib//home/steve/sketchbook/hardware/esp8266com/esp8266/libraries/ESP8266WiFi/src/CertStoreSDBearSSL.cpp.o' failed
... and esp32
... and attiny
add:
define define-menus
Starting with version 3.0.0, the esp32 core has refactored its libraries in a way which requires including a library's dependencies as well, e.g., to use WiFi
need to include its dependency Network
as well:
#include <Network.h>
#include <WiFi.h>
Otherwise the compilation will fail:
In file included from /home/steve/.arduino15/packages/esp32/hardware/esp32/3.0.1/libraries/WiFi/src/WiFiSTA.h:29,
from /home/steve/.arduino15/packages/esp32/hardware/esp32/3.0.1/libraries/WiFi/src/WiFi.h:33,
from Radar.ino:4:
/home/steve/.arduino15/packages/esp32/hardware/esp32/3.0.1/libraries/WiFi/src/WiFiGeneric.h:39:10: fatal error: Network.h: No such file or directory
39 | #include "Network.h"
| ^~~~~~~~~~~
compilation terminated.
make: *** [build-targets.mk:68: Radar.ino.cpp.o] Error 1
More information here.
Would like to specify the name as in the IDE:
BOARD_NAME := NodeMCU-32S
and derive BOARD from that.
Currently, like Arduino, libraries are determined by grepping for includes in the sketch.
It would be good to be able to preset REQUIRED_LIBS in the Makefile, and add to this by grepping as now.
Also rename LIBRARIES to LIBRARY_PATH, and allow adding to it. Then rename REQUIRED_LIBS to LIBRARIES.
Currently it's hardwired to minicom.
TERM ?= minicom
TERM_FLAGS ?= -D $(UPLOAD_PORT) -b $(TERM_SPEED)
term:
$(TERM) $(TERM_FLAGS)
TERM := screen
TERM_FLAGS := $(UPLOAD_PORT) $(TERM_SPEED) -ixon -ixoff
See the specification.
This is required for arduino-esp32 2.0.10.
`# Set -DARDUINO_CORE_BUILD only on core file compilation
file_opts.path={build.path}/file_opts
recipe.hooks.prebuild.set_core_build_flag.pattern=bash -c ": > {file_opts.path}"
recipe.hooks.core.prebuild.set_core_build_flag.pattern=bash -c "echo '-DARDUINO_CORE_BUILD' > {file_opts.path}"
recipe.hooks.core.postbuild.set_core_build_flag.pattern=bash -c ": > {file_opts.path}"
recipe.hooks.prebuild.set_core_build_flag.pattern.windows=cmd /c type nul > {file_opts.path}
recipe.hooks.core.prebuild.set_core_build_flag.pattern.windows=cmd /c echo "-DARDUINO_CORE_BUILD" > {file_opts.path}
recipe.hooks.core.postbuild.set_core_build_flag.pattern.windows=cmd /c type nul > {file_opts.path}
`
See here for example: https://github.com/jorgegarciadev/Arduino-Esp8266-Makefile
See here.
For detecting which libraries to include in the build, and for generating function prototypes, (just) the preprocessor is run. For this, the recipe.preproc.macros recipe exists. This recipe must run the preprocessor on a given source file, writing the preprocessed output to a given output file, and generate (only) preprocessor errors on standard output. This preprocessor run should happen with the same defines and other preprocessor-influencing-options as for normally compiling the source files.
This came to light trying to compile src/TommyPROM/HardwareVerify
: it fails due to a missing function prototype.
everything built goes into
.deps/
build/
Should follow the Arduino guidelines:
The source code found in src folder and all its subfolders is compiled and linked in the user’s sketch. Only the src folder is added to the include search path (both when compiling the sketch and the library). When the user imports a library into their sketch (from the "Tools > Import Library" menu), an #include statement will be added for all header (.h) files in the src/ directory (but not its subfolders).
also rename upload-fs
to upload-littlefs
for esp8266
also update documentation
It ought to be possible to automate away this sort of thing (esp32.mk):
build.flash_mode := $($(build.board).build.flash_mode)
build.flash_size := $($(build.board).build.flash_size)
build.flash_freq := $($(build.board).menu.FlashFreq.$(FLASH_FREQ).build.flash_freq)
build.boot := $($(build.board).build.boot)
build.partitions := $($(build.board).menu.PartitionScheme.$(PARTITION_SCHEME).build.partitions)
See this discussion (SO).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.