libmaple makefiles

Post your cool example code here.
Post Reply
ag123
Posts: 495
Joined: Thu Dec 19, 2019 5:30 am
Answers: 1

libmaple makefiles

Post by ag123 »

this is probably for the linux users. but these days
one can do just this as well while working in windows
https://docs.microsoft.com/en-us/window ... tall-win10

i've been using this makefile for various sketches. I've been working in eclipse (rather than Arduino IDE) and transporting the defines and dependencies is tedious. Though in the more recent releases, you can export those configs and import them into new projects.
With the makefile, all the defines and dependencies are captured in the makefile. Hence, it makes the task significantly easier.

This makefile is written for libmaple core and specifically STM32F1 core.
# the directory structure needs to be
# Root
# +-- src (your sources e.g. the sketch
# | the files has to be cpp, c or h, no ino)
# |
# +-- STM32F1 (copy from the libmaple core)
# |
# +-- Makefile (this makefile)
place your sources in src.
for libraries yon can copy that libraries into src or define them as additional src_dirX paths.
edit the other things such as the defines and include paths (add those for the libraries you use as needed) for each project

when done it is mostly just running

make

the build output goes into $(out_dir) - currently defined as bin.
note that make clean deletes the the out dir.

https://gist.github.com/ag88/a6a02acbc7 ... 7c0f310268

Code: Select all

# version 0 (alpha)
# 
# This make file for libmaple core is possibly *dangerous*
# i.e. it compiles the sources (in src and STM32F1) directory 
# and overwrite all the stuff in $(out_dir)
# $(out_dir) is the binary directory where the object files are dumped there
#
# make clean *deletes* the *$(out_dir)* (coded here as bin )
#
# this is a relative path makefile
# the directory structure needs to be
# Root
#   +-- src (your sources e.g. the sketch
#   |        the files has to be cpp, c or h, no ino)
#   |
#   +-- STM32F1 (copy from the libmaple core)
#   |
#   +-- Makefile (this makefile)
# 
# the make needs to be run from the root of this file structure
# the make is relative path from this Root 
# generated object files and binaries (elf, bin) are placed into the
# $(out_dir) - bin
#
# make clean  - *deletes* $(out_dir)
#
# make all  - starts the build
# 
# Lic: public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
# 

# this folder is deleted with make clean
out_dir := bin

# this is the name of the subdirectory under STM32F1/variants
# it needs to match, this caters to a single variant
variant := maple_mini

# these are the defines passed to gcc, g++ and the assembler
# use += to add more definitions
defines := MCU_STM32F103CB
defines += __STM32F1__
defines += VECT_TAB_ADDR=0x8002000
defines += CONFIG_MAPLE_MINI_NO_DISABLE_DEBUG
defines += DEBUG_LEVEL=DEBUG_NONE
defines += F_CPU=72000000L
defines += SERIAL_USB
defines += USB_VID=0x1EAF
defines += USB_PID=0x0004
defines += USB_MANUFACTURER=\"Unknown\"

# source directories
# these are the initial directories to search for sources
# relative to this build (root) directory
# if you use libraries either put them in a sub-directory in src
srcdir := src
# or add it here
#srcdir += library1
#srcdir += library2

# points to the root folder of stm32duino libmaple core
# this should be 1 level above STM32F1 folder
# use of this is not encouraged, it is safer to copy the STM32F1  
# folder into the current directory
# omit the final slash after the directory
core_root := .
# these are the source directories for the libmaple core
# and variant, normally they stay unchanged
# if you want to place the libmaple core directory somewhere else, 
# define core_root above
coredir := $(core_root)/STM32F1/cores/maple
variantdir += $(core_root)/STM32F1/variants/$(variant)
coredir += $(variantdir)

#this is the ld script in STM32F1/variants/$(variant)/ld to use
ldscript := bootloader_20.ld

#the includes i.e. the -Ipath needs to be exlicitly stated
#no automatic recursive searching
#if you use libraries you may want to add it here
includedir += STM32F1/cores/maple/
includedir += STM32F1/system/libmaple/
includedir += STM32F1/system/libmaple/include/
includedir += STM32F1/system/libmaple/stm32f1/include/series/
includedir += STM32F1/system/libmaple/usb/stm32f1/
includedir += STM32F1/system/libmaple/usb/usb_lib/
includedir += STM32F1/variants/maple_mini/
#if you use core_root, you would need to add that as a prefix
#includedir := $(addprefix $(core_root)/,$(includedir))

# update this to match 
# this should be the install base location of ARM_NONE_EABI_GCC toolchain
ARM_NONE_EABI_PATH := /opt5/opt/gcc-arm-none-eabi-6-2017-q1-update
# this should be the location of the arm standard libraries c & c++
# the arm-none-eabi/lib select the folder matching the arch
# compile options e.g. thumb and v7-m
LD_TOOLCHAIN_PATH := $(ARM_NONE_EABI_PATH)/arm-none-eabi/lib/thumb/v7-m


# recursive wildcard function, call with params:
#  - start directory (finished with /) or empty string for current dir
#  - glob pattern
# (taken from http://blog.jgc.org/2011/07/gnu-make-recursive-wildcard-function.html)
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))

cfiles := $(strip $(foreach s, $(srcdir), $(call rwildcard,$(s),*.c)))
cxxfiles := $(strip $(foreach s, $(srcdir), $(call rwildcard,$(s),*.cpp)))
asfiles := $(strip $(foreach s, $(srcdir), $(call rwildcard,$(s),*.S)))

core_cfiles += $(subst $(core_root)/,,$(strip $(foreach s, $(coredir), $(call rwildcard,$(s),*.c))))
core_cxxfiles += $(subst $(core_root)/,,$(strip $(foreach s, $(coredir), $(call rwildcard,$(s),*.cpp))))
core_asfiles += $(subst $(core_root)/,,$(strip $(foreach s, $(coredir), $(call rwildcard,$(s),*.S))))

src_files := $(cfiles) $(cxxfiles) $(asfiles) 
core_files := $(core_cfiles) $(core_cxxfiles) $(core_asfiles)
files := $(src_files) $(core_files)
sdirs := $(sort $(dir $(files)))

#hfiles := $(foreach s, $(includedir), $(call rwildcard,$(s),*.h))
#hfiles += $(foreach s, $(srcdir), $(call rwildcard,$(s),*.h))
#incdirs = $(sort $(dir $(hfiles)))

TOOLPREFIX := arm-none-eabi-
CC      = $(ARM_NONE_EABI_PATH)/bin/$(TOOLPREFIX)gcc
CXX     = $(ARM_NONE_EABI_PATH)/bin/$(TOOLPREFIX)g++
AS      = $(ARM_NONE_EABI_PATH)/bin/$(TOOLPREFIX)as
OBJCOPY = $(ARM_NONE_EABI_PATH)/bin/$(TOOLPREFIX)objcopy
OBJDUMP = $(ARM_NONE_EABI_PATH)/bin/$(TOOLPREFIX)objdump
AR      = $(ARM_NONE_EABI_PATH)/bin/$(TOOLPREFIX)ar
SIZE    = $(ARM_NONE_EABI_PATH)/bin/$(TOOLPREFIX)size
NM      = $(ARM_NONE_EABI_PATH)/bin/$(TOOLPREFIX)nm
LD      = $(ARM_NONE_EABI_PATH)/bin/$(TOOLPREFIX)ld

RM      = /usr/bin/rm
MKDIR   = /usr/bin/mkdir -p
TEST	= /usr/bin/test

DEFINES := $(addprefix -D,$(defines))
INCLUDES := $(addprefix -I,$(includedir))

#optimise
# -O0 - none
# -Os - optimise size
# -O1 - optimise
# -O2 - optimise more
# -O3 - optimise most
# -Og - optimise debug
OFLAG := -Os

#debug
# default none
# -g - debug
# -g1 - minimal
# -g3 - maximal
DFLAG = -g1

COMMON_OFLAGS := -Wl,--gc-sections $(OFLAG) $(DFLAG) \
                 -ffunction-sections -fdata-sections \
                 -fmessage-length=0 -fsigned-char \
                 -ffreestanding -fno-move-loop-invariants \
                 --specs=nano.specs -Wall -Wextra

TARGET_FLAGS += -mcpu=cortex-m3 -march=armv7-m -mthumb \
                 $(INCLUDES) $(DEFINES)
                 
GLOBAL_CFLAGS := $(COMMON_OFLAGS) $(TARGET_FLAGS)
TARGET_CFLAGS := 
GLOBAL_CXXFLAGS := -fno-rtti -fno-exceptions \
                   -fno-use-cxa-atexit -fno-threadsafe-statics \
                   $(COMMON_OFLAGS) \
                   $(TARGET_FLAGS)
TARGET_CXXFLAGS :=     
GLOBAL_ASFLAGS  := $(TARGET_FLAGS)
#TARGET_ASFLAGS  := -Wl,--gc-sections $(OFLAG) $(DFLAG) -Xassembler -Wall
TARGET_ASFLAGS  := -Wl,--gc-sections $(OFLAG) $(DFLAG)
LD_SCRIPT_PATH := $(variantdir)/ld/$(ldscript)

#				   -nostdlib 
#                  -nodefaultlibs
#                  -nostartfiles  
#                  -Wl,--gc-sections
GLOBAL_LDFLAGS := --specs=nano.specs \
                  -Xlinker --gc-sections

TARGET_LDFLAGS := -Xlinker -T$(LD_SCRIPT_PATH) \
           -mcpu=cortex-m3 -mthumb -march=armv7-m \
           -L $(variantdir)/ld 
           

CFLAGS   = $(GLOBAL_CFLAGS) $(TARGET_CFLAGS)
CXXFLAGS = $(GLOBAL_CXXFLAGS) $(TARGET_CXXFLAGS)
CPPFLAGS =
ASFLAGS  = $(GLOBAL_ASFLAGS) $(TARGET_ASFLAGS)

# Add toolchain directory to LD search path
TOOLCHAIN_LDFLAGS := -L $(LD_TOOLCHAIN_PATH)
LDFLAGS = $(GLOBAL_LDFLAGS) $(TARGET_LDFLAGS) $(TOOLCHAIN_LDFLAGS)

#build lists of object files relative to $(out_dir)
COBJS = $(addprefix $(out_dir)/,$(patsubst %.c,%.o,$(cfiles)))
CXXOBJS = $(addprefix $(out_dir)/,$(patsubst %.cpp,%.o,$(cxxfiles)))
ASOBJS =  $(addprefix $(out_dir)/,$(patsubst %.S,%.o,$(asfiles)))

CORE_COBJS = $(addprefix $(out_dir)/,$(patsubst %.c,%.o,$(core_cfiles)))
CORE_CXXOBJS = $(addprefix $(out_dir)/,$(patsubst %.cpp,%.o,$(core_cxxfiles)))
CORE_ASOBJS =  $(addprefix $(out_dir)/,$(patsubst %.S,%.o,$(core_asfiles)))


variant.ELF = $(out_dir)/$(variant).elf
variant.BIN = $(out_dir)/$(variant).bin

.PHONY: all clean mkdir
all: mkdir $(variant.BIN)
	@echo
	@$(SIZE) $(variant.ELF)
	@echo
	@ls -l $(variant.BIN)
	@echo
	@$(OBJDUMP) --section-headers $(variant.ELF)
	@echo
	@echo Source dirs
	@echo $(srcdir) $(coredir) | sed 's/ /\n/g'
	@echo
	@echo $(sort $(dir $(src_files))) | sed 's/ /\n/g'
	@echo $(addprefix $(core_root)/,$(sort $(dir $(core_files)))) | sed 's/ /\n/g'
	@echo
	@echo Includes
	@echo $(INCLUDES) | sed 's/ /\n/g'
	@echo
	@echo Defines
	@echo $(DEFINES) | sed 's/ /\n/g'    		

