Commit graph

138 commits

Author SHA1 Message Date
Angus Gratton
d1b66a08c1 bootloader: Add option to build with Link Time Optimisation enabled 2017-07-19 18:31:59 +10:00
Angus Gratton
d664e32394 build system: Use component.mk for all components, refactor bootloader build
For config-only components, component.mk should now contain "COMPONENT_CONFIG_ONLY := 1"

Also refactored some of the generation of linker paths, library list. This required cleaning up the way the bootloader
project works, it's now mostly independent from the parent.
2017-07-19 09:10:48 +10:00
Angus Gratton
2571e66a29 build system: Make component searching more explicit, obsolete SRCDIRS
Each COMPONENT_DIRS directory can now either be a component directory, or a parent directory containing component
subdirectories.

When searching for components, skip any directory which doesn't have component.mk, Kconfig.projbuild, or
Makefile.projbuild in it. This helps with debugging, list-components output, etc.
2017-07-19 09:07:53 +10:00
Angus Gratton
2c1fe6663d build system: Add list-components target for debugging component discovery 2017-07-19 09:07:53 +10:00
Angus Gratton
b7fc16a408 build system: Updating project Makefile should trigger a full rebuild
Project Makefile can set CFLAGS, macro defines, etc.
2017-07-13 10:51:24 +08:00
Angus Gratton
7b565e4b25 assertions: Add "silent" option
Reduces assertion codesize overhead by approximately 35%
2017-07-12 17:29:26 +08:00
Angus Gratton
2e49249a71 build system: Split setting of compiler optimisation level from assertions on/off 2017-06-30 09:01:33 +10:00
Angus Gratton
5055290baf build system: Add idf_size.py tool for better "make size" output & analysis
Add new "make size_components" and "make size_files" targets for analysing makeup of the ELF file.

Plain "make size" output now looks like this:

Total sizes:
 DRAM .data size:   11156 bytes
 DRAM .bss  size:   22304 bytes
Used static DRAM:   33460 bytes ( 294220 available, 10.2% used)
Used static IRAM:   80480 bytes (  50592 available, 61.4% used)
      Flash code:  421463 bytes
    Flash rodata:  103824 bytes
Total image size:~ 616923 bytes (.bin may be padded larger)
2017-06-21 15:43:22 +10:00
Eyob
cdc7396f97 Make sure LD -L option is calculated correctly when the project Makefile has specified SRCDIRS components that are not directly below Makefile folder level.
For example,
SRCDIRS = comp_a  happy/comp_b  /c/dev/comp_c

Then the following are built:
build/comp_a/libcomp_a.a
build/comp_b/libcomp_b.a
build/comp_c/libcomp_c.a

But when LD is run the -L is calculated as follows
-L build/comp_a
-L build/happy/comp_b
-L build//c/dev/comp_c

This means comp_b and comp_c are not found by LD. With this change set -L is calculated correctly for comp_b and comp_c

Merges #504 https://github.com/espressif/esp-idf/pull/504
2017-04-21 11:03:07 +10:00
Anton Maklakov
06798a2b35 build: Fix for old version of git (< 1.8.5) 2017-04-11 19:14:07 +08:00
Ivan Grokhotkov
dbb6d20aac make: remove version parameter from git status porcelain option
Version parameter was added in git 2.11, while default git on macOS is
currently 2.10. According to the latest git docs, if the version
parameter is not provided, it defaults to ‘v1’, so removing it doesn’t
change the format.
2017-03-28 14:22:27 +08:00
Angus Gratton
16ef01dc69 Merge branch 'bugfix/windows_setup' into 'master'
Windows setup improvements

* Tweak Makefile to significantly reduce startup time on Windows (also reduced on other platforms, but less obvious.)
* Revise windows setup installation script to fix various issues, use latest toolchain.
* Tweak Windows config docs

See merge request !597
2017-03-28 10:49:08 +08:00
Angus Gratton
b9a06e68dd Merge branch 'bugfix/minor_fixes' into 'master'
Minor fixes and PRs cherry-picked from Github



