-
Notifications
You must be signed in to change notification settings - Fork 327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Examples stuff: fix examples/rules, extend rules and add f7 examples #193
base: master
Are you sure you want to change the base?
Changes from 7 commits
877749f
2a7e4fa
72027c9
6aec4eb
6c02f9d
16d6b24
e20be5f
15a0ebf
e54f872
4e6cb4f
7c432aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,6 +84,7 @@ ifeq ($(strip $(DEVICE)),) | |
DEFS += -I$(OPENCM3_DIR)/include | ||
LDFLAGS += -L$(OPENCM3_DIR)/lib | ||
LDLIBS += -l$(LIBNAME) | ||
LIBDEPS += $(OPENCM3_DIR)/lib/lib$(LIBNAME).a | ||
LDSCRIPT ?= $(BINARY).ld | ||
else | ||
# New style, assume device is provided, and we're generating the rest. | ||
|
@@ -167,11 +168,26 @@ else | |
include $(OPENCM3_DIR)/mk/genlink-rules.mk | ||
endif | ||
|
||
# Find libopencm3 library folder | ||
# this tries to match LIBNAME to manufacturer or manufacturer/series folder in lib/ | ||
# eg. LIBNAME=lm3s LIBFOLDER=lib/lm3s or LIBNAME=stm32f7 LIBFOLDER=lib/stm32/f7 | ||
DIR=$(notdir $(subst /.,,$(wildcard $1/*/.))) | ||
LIBFOLDER=lib/$(strip \ | ||
$(foreach M,$(filter-out usb ethernet dispatch,$(call DIR,$(OPENCM3_DIR)/lib)), \ | ||
$(if $(subst opencm3_$M,,$(LIBNAME)),\ | ||
$(foreach S,$(call DIR,$(OPENCM3_DIR)/lib/$(M)), \ | ||
$(if $(subst opencm3_$M$S,,$(LIBNAME)),,$M/$S)), \ | ||
$M))) | ||
# exceptions | ||
ifeq ($(LIBFOLDER),lib/lpc43xx) | ||
LIBFOLDER=lib/lpc43xx/m4 | ||
endif | ||
|
||
# Build libopencm3-lib if it does exists | ||
$(OPENCM3_DIR)/lib/lib$(LIBNAME).a: | ||
ifeq (,$(wildcard $@)) | ||
$(warning $(LIBNAME).a not found, attempting to rebuild in $(OPENCM3_DIR)) | ||
$(MAKE) -C $(OPENCM3_DIR) | ||
endif | ||
$(MAKE) -C $(OPENCM3_DIR) $(LIBFOLDER) $(if $(CFLAGS),CFLAGS="$(CFLAGS)") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what sort of usecase is this meant to support? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i guess it makes no sense having this in the examples |
||
$(OPENCM3_DIR)/include/%.h: $(OPENCM3_DIR)/lib/lib$(LIBNAME).a; | ||
|
||
# Define a helper macro for debugging make errors online | ||
# you can type "make print-OPENCM3_DIR" and it will show you | ||
|
@@ -199,19 +215,19 @@ print-%: | |
@#printf " OBJDUMP $(*).list\n" | ||
$(Q)$(OBJDUMP) -S $(*).elf > $(*).list | ||
|
||
%.elf %.map: $(OBJS) $(LDSCRIPT) $(OPENCM3_DIR)/lib/lib$(LIBNAME).a | ||
%.elf %.map: $(OBJS) $(LDSCRIPT) $(LIBDEPS) | ||
@#printf " LD $(*).elf\n" | ||
$(Q)$(LD) $(TGT_LDFLAGS) $(LDFLAGS) $(OBJS) $(LDLIBS) -o $(*).elf | ||
|
||
%.o: %.c | ||
%.o: %.c $(LIBDEPS) | ||
@#printf " CC $(*).c\n" | ||
$(Q)$(CC) $(TGT_CFLAGS) $(CFLAGS) $(TGT_CPPFLAGS) $(CPPFLAGS) -o $(*).o -c $(*).c | ||
|
||
%.o: %.cxx | ||
%.o: %.cxx $(LIBDEPS) | ||
@#printf " CXX $(*).cxx\n" | ||
$(Q)$(CXX) $(TGT_CXXFLAGS) $(CXXFLAGS) $(TGT_CPPFLAGS) $(CPPFLAGS) -o $(*).o -c $(*).cxx | ||
|
||
%.o: %.cpp | ||
%.o: %.cpp $(LIBDEPS) | ||
@#printf " CXX $(*).cpp\n" | ||
$(Q)$(CXX) $(TGT_CXXFLAGS) $(CXXFLAGS) $(TGT_CPPFLAGS) $(CPPFLAGS) -o $(*).o -c $(*).cpp | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
## | ||
## This file is part of the libopencm3 project. | ||
## | ||
## This library is free software: you can redistribute it and/or modify | ||
## it under the terms of the GNU Lesser General Public License as published by | ||
## the Free Software Foundation, either version 3 of the License, or | ||
## (at your option) any later version. | ||
## | ||
## This library is distributed in the hope that it will be useful, | ||
## but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
## GNU Lesser General Public License for more details. | ||
## | ||
## You should have received a copy of the GNU Lesser General Public License | ||
## along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
## | ||
|
||
# You should use linker script generation! Specify device! | ||
ifeq ($(DEVICE),) | ||
LIBNAME = opencm3_stm32l4 | ||
DEFS += -DSTM32L4 | ||
|
||
FP_FLAGS ?= -mfloat-abi=hard -mfpu=fpv5-sp-d16 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. where di you get that it's v5? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right though, I have this as an unchecked in file locally, never committed when the "basics" example was added. |
||
ARCH_FLAGS = -mthumb -mcpu=cortex-m4 $(FP_FLAGS) | ||
endif | ||
|
||
################################################################################ | ||
# OpenOCD specific variables | ||
|
||
OOCD ?= openocd | ||
OOCD_INTERFACE ?= stlink-v2-1 | ||
OOCD_TARGET ?= stm32l4x | ||
|
||
################################################################################ | ||
# Black Magic Probe specific variables | ||
# Set the BMP_PORT to a serial port and then BMP is used for flashing | ||
BMP_PORT ?= | ||
|
||
################################################################################ | ||
# texane/stlink specific variables | ||
#STLINK_PORT ?= :4242 | ||
|
||
|
||
include ../../../../rules.mk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
definitely not interested in this one. I've had enough rpoblems with people trying to pick and choose things, and reportings bugs when all they really needed to do was just run "make" once in the top and everythign would have been fine. This relies far too much on knowledge of the build system and file structure within the library, which should be treated as a simple .a dependency. It's a submodule for exactly that reason, just build it once, move on.