$(variant.BIN): $(variant.ELF)
	$(OBJCOPY) -v -Obinary $(variant.ELF) $@ 

$(variant.ELF): $(ASOBJS) $(COBJS) $(CXXOBJS) \
                $(CORE_COBJS) $(CORE_CXXOBJS) $(CORE_ASOBJS)
	$(CXX) $(LDFLAGS) -o $@ -Wl,-Map,$(out_dir)/$(variant).map $+

# General directory independent build rules, generate dependency information
$(COBJS): $(out_dir)/%.o: %.c
	$(CC) $(CFLAGS) -MMD -MP -MF $(@:%.o=%.d) -MT $@ -o $@ -c $<

$(CXXOBJS): $(out_dir)/%.o: %.cpp
	$(CXX) $(CXXFLAGS) -MMD -MP -MF $(@:%.o=%.d) -MT $@ -o $@ -c $<

$(ASOBJS): $(out_dir)/%.o: %.S
	$(CC) $(ASFLAGS) -MMD -MP -MF $(@:%.o=%.d) -MT $@ -o $@ -c $<

$(CORE_COBJS): $(out_dir)/%.o: $(core_root)/%.c
	$(CC) $(CFLAGS) -MMD -MP -MF $(@:%.o=%.d) -MT $@ -o $@ -c $<

$(CORE_CXXOBJS): $(out_dir)/%.o: $(core_root)/%.cpp
	$(CXX) $(CXXFLAGS) -MMD -MP -MF $(@:%.o=%.d) -MT $@ -o $@ -c $<

$(CORE_ASOBJS): $(out_dir)/%.o: $(core_root)/%.S
	$(CC) $(ASFLAGS) -MMD -MP -MF $(@:%.o=%.d) -MT $@ -o $@ -c $<


# create the build directories
tgtdirs := $(addsuffix .dir,$(addprefix $(out_dir)/,$(sdirs)))

mkdir: $(tgtdirs)

# the .dir file is a marker file that the directory is created
$(tgtdirs) : $(out_dir)/.dir
	$(MKDIR) $(dir $@)
	@touch $@

$(out_dir)/.dir:
	$(MKDIR) $(dir $@)
	@touch $@
	
clean:
	@echo clean
	$(RM) -r $(out_dir)
	
DEPENDS := $(COBJS:%.o=%.d) $(CXXOBJS:%.o=%.d) $(ASOBJS:%.o=%.d)
DEPENDS += $(CORE_COBJS:%.o=%.d) $(CORE_CXXOBJS:%.o=%.d) $(CORE_ASOBJS:%.o=%.d)

-include $(DEPENDS)



ag123
Posts: 495
Joined: Thu Dec 19, 2019 5:30 am
Answers: 1

Re: libmaple makefiles

Post by ag123 »

a makefile i used with stm32f401 black_pill

Code: Select all

# version 0 (alpha)
# 
# This make file for libmaple core is possibly *dangerous*
# i.e. it compiles the sources (in src and STM32F1) directory 
# and overwrite all the stuff in $(out_dir)
# $(out_dir) is the binary directory where the object files are dumped there
#
# make clean *deletes* the *$(out_dir)* (coded here as bin )
#
# this is a relative path makefile
# the directory structure needs to be
# Root
#   +-- src (your sources e.g. the sketch
#   |        the files has to be cpp, c or h, no ino)
#   |
#   +-- STM32F1 (copy from the libmaple core)
#   |
#   +-- Makefile (this makefile)
# 
# the make needs to be run from the root of this file structure
# the make is relative path from this Root 
# generated object files and binaries (elf, bin) are placed into the
# $(out_dir) - bin
#
# make clean  - *deletes* $(out_dir)
#
# make all  - starts the build
# 
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# In jurisdictions that recognize copyright laws, the author or authors
# of this software dedicate any and all copyright interest in the
# software to the public domain. We make this dedication for the benefit
# of the public at large and to the detriment of our heirs and
# successors. We intend this dedication to be an overt act of
# relinquishment in perpetuity of all present and future rights to this
# software under copyright law.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
# 
# For more information, please refer to [http://unlicense.org]

# this folder is deleted with make clean
out_dir := build

# this is the name of the subdirectory under STM32F1/variants
# it needs to match, this caters to a single variant
variant := blackpill_f401

# these are the defines passed to gcc, g++ and the assembler
# use += to add more definitions
defines := MCU_STM32F401CC
defines += __STM32F4__
defines += STM32F4
defines += STM32_HIGH_DENSITY
defines += ARDUINO=
defines += VARIANT_blackpill_f401
defines += VECT_TAB_ADDR=0x8000000
defines += USER_ADDR_ROM=0x8000000
defines += CONFIG_MAPLE_MINI_NO_DISABLE_DEBUG
defines += DEBUG_LEVEL=DEBUG_NONE
defines += F_CPU=84000000L
defines += CRYSTAL_FREQ=25
defines += SERIAL_USB
defines += USB_VID=0x1EAF
defines += USB_PID=0x0004
defines += USB_MANUFACTURER=\"Unknown\"
defines += USB_PRODUCT=
defines += LED_BUILTIN=PC13
defines += HAVE_ERROR_LED
defines += ERROR_LED_PORT=GPIOC
defines += ERROR_LED_PIN=13

# source directories
# these are the initial directories to search for sources
# relative to this build (root) directory
# if you use libraries either put them in a sub-directory in src
srcdir := src
# or add it here
#srcdir += library1
#srcdir += library2

# points to the root folder of stm32duino libmaple core
# this should be 1 level above STM32F1 folder
# use of this is not encouraged, it is safer to copy the STM32F1  
# folder into the current directory
# omit the final slash after the directory
core_root := .
# these are the source directories for the libmaple core
# and variant, normally they stay unchanged
# if you want to place the libmaple core directory somewhere else, 
# define core_root above
coredir := $(core_root)/STM32F4/cores/maple
variantdir += $(core_root)/STM32F4/variants/$(variant)
coredir += $(variantdir)

#this is the ld script in STM32F1/variants/$(variant)/ld to use
#ldscript := bootloader_20.ld
ldscript := jtag.ld