See merge request !602
2017-03-23 17:57:28 +08:00
Angus Gratton
a3ce95e482 build system: Add explicit DEBUG_FLAGS variable, pass to assembler also 2017-03-23 10:30:42 +08:00
Edmund Huber
5272bd899b build: Check for .git, but it doesn't have to be a directory, so that esp-idf will work as a submodule
Merges #438 https://github.com/espressif/esp-idf/pull/438
2017-03-22 15:03:53 +08:00
Edmund Huber
6a58e173b8 build: pass more arguments to git describe so that it always works even if detached branch, etc
Merges #441 https://github.com/espressif/esp-idf/pull/441
2017-03-22 14:51:47 +08:00
Angus Gratton
39e728622f build system: Call 'git status' w/ machine-readable output once to check submodules
This is substantially faster than the 'git submodule status' command, has same effect. Particularly noticeable on
Windows, where 'submodule status' takes 2 seconds and 'status' takes 0.2 seconds.
2017-03-21 16:00:03 +08:00
Angus Gratton
02fdf8271d Merge branch 'feature/idf_monitor' into 'master'
Expand  'make monitor' support

New 'make monitor' idf_monitor tool for better monitor output. Running 'make monitor' will now:
* Automatically look up code addresses via addr2line and print function, source file, line number in terminal.
* Can reset the ESP32 by typing Ctrl-T Ctrl-R.
* Can run "make flash" by typing Ctrl-T Ctrl-F.
* Can run "make app-flash" by typing Ctrl-T Ctrl-A.
* If gdb stub starts, monitor will automatically run gdb and connect. When gdb exits, ESP32 resets and monitor resumes.
* Exit is still Ctrl-[

Have some more features I'd like to add (log output to file, crash dump support) but I think this is at the point of being useful.


See merge request !565
2017-03-15 10:41:08 +08:00
Angus Gratton
1544544f8a tools: New idf_monitor 'make monitor' tool for smarter monitor output 2017-03-13 09:31:45 +08:00
Ivan Grokhotkov
61c33ca24e make: don’t override TEST_COMPONENTS
When idf_monitor is launched from make, it gets modified TEST_COMPONENTS
variable which contains full paths to the test components instead of the
names. This causes TEST_COMPONENT_PATHS to be empty and the unit test
app gets built without any test components.

This change introduces an internal TEST_COMPONENTS_LIST variable which
gets set either from $(COMPONENTS) if TESTS_ALL is 1, and from
TEST_COMOPONENTS otherwise.
Bootloader makefile is also fixed to avoid propagating TESTS_ALL to the
bootloader build step.
2017-03-09 19:43:39 +08:00
Ivan Grokhotkov
bf7f0bf52c make: look for TEST_COMPONENTS in all component directories
fixes https://github.com/espressif/esp-idf/issues/354
2017-03-01 11:12:29 +08:00
Angus Gratton
d28ee9a25e build system: Account for Windows behaviour of make wildcard for some dirs
See github #166
2017-02-22 11:59:37 +11:00
Angus Gratton
e91d436e45 build system: Probable fix for errors due to bad config bypassing components
See github #311 https://github.com/espressif/esp-idf/issues/311

Should fix weird compiler/linker bugs where config says something is
enabled, but build system says it is disabled.
Particularly noticeable when WiFi/BT libraries fail to
compile/link despite being enabled.

Underlying cause is configuration file regenerating, but component
Makefiles not reevaluating.

Entirely removes the idea that we don't need to generate config for some
targets (like 'clean'). We need valid config for these targets,
otherwise they don't know which files to clean (etc).
2017-02-22 11:58:49 +11:00
Angus Gratton
cdf8836ceb build: Use greedy match for toolchain version detection (fixes macOS) 2017-01-16 15:09:20 +11:00
Angus Gratton
5c9c08eabb Toolchain detection: Fix issue when run in a clean project
If the makefile config entry hasn't been generated yet, don't test the toolchain.

Closes #226 https://github.com/espressif/esp-idf/issues/226
2017-01-13 14:09:01 +11:00
Angus Gratton
233fde166b Toolchain detection: Allow for Windows executable name and not-yet-configured toolchain path
Windows executable name based on fix suggested by @krzysztof
2017-01-13 13:55:26 +11:00
Ivan Grokhotkov
aece3d6fc6 Merge branch 'bugfix/mbedtls_tests' into 'master'
fix mbedtls unit tests, fix IDF_VER when building a project outside ESP-IDF tree

- mbedTLS test needs about 5% more time to run (in debug mode) when building with 5.2.0, compared to 4.8.5. Increase the timeout to let the test pass.
- when doing `git describe` in IDF_VER definition, `-C $(IDF_PATH)` is needed to get the version of ESP-IDF, and not the project being built (which may not even be in git)

See merge request !411
2017-01-12 09:47:15 +08:00
Ivan Grokhotkov
dd73a40556 build system: fix IDF_VER for projects outside of ESP-IDF tree 2017-01-11 22:47:44 +08:00
Ivan Grokhotkov
8d2199e36c docs: update toolchain version 2017-01-11 15:03:14 +08:00
Ivan Grokhotkov
8c26dd8d38 Merge branch 'feature/idf_version' into 'master'
build system: add IDF_VER environment variable and preprocessor define

This adds an `IDF_VER` preprocessor define which is obtained from `git describe`.

Looks like `v1.0-275-g0efaa4f` for non-release version or `v2.0` for a tagged (release) version.

See merge request !403
2017-01-11 11:34:28 +08:00
Ivan Grokhotkov
89e0ecc272 build system: add IDF_VER environment variable and preprocessor define 2017-01-11 00:24:50 +08:00
Ivan Grokhotkov
845cd09570 cxx: link against libstdc++, remove abi.cpp 2017-01-06 14:56:02 +08:00
Angus Gratton
03551ec2da build system: Add 'make monitor' target from arduino-esp32
Originally added to arduino-esp32 by @me-no-dev. It's so useful, we
want it in esp-idf as well! :)
2017-01-03 10:59:10 +11:00
Angus Gratton
578b627d9b Merge branch 'bugfix/build_system_tilde' into 'master'
Build system: Allow IDF_PATH to contain ~ or C:/

