Commit Graph

34 Commits

Author SHA1 Message Date
Kevin O'Connor 0143199175 Makefile: Improve handling of board symbolic link creation
Running "make" directly after a "make distclean" can lead to a corrupt
out/board symbolic link.  Rework the make rules so that the board
symbolic link is created in a new make instance that has the updated
definition of CONFIG_BOARD_DIRECTORY.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-02-03 17:39:57 -05:00
Sergey Alirzaev c19d1fbb59 Makefile: Include debug symbols in the .elf
Signed-off-by: Sergey Alirzaev <zl29ah@gmail.com>
2021-06-08 19:29:16 -04:00
Kevin O'Connor 0f9f061b35 Makefile: Use CURDIR instead of PWD
Use $(CURDIR) instead of $(PWD) to refer to the current directory, as
the PWD variable comes from the shell environment and may not always
be set.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-05-19 23:49:50 -04:00
Kevin O'Connor 85300a4aad Makefile: Improve build when changing micro-controller architecture
Try to clean up the dependency files when changing the
micro-controller architecture so that an explicit "make clean" isn't
needed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-12-17 10:02:16 -05:00
Kevin O'Connor a4e5a19e68 scripts: Convert build from Linux Kconfig to new kconfiglib
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-11-23 10:17:48 -05:00
Boleslaw Ciesielski ca2e84abba Makefile: fixed missing dependency on autoconf.h
Signed-off-by: Boleslaw Ciesielski <combolek@users.noreply.github.com>
2020-06-15 17:14:58 -04:00
Kevin O'Connor 1b83fb72f5 Makefile: Use "tr -s" in compile_time_request.txt generation
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-22 11:40:02 -04:00
Kevin O'Connor 69fc1e63b4 Makefile: Translate null characters to newline characters in ctr requests
Store the CTR requests in compile_time_request.txt with the null
characters removed.  This makes it slightly easier to inspect the CTR
conversions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-22 10:35:26 -04:00
Kevin O'Connor 351910c5ac Makefile: Add generic rule for precompiling linker scripts
Add a general build rule to precompile *.lds.S files to *.ld files.
Remove the custom rules in src/atsamd/Makefile and src/stm32/Makefile.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-21 12:31:12 -04:00
LyleCheatham f7cb0875f4 makefile: Fixed build on OSX
Signed-off-by: Lyle Cheatham <hello@lylecheatham.com>
2019-05-20 16:49:16 -04:00
Kevin O'Connor 9430fea2c5 Makefile: Fix lpc176x and stm32f1 builds
Commit e18501d0 broke the build for targets that added objects to
klipper.elf via adding dependencies.  Rework the build so that it is
possible to add objects to klipper.elf via a new OBJS_klipper.elf
makefile variable.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-02 11:26:14 -05:00
Kevin O'Connor e18501d01c Makefile: Explicitly list source code in klipper.elf compile
Don't use the list of dependencies in the klipper.elf build. This
allows the arch makefiles to add separate dependencies to klipper.elf.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-01 13:59:54 -05:00
Kevin O'Connor 50e9c6738f scripts: Add a test case for Ubuntu 18.04 compiler error
Attempt to detect a bad build of Klipper and report an error.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-12-22 13:13:31 -05:00
Kevin O'Connor e3e3aa63d7 build: Add gcc option -std=gnu11
Some older versions of gcc require this flag in order to compile the
code correctly.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-21 09:43:48 -04:00
Sebastian Meyer 58dd6d9106 build: Link objects ahead of libraries to avoid failures on some platforms
Signed-off-by: Sebastian Meyer <ich@sebmeyer.de>
2018-02-25 10:39:06 -05:00
Kevin O'Connor d778ae1846 build: Add gcc and binutils version to mcu data dictionary
Store the gcc and binutils versions used in the compilation of the
firmware in the firmware data dictionary.  Forward that information to
the log so it is available during debugging.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-12-21 20:32:10 -05:00
Kevin O'Connor b7b368a1ed build: Default to python2 in the Makefile
Set PYTHON=python2 instead of python as some systems point python to
python3.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-06-28 10:52:05 -04:00
Kevin O'Connor a82e949c00 build: Use compile_time_request system for init, tasks, and shutdown
Avoid using linker magic to define the init, task, and shutdown
functions.  Instead, use the compile_time_request system.  This
simplifies the build and produces more efficient code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-05-26 12:39:34 -04:00
Kevin O'Connor b9940f0e0d build: Avoid linker magic in compile_time_request.c unique id generation
Avoid generating unique ids via memory locations and linker scripts.
Instead, generate them using code produced by buildcommands.py.
Utilize gcc's ability to perform static string comparisons at compile
time to produce a unique id for each unique string.