#the includes i.e. the -Ipath needs to be exlicitly stated
#no automatic recursive searching
#if you use libraries you may want to add it here
includedir += STM32F4/cores/maple/
includedir += STM32F4/cores/maple/libmaple/
includedir += STM32F4/cores/maple/libmaple/include
includedir += STM32F4/cores/maple/libmaple/usbF4/
includedir += STM32F4/system/libmaple/
includedir += STM32F4/variants/blackpill_f401
#if you use core_root, you would need to add that as a prefix
#includedir := $(addprefix $(core_root)/,$(includedir))

# update this to match 
# this should be the install base location of ARM_NONE_EABI_GCC toolchain
ARM_NONE_EABI_PATH := /opt/arduino/gcc-arm-none-eabi-8-2018-q4-major
# this should be the location of the arm standard libraries c & c++
# the arm-none-eabi/lib select the folder matching the arch
# compile options e.g. thumb and v7-m
LD_TOOLCHAIN_PATH := $(ARM_NONE_EABI_PATH)/arm-none-eabi/lib/thumb/v7e-m+fp


# recursive wildcard function, call with params:
#  - start directory (finished with /) or empty string for current dir
#  - glob pattern
# (taken from http://blog.jgc.org/2011/07/gnu-make-recursive-wildcard-function.html)
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))

cfiles := $(strip $(foreach s, $(srcdir), $(call rwildcard,$(s),*.c)))
cxxfiles := $(strip $(foreach s, $(srcdir), $(call rwildcard,$(s),*.cpp)))
asfiles := $(strip $(foreach s, $(srcdir), $(call rwildcard,$(s),*.S)))

core_cfiles += $(subst $(core_root)/,,$(strip $(foreach s, $(coredir), $(call rwildcard,$(s),*.c))))
core_cxxfiles += $(subst $(core_root)/,,$(strip $(foreach s, $(coredir), $(call rwildcard,$(s),*.cpp))))
core_asfiles += $(subst $(core_root)/,,$(strip $(foreach s, $(coredir), $(call rwildcard,$(s),*.S))))

src_files := $(cfiles) $(cxxfiles) $(asfiles) 
core_files := $(core_cfiles) $(core_cxxfiles) $(core_asfiles)
files := $(src_files) $(core_files)
sdirs := $(sort $(dir $(files)))

#hfiles := $(foreach s, $(includedir), $(call rwildcard,$(s),*.h))
#hfiles += $(foreach s, $(srcdir), $(call rwildcard,$(s),*.h))
#incdirs = $(sort $(dir $(hfiles)))

TOOLPREFIX := arm-none-eabi-
CC      = $(ARM_NONE_EABI_PATH)/bin/$(TOOLPREFIX)gcc
CXX     = $(ARM_NONE_EABI_PATH)/bin/$(TOOLPREFIX)g++
AS      = $(ARM_NONE_EABI_PATH)/bin/$(TOOLPREFIX)as
OBJCOPY = $(ARM_NONE_EABI_PATH)/bin/$(TOOLPREFIX)objcopy
OBJDUMP = $(ARM_NONE_EABI_PATH)/bin/$(TOOLPREFIX)objdump
AR      = $(ARM_NONE_EABI_PATH)/bin/$(TOOLPREFIX)ar
SIZE    = $(ARM_NONE_EABI_PATH)/bin/$(TOOLPREFIX)size
NM      = $(ARM_NONE_EABI_PATH)/bin/$(TOOLPREFIX)nm
LD      = $(ARM_NONE_EABI_PATH)/bin/$(TOOLPREFIX)ld
DFUUTIL = dfu-util


RM      = /usr/bin/rm
MKDIR   = /usr/bin/mkdir -p
TEST	= /usr/bin/test

DEFINES := $(addprefix -D,$(defines))
INCLUDES := $(addprefix -I,$(includedir))

#optimise
# -O0 - none
# -Os - optimise size
# -O1 - optimise
# -O2 - optimise more
# -O3 - optimise most
# -Og - optimise debug
#OFLAG := -Os
OFLAG := -Os

#debug
# default none
# -g - debug
# -g1 - minimal
# -g3 - maximal
DFLAG = -g

COMMON_OFLAGS := -Wl,--gc-sections $(OFLAG) $(DFLAG) \
                 -ffunction-sections -fdata-sections \
                 -fmessage-length=0 -fsigned-char \
                 -ffreestanding -fno-move-loop-invariants \
                 --specs=nano.specs -Wall -Wextra

FPU_FLAGS := -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant
#FPU_FLAGS := -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -fsingle-precision-constant


TARGET_FLAGS += -mcpu=cortex-m4 -march=armv7e-m+fp -mthumb \
                 $(FPU_FLAGS) \
                 $(INCLUDES) $(DEFINES)
                 
GLOBAL_CFLAGS := $(COMMON_OFLAGS) $(TARGET_FLAGS)
TARGET_CFLAGS := 
GLOBAL_CXXFLAGS := -fno-rtti -fno-exceptions \
                   -fno-use-cxa-atexit -fno-threadsafe-statics \
                   $(COMMON_OFLAGS) \
                   $(TARGET_FLAGS)
TARGET_CXXFLAGS :=     
GLOBAL_ASFLAGS  := $(TARGET_FLAGS)
#TARGET_ASFLAGS  := -Wl,--gc-sections $(OFLAG) $(DFLAG) -Xassembler -Wall
TARGET_ASFLAGS  := -Wl,--gc-sections $(OFLAG) $(DFLAG)
LD_SCRIPT_PATH := $(variantdir)/ld/$(ldscript)

#				   -nostdlib 
#                  -nodefaultlibs
#                  -nostartfiles  
#                  -Wl,--gc-sections
GLOBAL_LDFLAGS := --specs=nano.specs \
                  -Xlinker --gc-sections

TARGET_LDFLAGS := $(TARGET_FLAGS) \
                  -Xlinker -T$(LD_SCRIPT_PATH) \
                  -L $(variantdir)/ld

CFLAGS   = $(GLOBAL_CFLAGS) $(TARGET_CFLAGS)
CXXFLAGS = $(GLOBAL_CXXFLAGS) $(TARGET_CXXFLAGS)
CPPFLAGS =
ASFLAGS  = $(GLOBAL_ASFLAGS) $(TARGET_ASFLAGS)

# Add toolchain directory to LD search path
TOOLCHAIN_LDFLAGS := -L $(LD_TOOLCHAIN_PATH)
LDFLAGS = $(GLOBAL_LDFLAGS) $(TARGET_LDFLAGS) $(TOOLCHAIN_LDFLAGS)

#build lists of object files relative to $(out_dir)
COBJS = $(addprefix $(out_dir)/,$(patsubst %.c,%.o,$(cfiles)))
CXXOBJS = $(addprefix $(out_dir)/,$(patsubst %.cpp,%.o,$(cxxfiles)))
ASOBJS =  $(addprefix $(out_dir)/,$(patsubst %.S,%.o,$(asfiles)))

CORE_COBJS = $(addprefix $(out_dir)/,$(patsubst %.c,%.o,$(core_cfiles)))
CORE_CXXOBJS = $(addprefix $(out_dir)/,$(patsubst %.cpp,%.o,$(core_cxxfiles)))
CORE_ASOBJS =  $(addprefix $(out_dir)/,$(patsubst %.S,%.o,$(core_asfiles)))


variant.ELF = $(out_dir)/$(variant).elf
variant.BIN = $(out_dir)/$(variant).bin

.PHONY: all clean mkdir
all: mkdir $(variant.BIN)
	@echo
	@$(SIZE) $(variant.ELF)
	@echo
	@ls -l $(variant.BIN)
	@echo
	@$(OBJDUMP) --section-headers $(variant.ELF)
	@echo
	@echo Source dirs
	@echo $(srcdir) $(coredir) | sed 's/ /\n/g'
	@echo
	@echo $(sort $(dir $(src_files))) | sed 's/ /\n/g'
	@echo $(addprefix $(core_root)/,$(sort $(dir $(core_files)))) | sed 's/ /\n/g'
	@echo
	@echo Includes
	@echo $(INCLUDES) | sed 's/ /\n/g'
	@echo
	@echo Defines
	@echo $(DEFINES) | sed 's/ /\n/g'    		

install: all
	$(DFUUTIL) -d 0483:df11 -a 0 -s 0x8000000 -D $(variant.BIN)
	
$(variant.BIN): $(variant.ELF)
	$(OBJCOPY) -v -Obinary $(variant.ELF) $@ 

$(variant.ELF): $(ASOBJS) $(COBJS) $(CXXOBJS) \
                $(CORE_COBJS) $(CORE_CXXOBJS) $(CORE_ASOBJS)
	$(CXX) $(LDFLAGS) -o $@ -Wl,-Map,$(out_dir)/$(variant).map $+

# General directory independent build rules, generate dependency information
$(COBJS): $(out_dir)/%.o: %.c
	$(CC) $(CFLAGS) -MMD -MP -MF $(@:%.o=%.d) -MT $@ -o $@ -c $<

$(CXXOBJS): $(out_dir)/%.o: %.cpp
	$(CXX) $(CXXFLAGS) -MMD -MP -MF $(@:%.o=%.d) -MT $@ -o $@ -c $<

$(ASOBJS): $(out_dir)/%.o: %.S
	$(CC) $(ASFLAGS) -MMD -MP -MF $(@:%.o=%.d) -MT $@ -o $@ -c $<

$(CORE_COBJS): $(out_dir)/%.o: $(core_root)/%.c
	$(CC) $(CFLAGS) -MMD -MP -MF $(@:%.o=%.d) -MT $@ -o $@ -c $<

$(CORE_CXXOBJS): $(out_dir)/%.o: $(core_root)/%.cpp
	$(CXX) $(CXXFLAGS) -MMD -MP -MF $(@:%.o=%.d) -MT $@ -o $@ -c $<

$(CORE_ASOBJS): $(out_dir)/%.o: $(core_root)/%.S
	$(CC) $(ASFLAGS) -MMD -MP -MF $(@:%.o=%.d) -MT $@ -o $@ -c $<


# create the build directories
tgtdirs := $(addsuffix .dir,$(addprefix $(out_dir)/,$(sdirs)))

mkdir: $(tgtdirs)

# the .dir file is a marker file that the directory is created
$(tgtdirs) : $(out_dir)/.dir
	$(MKDIR) $(dir $@)
	@touch $@

$(out_dir)/.dir:
	$(MKDIR) $(dir $@)
	@touch $@
	
clean:
	@echo clean
	$(RM) -r $(out_dir)
	
DEPENDS := $(COBJS:%.o=%.d) $(CXXOBJS:%.o=%.d) $(ASOBJS:%.o=%.d)
DEPENDS += $(CORE_COBJS:%.o=%.d) $(CORE_CXXOBJS:%.o=%.d) $(CORE_ASOBJS:%.o=%.d)

-include $(DEPENDS)

Last edited by ag123 on Fri Jan 03, 2020 5:21 am, edited 1 time in total.

ag123
Posts: 495
Joined: Thu Dec 19, 2019 5:30 am
Answers: 1

Re: libmaple makefiles

Post by ag123 »

a makefile i used with f407 black

Code: Select all

# version 0 (alpha)
# 
# This make file for libmaple core is possibly *dangerous*
# i.e. it compiles the sources (in src and STM32F1) directory 
# and overwrite all the stuff in $(out_dir)
# $(out_dir) is the binary directory where the object files are dumped there
#
# make clean *deletes* the *$(out_dir)* (coded here as bin )
#
# this is a relative path makefile
# the directory structure needs to be
# Root
#   +-- src (your sources e.g. the sketch
#   |        the files has to be cpp, c or h, no ino)
#   |
#   +-- STM32F1 (copy from the libmaple core)
#   |
#   +-- Makefile (this makefile)
# 
# the make needs to be run from the root of this file structure
# the make is relative path from this Root 
# generated object files and binaries (elf, bin) are placed into the
# $(out_dir) - bin
#
# make clean  - *deletes* $(out_dir)
#
# make all  - starts the build
# 
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# In jurisdictions that recognize copyright laws, the author or authors
# of this software dedicate any and all copyright interest in the
# software to the public domain. We make this dedication for the benefit
# of the public at large and to the detriment of our heirs and
# successors. We intend this dedication to be an overt act of
# relinquishment in perpetuity of all present and future rights to this
# software under copyright law.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
# 
# For more information, please refer to [http://unlicense.org]

# this folder is deleted with make clean
out_dir := build

# this is the name of the subdirectory under STM32F1/variants
# it needs to match, this caters to a single variant
variant := generic_f407v

# these are the defines passed to gcc, g++ and the assembler
# use += to add more definitions
defines := MCU_STM32F407VE
defines += __STM32F4__
defines += STM32F4
defines += STM32_HIGH_DENSITY
defines += ARDUINO=
defines += VARIANT_generic_f407v
defines += VECT_TAB_ADDR=0x8000000
defines += USER_ADDR_ROM=0x8000000
defines += CONFIG_MAPLE_MINI_NO_DISABLE_DEBUG
defines += DEBUG_LEVEL=DEBUG_NONE
defines += F_CPU=168000000L
defines += CRYSTAL_FREQ=8
defines += SERIAL_USB
defines += USB_VID=0x1EAF
defines += USB_PID=0x0004
defines += USB_MANUFACTURER=\"Unknown\"
defines += USB_PRODUCT=
defines += LED_BUILTIN=PA6
defines += HAVE_ERROR_LED
defines += ERROR_LED_PORT=GPIOA
defines += ERROR_LED_PIN=6

# source directories
# these are the initial directories to search for sources
# relative to this build (root) directory
# if you use libraries either put them in a sub-directory in src
srcdir := src
# or add it here
#srcdir += library1
#srcdir += library2

# points to the root folder of stm32duino libmaple core
# this should be 1 level above STM32F1 folder
# use of this is not encouraged, it is safer to copy the STM32F1  
# folder into the current directory
# omit the final slash after the directory
core_root := .
# these are the source directories for the libmaple core
# and variant, normally they stay unchanged
# if you want to place the libmaple core directory somewhere else, 
# define core_root above
coredir := $(core_root)/STM32F4/cores/maple
variantdir += $(core_root)/STM32F4/variants/$(variant)
coredir += $(variantdir)

#this is the ld script in STM32F1/variants/$(variant)/ld to use
#ldscript := bootloader_20.ld
ldscript := jtag.ld

#the includes i.e. the -Ipath needs to be exlicitly stated
#no automatic recursive searching
#if you use libraries you may want to add it here
includedir += STM32F4/cores/maple/
includedir += STM32F4/cores/maple/libmaple/
includedir += STM32F4/cores/maple/libmaple/include
includedir += STM32F4/cores/maple/libmaple/usbF4/
includedir += STM32F4/system/libmaple/
includedir += STM32F4/variants/generic_f407v
#if you use core_root, you would need to add that as a prefix
#includedir := $(addprefix $(core_root)/,$(includedir))

# update this to match 
# this should be the install base location of ARM_NONE_EABI_GCC toolchain
ARM_NONE_EABI_PATH := /opt/arduino/gcc-arm-none-eabi-8-2018-q4-major
# this should be the location of the arm standard libraries c & c++
# the arm-none-eabi/lib select the folder matching the arch
# compile options e.g. thumb and v7-m
LD_TOOLCHAIN_PATH := $(ARM_NONE_EABI_PATH)/arm-none-eabi/lib/thumb/v7e-m+fp


# recursive wildcard function, call with params:
#  - start directory (finished with /) or empty string for current dir
#  - glob pattern
# (taken from http://blog.jgc.org/2011/07/gnu-make-recursive-wildcard-function.html)
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))

cfiles := $(strip $(foreach s, $(srcdir), $(call rwildcard,$(s),*.c)))
cxxfiles := $(strip $(foreach s, $(srcdir), $(call rwildcard,$(s),*.cpp)))
asfiles := $(strip $(foreach s, $(srcdir), $(call rwildcard,$(s),*.S)))

core_cfiles += $(subst $(core_root)/,,$(strip $(foreach s, $(coredir), $(call rwildcard,$(s),*.c))))
core_cxxfiles += $(subst $(core_root)/,,$(strip $(foreach s, $(coredir), $(call rwildcard,$(s),*.cpp))))
core_asfiles += $(subst $(core_root)/,,$(strip $(foreach s, $(coredir), $(call rwildcard,$(s),*.S))))

src_files := $(cfiles) $(cxxfiles) $(asfiles) 
core_files := $(core_cfiles) $(core_cxxfiles) $(core_asfiles)
files := $(src_files) $(core_files)
sdirs := $(sort $(dir $(files)))

#hfiles := $(foreach s, $(includedir), $(call rwildcard,$(s),*.h))
#hfiles += $(foreach s, $(srcdir), $(call rwildcard,$(s),*.h))
#incdirs = $(sort $(dir $(hfiles)))

TOOLPREFIX := arm-none-eabi-
CC      = $(ARM_NONE_EABI_PATH)/bin/$(TOOLPREFIX)gcc
CXX     = $(ARM_NONE_EABI_PATH)/bin/$(TOOLPREFIX)g++
AS      = $(ARM_NONE_EABI_PATH)/bin/$(TOOLPREFIX)as
OBJCOPY = $(ARM_NONE_EABI_PATH)/bin/$(TOOLPREFIX)objcopy
OBJDUMP = $(ARM_NONE_EABI_PATH)/bin/$(TOOLPREFIX)objdump
AR      = $(ARM_NONE_EABI_PATH)/bin/$(TOOLPREFIX)ar
SIZE    = $(ARM_NONE_EABI_PATH)/bin/$(TOOLPREFIX)size
NM      = $(ARM_NONE_EABI_PATH)/bin/$(TOOLPREFIX)nm
LD      = $(ARM_NONE_EABI_PATH)/bin/$(TOOLPREFIX)ld
DFUUTIL = dfu-util