See github issues
* https://github.com/espressif/esp-idf/issues/118
* https://github.com/espressif/esp-idf/issues/166

(This is easier to work around in the build system than to document.)

See merge request !315
2016-12-22 12:14:16 +08:00
Ivan Grokhotkov
a760eb3980 Merge branch 'feature/erase_flash' into 'master'
Build system: Add `make erase_flash` target



See merge request !328
2016-12-22 09:53:25 +08:00
Angus Gratton
de8ecdd3c1 build system: Fix Windows case when IDF_PATH contains colons (ie C:/)
Closes github #166 https://github.com/espressif/esp-idf/issues/166
2016-12-22 10:36:25 +11:00
Angus Gratton
59e0f63d37 Build system: Add make erase_flash target 2016-12-20 10:00:04 +11:00
Angus Gratton
d6fafd00db Secure boot: Option for app & partition table signing to happen outside build system 2016-12-19 13:12:05 +11:00
Angus Gratton
9d8e110202 Build system: Deal with the case where IDF_PATH contains ~
See github issue https://github.com/espressif/esp-idf/issues/118

(This is easier to work around in the build system than to document.)
2016-12-16 11:30:37 +11:00
Angus Gratton
49be64a716 build system: Generate dependency make rules for assembler source
Was previously only C, C++.
2016-12-15 08:44:48 +11:00
Angus Gratton
487548e7dd Merge branch 'bugfix/build_system_linker_script_deps' into 'master'
build system: Linker scripts or binary libraries should trigger a re-link

