Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Erik Strand
lufa
Commits
4641acc6
Commit
4641acc6
authored
Sep 30, 2012
by
Dean Camera
Browse files
Add LINKER_RELAXATIONS option to the LUFA BUILD build system module.
parent
4cd80263
Changes
3
Hide whitespace changes
Inline
Side-by-side
LUFA/Build/lufa_build.mk
View file @
4641acc6
...
...
@@ -9,7 +9,7 @@
LUFA_BUILD_MODULES
+=
BUILD
LUFA_BUILD_TARGETS
+=
size symbol-sizes all lib elf hex lss clean mostlyclean
LUFA_BUILD_MANDATORY_VARS
+=
TARGET ARCH MCU SRC F_USB LUFA_PATH
LUFA_BUILD_OPTIONAL_VARS
+=
BOARD OPTIMIZATION C_STANDARD CPP_STANDARD F_CPU C_FLAGS CPP_FLAGS ASM_FLAGS CC_FLAGS LD_FLAGS OBJDIR OBJECT_FILES DEBUG_TYPE DEBUG_LEVEL
LUFA_BUILD_OPTIONAL_VARS
+=
BOARD OPTIMIZATION C_STANDARD CPP_STANDARD F_CPU C_FLAGS CPP_FLAGS ASM_FLAGS CC_FLAGS LD_FLAGS OBJDIR OBJECT_FILES DEBUG_TYPE DEBUG_LEVEL
LINKER_RELAXATIONS
LUFA_BUILD_PROVIDED_VARS
+=
LUFA_BUILD_PROVIDED_MACROS
+=
...
...
@@ -60,6 +60,9 @@ LUFA_BUILD_PROVIDED_MACROS +=
# CC_FLAGS - Common flags to pass to the C/C++ compiler and
# assembler
# LD_FLAGS - Flags to pass to the linker
# LINKER_RELAXATIONS - Enable or disable linker relaxations to
# decrease binary size (note: can cause link
# failures on systems with an unpatched binutils)
# OBJDIR - Directory for the output object and dependency
# files; if equal to ".", the output files will
# be generated in the same folder as the sources
...
...
@@ -86,19 +89,20 @@ ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $
ERROR_IF_NONBOOL
?=
$(
if
$(
filter
Y N,
$
(
$(
strip
$(1)
)))
, ,
$(
error
Makefile
$(
strip
$(1)
)
option must be Y or N
))
# Default values of optionally user-supplied variables
BOARD
?=
NONE
OPTIMIZATION
?=
s
F_CPU
?=
C_STANDARD
?=
gnu99
CPP_STANDARD
?=
gnu++98
C_FLAGS
?=
CPP_FLAGS
?=
ASM_FLAGS
?=
CC_FLAGS
?=
OBJDIR
?=
.
OBJECT_FILES
?=
DEBUG_FORMAT
?=
dwarf-2
DEBUG_LEVEL
?=
2
BOARD
?=
NONE
OPTIMIZATION
?=
s
F_CPU
?=
C_STANDARD
?=
gnu99
CPP_STANDARD
?=
gnu++98
C_FLAGS
?=
CPP_FLAGS
?=
ASM_FLAGS
?=
CC_FLAGS
?=
OBJDIR
?=
.
OBJECT_FILES
?=
DEBUG_FORMAT
?=
dwarf-2
DEBUG_LEVEL
?=
2
LINKER_RELAXATIONS
?=
Y
# Sanity check user supplied values
$(foreach
MANDATORY_VAR,
$(LUFA_BUILD_MANDATORY_VARS),
$(call
ERROR_IF_UNSET,
$(MANDATORY_VAR)))
...
...
@@ -114,6 +118,7 @@ $(call ERROR_IF_EMPTY, CPP_STANDARD)
$(call
ERROR_IF_EMPTY,
OBJDIR)
$(call
ERROR_IF_EMPTY,
DEBUG_FORMAT)
$(call
ERROR_IF_EMPTY,
DEBUG_LEVEL)
$(call
ERROR_IF_NONBOOL,
LINKER_RELAXATIONS)
# Determine the utility prefix to use for the selected architecture
ifeq
($(ARCH), AVR8)
...
...
@@ -194,7 +199,10 @@ BASE_CPP_FLAGS := -x c++ -O$(OPTIMIZATION) -std=$(CPP_STANDARD)
BASE_ASM_FLAGS
:=
-x
assembler-with-cpp
# Create a list of flags to pass to the linker
BASE_LD_FLAGS
:=
-lm
-Wl
,-Map
=
$(TARGET)
.map,--cref
-Wl
,--gc-sections
-Wl
,--relax
BASE_LD_FLAGS
:=
-lm
-Wl
,-Map
=
$(TARGET)
.map,--cref
-Wl
,--gc-sections
ifeq
($(LINKER_RELAXATIONS), Y)
BASE_LD_FLAGS
+=
-Wl
,--relax
endif
ifeq
($(ARCH), AVR8)
BASE_LD_FLAGS
+=
-mmcu
=
$(MCU)
else
ifeq
($(ARCH), XMEGA)
...
...
LUFA/DoxygenPages/BuildSystem.txt
View file @
4641acc6
...
...
@@ -188,6 +188,13 @@
* <td>Flags to pass to the linker, after the automatically generated flags.</td>
* </tr>
* <tr>
* <td><tt>LINKER_RELAXATIONS</tt></td>
* <td>Enables or disables linker relaxations when linking the application binary. This can reduce the total size
* of the application by replacing full \c CALL instructions with smaller \c RCALL instructions where possible.
* \note On some unpatched versions of binutils, this can cause link failures in some circumstances. If you
* receive a link error <tt>relocation truncated to fit: R_AVR_13_PCREL</tt>, disable this setting.</td>
* </tr>
* <tr>
* <td><tt>OBJDIR</tt></td>
* <td>Directory to place the generated object and dependency files. If set to "." the same folder as the source file will be used.
* \note When this option is enabled, all source filenames <b>must</b> be unique.</td>
...
...
LUFA/DoxygenPages/LUFAPoweredProjects.txt
View file @
4641acc6
...
...
@@ -148,6 +148,7 @@
* \li CFFA3000, a CompactFlash interface for the Apple II: http://www.dreher.net/CFforAppleII
* \li Digital Survey Instruments Magnetometer and Pointer: http://www.digitalsurveyinstruments.com/
* \li FinchRobot, a robot designed for educational use: http://www.finchrobot.com/
* \li Flysight, a GPS logger for wingsuit pilots: http://flysight.ca/
* \li HummingBird Kit, a robotics learning platform: http://www.hummingbirdkit.com/
* \li Penguino, an Arduino Board With On-Board LUFA Powered Debugger/Programmer: http://wiki.icy.com.au/PenguinoAVR
* \li PIR-1, an IR control interface for consumer electronics: http://www.promixis.com/pir-1.php
...
...
@@ -160,6 +161,7 @@
* \li Retrode, a USB Games Console Cartridge Reader: http://www.retrode.org
* \li RFI21.1EU UHF RFID reader: http://www.metra.cz/rfid/uhf-rfid-ctecky/rfi21-1eu-uhf-rfid-ctecka.htm
* \li SmartCardDetective, a Smart Card analysis tool: http://www.smartcarddetective.com/
* \li TimelapsePlus, a digital camera time lapse tool: https://github.com/timelapseplus/TimelapsePlus-Firmware
* \li USBTINY-MKII, an AVRISP-MKII Clone AVR Programmer: http://tom-itx.dyndns.org:81/~webpage/boards/USBTiny_Mkii/USBTiny_Mkii_index.php
* \li UDS18B20 USB Temperature sensor: http://toughlog.org/uds18b20/
* \li VMeter, a USB MIDI touch strip controller: http://www.vmeter.net/
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment