mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
added the defines to the platform file
This commit is contained in:
parent
c3f31b1210
commit
b0377889ed
4
Makefile
4
Makefile
@ -716,7 +716,7 @@ OBJS = $(PRECOMPILED_OBJS) $(SOURCEOBJS)
|
||||
# -nodefaultlibs -nostdlib -nostartfiles
|
||||
|
||||
# -fdata-sections -ffunction-sections are to help remove unused code
|
||||
CFLAGS += $(OPTIMIZEFLAGS) -c $(ARCHFLAGS) $(DEFINES) $(INCLUDE)
|
||||
CFLAGS += $(OPTIMIZEFLAGS) -c $(ARCHFLAGS) $(DEFINES) $(INCLUDE) -DESPR_AUTOCOMPLETE_NOT_REQUIRED
|
||||
|
||||
# -Wl,--gc-sections helps remove unused code
|
||||
# -Wl,--whole-archive checks for duplicates
|
||||
@ -811,7 +811,7 @@ endif # NRF5X
|
||||
|
||||
$(PLATFORM_CONFIG_FILE): boards/$(BOARD).py scripts/build_platform_config.py
|
||||
@echo ================================== Generating platform configs
|
||||
$(Q)$(PYTHON) scripts/build_platform_config.py $(BOARD) $(HEADERFILENAME)
|
||||
$(Q)$(PYTHON) scripts/build_platform_config.py $(BOARD) $(HEADERFILENAME) "$(DEFINES)"
|
||||
|
||||
# If realpath exists, use relative paths
|
||||
ifneq ("$(shell ${REALPATH} --version > /dev/null;echo "$$?")","0")
|
||||
|
||||
@ -35,11 +35,15 @@ import pinutils;
|
||||
# Now scan AF file
|
||||
print("Script location "+scriptdir)
|
||||
|
||||
if len(sys.argv)!=3:
|
||||
if not (len(sys.argv)==3 or len(sys.argv)==4):
|
||||
print("ERROR, USAGE: build_platform_config.py BOARD_NAME HEADERFILENAME")
|
||||
exit(1)
|
||||
boardname = sys.argv[1]
|
||||
headerFilename = sys.argv[2]
|
||||
defines = []
|
||||
if len(sys.argv)==4:
|
||||
defines = sys.argv[3]
|
||||
|
||||
print("HEADER_FILENAME "+headerFilename)
|
||||
print("BOARD "+boardname)
|
||||
# import the board def
|
||||
@ -553,6 +557,22 @@ codeOut("#define IS_PIN_USED_INTERNALLY(PIN) (("+")||(".join(usedPinChecks)+"))"
|
||||
codeOut("#define IS_PIN_A_LED(PIN) (("+")||(".join(ledChecks)+"))")
|
||||
codeOut("#ifndef IS_PIN_A_BUTTON")
|
||||
codeOut("#define IS_PIN_A_BUTTON(PIN) (("+")||(".join(btnChecks)+"))")
|
||||
|
||||
# add makefile defines
|
||||
if len(defines) > 2:
|
||||
codeOut("\n#ifndef ESPR_AUTOCOMPLETE_NOT_REQUIRED")
|
||||
for define in defines.strip().split():
|
||||
if not define.startswith("-D"):
|
||||
continue
|
||||
define = define[2:]
|
||||
if "=" in define:
|
||||
defSplit = define.split("=")
|
||||
codeOut("\t#define " + defSplit[0] + " " + defSplit[1])
|
||||
else:
|
||||
codeOut("\t#define " + define)
|
||||
codeOut("#endif")
|
||||
# end makefile defines
|
||||
|
||||
codeOut("#endif")
|
||||
|
||||
codeOut("""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user