Add binary libraries and linker scripts to the list of dependencies for the ELF file.

Fixes TW7816.


See merge request !307
2016-12-15 05:38:54 +08:00
Angus Gratton
311b7040d5 Merge branch 'feature/make_size' into 'master'
Add the size target to project Makefile

Github pull request https://github.com/espressif/esp-idf/pull/154

See merge request !305
2016-12-13 07:25:35 +08:00
Jonathan Dumaresq
2a22dc082b Add the size target to project Makefile 2016-12-13 10:03:51 +11:00
Angus Gratton
bbe1bceda8 build system: Project ELF should depend on linker scripts, binary libraries
TW#7816
2016-12-12 15:58:53 +11:00
Angus Gratton
9a378bca0e build system: Be specific about esp-idf submodule update warnings 2016-12-12 15:58:50 +11:00
Angus Gratton
506c8cd964 secure boot & flash encryption: Rework configuration options
Add UART bootloader disable options for flash encryption
2016-12-01 23:49:12 -08:00
antti
15d96eccdb add build all unit tests in project.mk and update doc 2016-11-23 11:42:12 +08:00
antti
d390449371 add unit tests to esp-idf
rename nvs host test folder, modify .gitlab-ci.yml

remove unit-test-app build

re-format unit test files

remove extra newlines in project.mk

some refactoring for unit test part in project.mk

add build files of unit-test-app in gitignore

add README.md for unit test app

correct headings in README.md

remove files and make minor tweaks in unit test app

update .gitlab-ci.yml to use unit test app

delete unused lines in component_wrapper.mk

delete periph_i2s.h and lcd test

add text floating point in components/esp32/test/Kconfig

correct idf test build paths in .gitlab-ci.yml
2016-11-22 14:45:50 +08:00
Angus Gratton
24b4c17ead build system: Refactor SubmoduleCheck to work project-wide
Required at project level because some components use header files in
other components' submodules, and one component with a
submodule (esptool.py) doesn't have or need a component.mk.
2016-11-17 09:18:51 +11:00
Angus Gratton
60f29236f6 Build system: Raise warning level
Default esp-idf builds now show -Wextra warnings (except for a few:
signed/unsigned comparison, unused parameters, old-style C declarations.)

CI building of examples runs with that level raised to -Werror, to catch
those changes going into the main repo.
2016-11-16 15:57:34 +11:00
Angus Gratton
c15024e629 Merge branch 'master' into feature/build_component_project_vars 2016-11-14 14:54:41 +11:00
Angus Gratton
ea4005e673 Merge branch 'feature/esptool_secure_boot' into 'master'
Secure boot support

Also includes a lot of esptool.py changes (two new command line tools, espefuse.py and espsecure.py)
https://github.com/themadinventor/esptool/compare/feature/esp32_v20_refactor...feature/esp32_secure_boot?expand=1


See merge request !163
2016-11-14 11:32:04 +08:00
Angus Gratton
64f3893cb9 secure boot: Derive secure bootloader key from private key
Means only one key needs to be managed.
2016-11-14 11:08:42 +11:00
Angus Gratton
b5de581399 Secure boot: initial image signature support 2016-11-14 11:08:42 +11:00
Angus Gratton
cc510c1d95 build system: Remove make 3.81 "component_project_vars.mk: No such file or directory" messages
Also add an explicit make version check & warning.
2016-11-14 10:55:58 +11:00
Angus Gratton
341593f7d2 build system: Remove need for $(Q) macro in recipes, use --silent in MAKEFLAGS instead 2016-11-11 12:32:47 +11:00
Angus Gratton
07f36a9437 Build system: Use ifndef X in makefiles instead of ifeq("$(X)","") 2016-11-10 18:34:43 +11:00
Angus Gratton
208e83def7 build system: Refactor component.mk to not need component_common.mk
New makefile component_wrapper.mk allows some variables to be set
before component.mk is evaluated. This properly fixes problems with
sdkconfig being hard to access in all phases of the build.