RM      = /usr/bin/rm
MKDIR   = /usr/bin/mkdir -p
TEST	= /usr/bin/test

DEFINES := $(addprefix -D,$(defines))
INCLUDES := $(addprefix -I,$(includedir))

#optimise
# -O0 - none
# -Os - optimise size
# -O1 - optimise
# -O2 - optimise more
# -O3 - optimise most
# -Og - optimise debug
OFLAG := -Os

#debug
# default none
# -g - debug
# -g1 - minimal
# -g3 - maximal
DFLAG = -g

COMMON_OFLAGS := -Wl,--gc-sections $(OFLAG) $(DFLAG) \
                 -ffunction-sections -fdata-sections \
                 -fmessage-length=0 -fsigned-char \
                 -ffreestanding -fno-move-loop-invariants \
                 --specs=nano.specs -Wall -Wextra

FPU_FLAGS := -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant
#FPU_FLAGS := -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -fsingle-precision-constant


TARGET_FLAGS += -mcpu=cortex-m4 -march=armv7e-m+fp -mthumb \
                 $(FPU_FLAGS) \
                 $(INCLUDES) $(DEFINES)
                 
GLOBAL_CFLAGS := $(COMMON_OFLAGS) $(TARGET_FLAGS)
TARGET_CFLAGS := 
GLOBAL_CXXFLAGS := -fno-rtti -fno-exceptions \
                   -fno-use-cxa-atexit -fno-threadsafe-statics \
                   $(COMMON_OFLAGS) \
                   $(TARGET_FLAGS)
TARGET_CXXFLAGS :=     
GLOBAL_ASFLAGS  := $(TARGET_FLAGS)
#TARGET_ASFLAGS  := -Wl,--gc-sections $(OFLAG) $(DFLAG) -Xassembler -Wall
TARGET_ASFLAGS  := -Wl,--gc-sections $(OFLAG) $(DFLAG)
LD_SCRIPT_PATH := $(variantdir)/ld/$(ldscript)

#				   -nostdlib 
#                  -nodefaultlibs
#                  -nostartfiles  
#                  -Wl,--gc-sections
GLOBAL_LDFLAGS := --specs=nano.specs \
                  -Xlinker --gc-sections

TARGET_LDFLAGS := $(TARGET_FLAGS) \
                  -Xlinker -T$(LD_SCRIPT_PATH) \
                  -L $(variantdir)/ld

CFLAGS   = $(GLOBAL_CFLAGS) $(TARGET_CFLAGS)
CXXFLAGS = $(GLOBAL_CXXFLAGS) $(TARGET_CXXFLAGS)
CPPFLAGS =
ASFLAGS  = $(GLOBAL_ASFLAGS) $(TARGET_ASFLAGS)

# Add toolchain directory to LD search path
TOOLCHAIN_LDFLAGS := -L $(LD_TOOLCHAIN_PATH)
LDFLAGS = $(GLOBAL_LDFLAGS) $(TARGET_LDFLAGS) $(TOOLCHAIN_LDFLAGS)

#build lists of object files relative to $(out_dir)
COBJS = $(addprefix $(out_dir)/,$(patsubst %.c,%.o,$(cfiles)))
CXXOBJS = $(addprefix $(out_dir)/,$(patsubst %.cpp,%.o,$(cxxfiles)))
ASOBJS =  $(addprefix $(out_dir)/,$(patsubst %.S,%.o,$(asfiles)))

CORE_COBJS = $(addprefix $(out_dir)/,$(patsubst %.c,%.o,$(core_cfiles)))
CORE_CXXOBJS = $(addprefix $(out_dir)/,$(patsubst %.cpp,%.o,$(core_cxxfiles)))
CORE_ASOBJS =  $(addprefix $(out_dir)/,$(patsubst %.S,%.o,$(core_asfiles)))


variant.ELF = $(out_dir)/$(variant).elf
variant.BIN = $(out_dir)/$(variant).bin

.PHONY: all clean mkdir
all: mkdir $(variant.BIN)
	@echo
	@$(SIZE) $(variant.ELF)
	@echo
	@ls -l $(variant.BIN)
	@echo
	@$(OBJDUMP) --section-headers $(variant.ELF)
	@echo
	@echo Source dirs
	@echo $(srcdir) $(coredir) | sed 's/ /\n/g'
	@echo
	@echo $(sort $(dir $(src_files))) | sed 's/ /\n/g'
	@echo $(addprefix $(core_root)/,$(sort $(dir $(core_files)))) | sed 's/ /\n/g'
	@echo
	@echo Includes
	@echo $(INCLUDES) | sed 's/ /\n/g'
	@echo
	@echo Defines
	@echo $(DEFINES) | sed 's/ /\n/g'    		

install: all
	$(DFUUTIL) -d 0483:df11 -a 0 -s 0x8000000 -D $(variant.BIN)
	
$(variant.BIN): $(variant.ELF)
	$(OBJCOPY) -v -Obinary $(variant.ELF) $@ 

$(variant.ELF): $(ASOBJS) $(COBJS) $(CXXOBJS) \
                $(CORE_COBJS) $(CORE_CXXOBJS) $(CORE_ASOBJS)
	$(CXX) $(LDFLAGS) -o $@ -Wl,-Map,$(out_dir)/$(variant).map $+

# General directory independent build rules, generate dependency information
$(COBJS): $(out_dir)/%.o: %.c
	$(CC) $(CFLAGS) -MMD -MP -MF $(@:%.o=%.d) -MT $@ -o $@ -c $<

$(CXXOBJS): $(out_dir)/%.o: %.cpp
	$(CXX) $(CXXFLAGS) -MMD -MP -MF $(@:%.o=%.d) -MT $@ -o $@ -c $<

$(ASOBJS): $(out_dir)/%.o: %.S
	$(CC) $(ASFLAGS) -MMD -MP -MF $(@:%.o=%.d) -MT $@ -o $@ -c $<