This fixes a build failure on ARM introduced in 142b92b8.  It also
reduces the complexity of the build.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-05-26 12:32:02 -04:00
Kevin O'Connor 233adfe660 build: Add __visible to variables in compile_time_request.c
Add __visible to generated code in compile_time_request.c so that the
main code can be compiled with -fwhole-program.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-05-15 14:02:04 -04:00
Kevin O'Connor 450c14b286 build: Rename makefile CFLAGS-y to CFLAGS and LDFLAGS-y to CFLAGS_klipper.elf
Rename some makefile variables.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-05-15 14:01:56 -04:00
Kevin O'Connor 1878da228d build: Add workaround to suppress broken avr-gcc "misspelled" warnings
Detect avr gcc v4.8.1 and then disable warnings during the klipper.o
linking to suppress bogus "misspelled signal handler" warnings.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-04-24 08:54:10 -04:00
Kevin O'Connor fe95ea221b build: Define DECL_CONSTANT mechanism for defining exported constants
Add a DECL_CONSTANT macro to allow the firmware to define constants
that are to be exported to the host during the "identify" phase.  This
replaces the existing hardcoded mechanism of scanning the Kconfig
header file for certain constants.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-23 17:06:10 -05:00
Kevin O'Connor 4e8674d5df build: Disable gcc's use-linker-plugin option
On GCC v6 the -fwhole-program option does not take effect when
-fuse-linker-plugin is also in effect. The -fuse-linker-plugin option
does not optimize as well as -fwhole-program, so explicitly disable
the linker plugin via -fno-use-linker-plugin.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-22 22:48:14 -05:00
Kevin O'Connor 306db9a851 build: Be sure to also include out/*.d files in Makefile
Not including the out/*.d build files can cause the build to be
incomplete.  In particular, without this fix, if the code is built for
ARM and then configured for AVR, the build can produce a corrupt AVR
binary.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-10-21 12:00:03 -04:00
Kevin O'Connor 33a48d926c build: Support creating and storing the data dictionary on each build
Generate the data dictionary in out/klipper.dict on each build.  This
makes it easier to use the dictionary when debugging.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-09-10 20:01:52 -04:00
Kevin O'Connor b0b2e9c4aa build: Avoid objcopy --dump-section flag
Commit da305e6b changed the objcopy command to use the --dump-section
flag.  However, the 2.24 version of avr-objcopy (which is common on
raspbian installs) does not support this flag.  Avoid using
--dump-section and continue to use the -j option instead.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-07-10 21:46:57 -04:00
Kevin O'Connor da305e6b61 build: Update declfuncs.lds.S to only use progmem sections on AVR
On non-avr platforms the declfunc stuff still needs to be in the
binary in a rodata section.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-14 14:00:57 -04:00
Kevin O'Connor ea5f825a91 build: Default to O2 optimization
Default to O2 and set Os in the AVR makefile.  Platforms besides AVR
are likely to produce better code with O2 so make that the default.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-14 14:00:57 -04:00
Kevin O'Connor 71947d6bea gpiocmds: Add Kconfig option to allow boards to disable ADC commands
Some boards may not support the ADC hardware.  Update the build so
that those commands do not need to be compiled if they are not
available.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-13 23:18:59 -04:00
Kevin O'Connor 4dd3478fc1 Makefile: Move listing of directories to create to board makefiles
Rename DIRS to dirs-y and populate it in the per-board Makefile rules.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-13 23:18:59 -04:00
Kevin O'Connor 9971f999b3 generic: Create generic board infrastructure and move misc.h to it
Instead of creating a misc.h file in each board directory, create a
generic board directory and declare misc.h there.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-13 23:18:58 -04:00
Kevin O'Connor 3eafc83458 avr: Initial support for Atmel AT90USB1286 mcu
Add GPIO definitions for the AT90USB1286.  Add code for communicating
over USB port on AT90USB1286.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-05 10:52:45 -04:00
Kevin O'Connor f582a36e4d Initial commit of source code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-05-25 11:37:40 -04:00