Including component_common.mk is no longer necessary and will print a
deprecation warning for components which use it.
2016-11-10 15:52:22 +11:00
Angus Gratton
d7e57eb668 build system: Refactor the three component-target-related macros into one 2016-11-09 19:09:44 +11:00
Angus Gratton
155f912433 build system: Don't build an sdkconfig for bootloader, share the top-level one
This works because all CONFIG variables are exported into child make processes.
2016-11-09 16:51:52 +11:00
Angus Gratton
830e5caf4d build system: Replace get_variable target w/ component_project_vars.mk generated makefiles
Reduces number of make invocations, allows variables exported in project
to be seen in all component make processes, not just the main ones.

Also makes a no-op build about 3x faster than it was.
2016-11-09 16:51:52 +11:00
Liu Zhi Fu
cb5f7690a4 esp32/make: add detailed return error code for wifi APIs
1. Add detailed return error code for wifi APIs
2. Add description about error code in esp_wifi.h
3. Modify esp_wifi_reg_rxcb to esp_wifi_internal_reg_rxcb
4. Modify esp_wifi_set_sta_ip to esp_wifi_internal_set_sta_ip
5. Mark system_init as deprecated API
2016-11-08 18:12:14 +08:00
Angus Gratton
aceb6517c0 Refactor existing bootloader common functionality into bootloader_support component 2016-11-02 17:58:41 +11:00
Angus Gratton
4ba1b73eba build system: Add espefuse/espsecure support for secure boot 2016-11-02 10:41:59 +11:00
Jeroen Domburg
922839d131 Merge branch 'feature/component_hostcc_hostld_etc' into 'master'
Also export HOSTCC etc for components

As title says :)

See merge request !143
2016-10-21 15:52:28 +08:00
Ivan Grokhotkov
4f704ac2fe Merge branch 'feature/release_build' into 'master'
Add menuconfig setting for optimization level

This change adds two options (Debug/Release) for optimization level.
- Debug (default) enables -O0
- Release enables -Os and adds `-DNDEBUG`, which removes all assert() statements

These options may be overriden at project level by adding necessary flags to CFLAGS/CXXFLAGS.

Debugging symbols are kept in both cases, although we may add an option to strip output file if necessary.

Also we used to define all common compiler flags in CPPFLAGS, and then prepended them to CFLAGS/CXXFLAGS.
It made it impossible to add preprocessor macros to CPPFLAGS at component level (one had to use CFLAGS/CXXFLAGS instead).
Some third party libraries are not compatible with this approach. Changed to the more common way of using these variables.

CI will build both debug (default) and release.