$(CORE_COBJS): $(out_dir)/%.o: $(core_root)/%.c
	$(CC) $(CFLAGS) -MMD -MP -MF $(@:%.o=%.d) -MT $@ -o $@ -c $<

$(CORE_CXXOBJS): $(out_dir)/%.o: $(core_root)/%.cpp
	$(CXX) $(CXXFLAGS) -MMD -MP -MF $(@:%.o=%.d) -MT $@ -o $@ -c $<

$(CORE_ASOBJS): $(out_dir)/%.o: $(core_root)/%.S
	$(CC) $(ASFLAGS) -MMD -MP -MF $(@:%.o=%.d) -MT $@ -o $@ -c $<


# create the build directories
tgtdirs := $(addsuffix .dir,$(addprefix $(out_dir)/,$(sdirs)))

mkdir: $(tgtdirs)

# the .dir file is a marker file that the directory is created
$(tgtdirs) : $(out_dir)/.dir
	$(MKDIR) $(dir $@)
	@touch $@

$(out_dir)/.dir:
	$(MKDIR) $(dir $@)
	@touch $@
	
clean:
	@echo clean
	$(RM) -r $(out_dir)
	
DEPENDS := $(COBJS:%.o=%.d) $(CXXOBJS:%.o=%.d) $(ASOBJS:%.o=%.d)
DEPENDS += $(CORE_COBJS:%.o=%.d) $(CORE_CXXOBJS:%.o=%.d) $(CORE_ASOBJS:%.o=%.d)

-include $(DEPENDS)


Bingo600
Posts: 82
Joined: Sat Dec 21, 2019 3:56 pm

Re: libmaple makefiles

Post by Bingo600 »

Thanx :) :)

There ought to be a "C..ital penalty" :roll: for releasing a multifile project wo. a makefile

/Bingo

ag123
Posts: 495
Joined: Thu Dec 19, 2019 5:30 am
Answers: 1

Re: libmaple makefiles

Post by ag123 »

well, the Arduino IDE doesn't need it, and actually if you define the necessary details (defines, includes, sources, libraries, paths, flags) in eclipse IDE etc it doesn't need a makefile too. but as makefiles work for me, i pretty much made do with makefiles :lol:
the thing about IDEs is that configs are defined in the IDE, that's true for general eclipse projects, to transport the configs to a different project often means re-defining everything, and it is lots of details

User avatar
fpiSTM
Posts: 792
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 30
Location: Le Mans
Contact:

Re: libmaple makefiles

Post by fpiSTM »

Several ways could be used to build the core if you know what is requested.
Using an "advanced" IDE requires some extra config. Even if some "Arduino" plugins exist, they are not fully compliant and require extra config/workaround.
I've already thinking about using CMAKE to generate build config and I know it exist an ArduinoCMake. That's could be a good enhancement.

ag123
Posts: 495
Joined: Thu Dec 19, 2019 5:30 am
Answers: 1

Re: libmaple makefiles

Post by ag123 »

i'm trying to make one that works with official core, for myself for that matter :P :lol:
i'd think with Arduino IDE, Sloeber - eclipse, PlatformIO etc and even eclipse itself (it seemed the most recent eclipse release has Arduino supported in CDT) the use of makefiles isn't after all a must have. e.g. if one sets the configs in the IDE, it is pretty feasible to work that way.
the only trouble is that prior i used gnu-arm-eclipse - now renamed to gnu-mcu-eclipse (this is still very good)
https://gnu-mcu-eclipse.github.io/
all the setups defines, includes, sources, libraries, flags are manually configured in the ide.
if i transit to a different project, i'd either have to copy that project or re-do all the defines all over again. this is extremely tedious especially as eclipse has both a debug and release setup, so it is 2 sets of it.
Arduino IDE etc abstracted most of it into platforms.txt and boards.txt i'd think

i don't really like cmake for various reasons, probably due to my own unfamiliarity, and i've had builds breaking in part as the cmake distributed with my linux distribution is broken is some places. :lol:
i think for now things like the arduino cli seemed to be a decent cli based approach
https://blog.arduino.cc/2018/08/24/anno ... rface-cli/

for my 'makefile' based approach, it is partly as i worked in linux and use eclipse, so this is kind of a solution from having to re-define all the setups every different sketch or project

i think there are some advantages in working in a eclipse like environment, as Arduino IDE tends to rebuild things from scratch, while makefiles and such does incremental build, so it is likely faster for one line changes and rebuild as only very few files are re-compiled

i stopped short of the 'install' step so i normally flash the binary myself e.g.

Code: Select all

dfu-util -a 0 -s 0x8000000 -D sketch.bin
this kind of helps as the binary is basically the 'product' and i don't have to rebuild it but simply install the binary when i need it again.

as Arduino IDE seem to be moving towards a 'eclipse' like one
https://blog.arduino.cc/2019/10/18/ardu ... -features/
https://blog.arduino.cc/2019/10/25/new- ... oser-look/
i'd guess we'd see how things evolve

User avatar
fpiSTM
Posts: 792
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 30
Location: Le Mans
Contact:

Re: libmaple makefiles

Post by fpiSTM »

Currently, I'm using VSCode and before I've used Eclipse with Sloeber.
https://github.com/stm32duino/wiki/wiki/How-to-debug

Anyway, on both I've found several restrictions a,d this require some manual configs.
I have to end to wrote the Wiki but now I've a config which works fine even debugging with cortex registers.

ag123
Posts: 495
Joined: Thu Dec 19, 2019 5:30 am
Answers: 1

Re: libmaple makefiles

Post by ag123 »

i think i'd try out VSCode too, as it seemed there are some advantages and after all it runs in linux

Bingo600
Posts: 82
Joined: Sat Dec 21, 2019 3:56 pm

Re: libmaple makefiles

Post by Bingo600 »

I tried this one for avr arduino
https://github.com/sudar/Arduino-Makefile

Worked quite well

/Bingo

Post Reply

Return to “Code snippets”