See merge request !138
2016-10-21 10:56:03 +08:00
Jeroen Domburg
6b85040059 Also export HOSTCC etc for components 2016-10-20 20:11:13 +08:00
Ivan Grokhotkov
dfe0dcaed4 build system: fix setting C**FLAGS from project makefile 2016-10-20 17:17:54 +08:00
Ivan Grokhotkov
39a06319e2 build system: use -Og instead of -O0 for debug builds, expand help text in menuconfig 2016-10-20 16:10:51 +08:00
Angus Gratton
90cad92b9b Merge branch 'master' into bugfix/build_dir_base 2016-10-18 15:30:57 +11:00
Ivan Grokhotkov
34fa6a60a9 build system: fix typo, move -ggdb to OPTIMIZATION_FLAGS 2016-10-17 13:47:13 +08:00
Ivan Grokhotkov
182184567e build system: add menuconfig choice for optimization level, reorganize C*FLAGS
This change adds two options (Debug/Release) for optimization level.
Debug enables -O0, release enables -Os and adds -DNDEBUG (which removes all assert() statements).
Debugging symbols are kept in both cases, although we may add an option to strip output file if necessary.
Also we used to define all common compiler flags in CPPFLAGS, and then appended them to CFLAGS/CXXFLAGS.
It makes it impossible to add preprocessor macros to CPPFLAGS at component level (one has to use CFLAGS/CXXFLAGS instead).
Some third party libraries are not compatible with this approach. Changed to the more common way of using these variables.
2016-10-17 12:38:17 +08:00
Angus Gratton
609c1c2cdb build system: Add -fno-rtti when compiling C++ code 2016-10-11 07:56:08 +11:00
Angus Gratton
305bc9fd9c build system: Run parallel builds without warnings
Ref github #38
2016-10-06 18:29:34 +11:00
Angus Gratton
f720e82d40 build system: Allow BUILD_DIR_BASE to be a relative directory (see github #38) 2016-10-06 18:05:51 +11:00
Angus Gratton
66882347e8 build system: Fix out-of-tree building via BUILD_DIR_BASE
Closes #38
2016-10-04 15:04:56 +11:00
Jeroen Domburg
f703acd344 Adding -fstrict-volatile-bitfields to the CFLAGS/CXXFLAGS. Without this, gcc tries to access bitfields using the smallest possible methods (eg l8i to
grab an 8-bit field from a 32-bit). Our hardware does not like that. This flag tells gcc that if a bitfield is volatile, it should always use the type
the field is defined at (uint32_t in our case) to size its access to the field. This fixes accessing the hardware through the xxx_struct.h headers.
2016-09-18 12:10:01 +08:00
Angus Gratton
f605e03344 make debugging: With V=1, output when including each Makefile.projbuild
also enable V=1 on CI builds
2016-09-09 11:08:28 +10:00
Angus Gratton
7c58c1e06b Build system: Allow components to add to the global CFLAGS via Makefile.projbuild
Used by mbedTLS to set MBEDTLS_CONFIG_FILE in all components.

This change sets CFLAGS/etc at the project level and then exports those
variables for components, rather than setting them independently each time
a component Makefile is invoked.
2016-09-09 11:08:19 +10:00
Angus Gratton
3b1c3dab4b Name component makefiles component.mk instead of Makefile
Fixes problems with Eclipse trying to build in directories it shouldn't.

This is a breaking change for existing repositories, they need to rename
any component Makefiles to component.mk and rename their references to
$(IDF_PATH)/make/component.mk to $(IDF_PATH)/make/component_common.mk
2016-09-08 13:41:19 +10:00
Angus Gratton
116e730132 Makefile: Don't re-build libraries or re-link ELF files if nothing has changed in the component
make/build_system_tests.sh should now pass.
2016-08-24 13:25:06 +08:00
Angus Gratton
938d13c5a3 Makefile: Rename $(vecho) to $(summary), add new $(details) for echoing details when V=1 2016-08-24 13:25:06 +08:00
Ivan Grokhotkov
f19ac2b927 make: add defconfig, don't run silentoldconfig before menuconfig
This commit fixes the case when new Kconfig configuration options were added and you run `make menuconfig`.
Previously this would first show console prompt to set values for new options, and then launch menuconfig.
Now this will just launch menuconfig.
New target is added, defconfig, which may be useful for non-interactive environments to set default values for
all new configuration options.
2016-08-23 16:18:36 +08:00
Angus Gratton
aa4c31f3b0 esptool.py & Makefile: Fix compressed upload support (enabled by default) 2016-08-22 18:44:46 +08:00
Angus Gratton
f853f94335 Use IDF_PATH instead of SDK_PATH for the environment variable pointing to esp-idf
This will require a matching change in all projects using ESP-IDF.
2016-08-19 15:01:49 +08:00
Angus Gratton
14eb490bb3 make: 'make all' default target builds everything, 'make flash' flashes everything
Also added 'make help' target which prints some useful usage summary.
2016-08-18 21:42:37 +08:00
Angus Gratton
45d1baa24b Make: Fix make bootloader, make bootloader-flash, cleaning of bootloader
Should resolve TW6610
2016-08-18 21:15:47 +08:00
Ivan Grokhotkov
bd6ea4393c Initial public version 2016-08-17 23:08:22 +08:00