Commit Graph

257 Commits (c70baa92893dea61bbe6ae17839b88a4ef9351bd)

Author SHA1 Message Date
Christopher Haster 2be7207388 restructure - Fixed missing symbols in generation of mbed 2 cmsis library 2016-10-04 17:51:44 -05:00
Christopher Haster 96b4ff3358 restructure - Updated mbed 2 build to respect the new cmsis directory 2016-10-04 17:51:44 -05:00
Christopher Haster b8fb7a6e3c restructure - Changed legacy build_lib to respect lib name in path 2016-10-01 19:43:22 -05:00
Christopher Haster a7ddc46caf restructure - Added single-nested inc_dir support to legacy build_lib
Added single-nested include directories to libraries built with the
legacy build_lib function. Unfortunately, to get this working without
a significant rewrite of the legacy build tools, library header files
are just duplicated in the precompile stage.
2016-10-01 14:58:13 -05:00
Christopher Haster 960d69f081 restructure - Updated tools to point to restructured modules
MBED_HAL       /hal/hal      x
MBED_API       /hal/api      x
MBED_COMMON    /hal/common   x
MBED_TARGETS   /hal/targets  ->  /targets
MBED_DRIVERS                  +  /drivers
MBED_PLATFORM                 +  /platform
MBED_HEADER                   +  /mbed.h
2016-09-30 19:18:09 -05:00
Sam Grove 872363d809 Merge pull request #2854 from theotherjimmy/find-duplicates
[Tools] Find and report duplicates
2016-09-30 18:30:00 -05:00
Jimmy Brisson e012185602 Use toolchain notify for printing when finding dupes 2016-09-30 15:14:22 -05:00
Jimmy Brisson a85a384973 Add duplicate detection to project compilation 2016-09-30 15:13:53 -05:00
Jimmy Brisson 9d905a2914 Add regression test for correct percent emitting 2016-09-30 15:09:54 -05:00
Sam Grove dd54f7bf43 Merge pull request #2868 from bridadan/copy-config-json-mbed-lib
[Tools] Copying main config json file for mbed lib builds
2016-09-30 15:03:38 -05:00
Brian Daniels 69448d7d8d Copying main config json file for mbed lib builds 2016-09-29 16:08:16 -05:00
Jimmy Brisson d88852d150 Replace -o with profiles 2016-09-29 10:20:05 -05:00
Jimmy Brisson ceda396e18 Add simple build profiles to toolchains 2016-09-28 17:25:24 -05:00
Jimmy Brisson d4f9820577 Refactor Target and Config away from global variables 2016-09-20 16:09:22 -05:00
Conor Keegan 7c72a22508 Add test command switch for app config file 2016-09-10 15:29:19 +01:00
Jimmy Brisson 7e2ca0115b Update copyright 2016-09-06 14:24:04 -05:00
Sarah Marsh f6a15fd3c8 Refactor export subsystem
Makes several broad changes:
 - removes dead code that dealt with the online build system
 - replaces export function with a much simpler one that:
   - does not copy any sources
   - the zip file hits the disk
   - the mbed_config.h hits the disk
   - the project files hit the disk
   - nothing else hits the disk
 - exporters use Resource object scanned with a toolchain
 - progen exporters don't optionally build a project instead they have a
   build function that may be called afterwards
 - much of the code passes pylint (have a score of 9 or above):
   - project.py
   - project_api.py
   - export/__init__.py
   - export/exporters.py
   - test/export/build_test.py
2016-09-06 14:24:00 -05:00
Sam Grove f147f6f3f2 Merge pull request #2471 from bridadan/copy-config-library
Copying JSON files to pick up config for built libraries
2016-08-26 09:38:35 -05:00
Brian Daniels 33672b483f Copying JSON files to pick up config for built libraries
This came up when building tests, but affects any library that's built
that uses config and included as "source" with the mbed tools.
JSON files are not copied by default when building a library, so when this
is built it loses the config data associated with the library. This commit
copies all JSON files into the build directory when building libraries.

This leads to two mbed_config.h files existing if the build directories
are different between the library and application build. This is the case
when building tests, so an option build_library was added to remove the
mbed_config.h file when compilation is done. This disabled by default when
building libraries, but it is enabled when building tests.
2016-08-23 16:42:05 -05:00
Vincent Coubard fe322adc9c Make selection of c library used consistent.
* rename "default_build" property into "default_lib"
* rename "standard" value for "default_build" into "std".
2016-08-23 16:04:56 +01:00
Jimmy Brisson ea63a4d9a7 Expand docstrings in build_api 2016-08-16 11:04:33 -05:00
Jimmy Brisson b2156ceef5 Format bulid_api 2016-08-16 11:04:32 -05:00
Bogdan Marinescu d471a4f019 Add config data to build_lib in build_api.py
`build_lib` wasn't aware of configuration data, so some of the source
files that depends on configuration data fail to compile. This commit
fixes that by making `build_lib` aware of configuration data.
2016-08-11 13:54:41 +03:00
Bogdan Marinescu 4f6eaaa8ec build_mbed_libs is now aware of the configuration
Previously, build_mbed_libs didn't take into account the configuration.
This is a problem when doing a binary release, since mbed_lib.json
contains configuration data relevant to the binary release.
2016-08-10 19:03:13 +03:00
Brian Daniels 6df903f8a6 Adding clean support back to build_library
At some point, the actual code that did the "clean" for build_library was
removed. This also affected building and cleaning tests. This adds this
capability back to the build API.
2016-08-01 18:16:53 -05:00
Brian Daniels 7a07c386cb Enforcing 'standard' build for mbed OS 5.0 release
This PR enforces that the default_build in a target's definition in
hal/targets.json is set to standard to be included in the version 5
release.

This is being enforced because small builds do not support
multi-threading. This makes the capabilities more consistent across all
boards in the version 5 release.

NOTE: This removes the MOTE_L152RC and the LPC11U68
from the version 5 release list because the 'default_build' for these
targets is currently set to 'small'.
2016-07-28 18:47:49 -05:00
Brian Daniels 0e4b78f840 Changing 'release' key to 'release_versions'.
The key 'release' in hal/targets.json is ambiguous. This changes the key
to 'release_versions' to emphasize that the entries should be version
numbers/strings and that it should be an array, not a singular value.
2016-07-27 13:38:02 -05:00
Brian Daniels 45cb6c6bd0 MCU-Toolchain matrix: release versions and default to mbed OS 5
This modifies the behavior of 'mcu_toolchain_matrix' in build_api.py. It
now prints release version support in the matrix. It also defaults to only
showing targets in mbed OS 5. You can still show older release versions by
modifying the 'release_version' parameter of the function.
2016-07-27 13:36:53 -05:00
Brian Daniels edc580758e Adding concept of release versions for targets.
Previously, the condition for including a target in a release was decided
by a 'release' key being set to 'true' in hal/targets.json. This doesn't
have enough granularity when we release multiple versions of mbed. This PR
changes the 'release' key to an array of strings, where each member is a
version that the target supports. Currently the valid versions are '2' and
'5'.

This PR also adds more robust checking for invalid target configurations
in a release. This is enforced whenever the release list is built from the
data, preventing invalid targets from coming into the release.

Finally, it updates the build_release.py script to use the new api for
fetching release targets.
2016-07-27 13:36:52 -05:00
Brian Daniels 1618e608e7 Test discovery now uses build and toolchain logic
Previously, test discovery throught test.py used its own logic to find
tests. This was mostly a subset of the rules used during the build
process. It respected .mbedignore files, but it did not respect TARGET_,
TOOLCHAIN_, and FEATURES_ directories. This change now uses the same logic
used during building to respect these folders. Tests under these folders
that are not being pulled in for the given target will be ignored.
2016-07-25 14:43:52 -05:00
Brian Daniels 51c575dcc6 Fixed traceback in build_api (typo of resources variable in build_library) 2016-07-22 17:49:54 -05:00
Mihail Stoyanov ac86584c42 Unify common routines in build_api.py
Introduce prepare_toolchain() which handles:
 * deduplication of src_paths
 * config initialization
 * toolchain initialization
 * toolchain flags
 * returns toolchain
Introduce scan_resources() which handles:
 * scanning of sources
 * scanning of include dirs
 * inclusion of addition include dirs
 * returns resources
2016-07-22 22:21:39 +01:00
0xc0170 edf015ad92 Merge branch 'master' into release
Conflicts:
	tools/export/uvision4.py
	tools/export/uvision5.py
2016-07-19 08:44:34 +01:00
Jimmy Brisson 6aa2bbb801 [tools/build_api] Retrun truthy value on success from build_*
before:
```
$  python tools/build.py  -m NRF51_DK --source . -t GCC_ARM,ARM --build build --silent
[SNIP]
Completed in: (3.39)s

Build skipped:
  * GCC_ARM::NRF51_DK
  * ARM::NRF51_DK

```
after:
```
$  python tools/build.py  -m NRF51_DK --source . -t GCC_ARM,ARM --build build --silent
[SNIP]
Completed in: (3.43)s

Build successes:
  * GCC_ARM::NRF51_DK
  * ARM::NRF51_DK

```
2016-07-14 13:55:51 -05:00
0xc0170 9c3801b7b5 Config - fix - use basetring to check if a target is string 2016-07-13 14:59:48 +01:00
Przemek Wirkus 12a01f61ca Add summary for test building
When users are building tests with `mbed compile --tests` whey will by default
get memory map breakdown report.
This can be suppresed in the future with command line switch. For now it is
visible each time users build test cases.
List is sorted by project name created with `build_project` API.

Changes:
* `build_project` now returns tuple (this breaks build_api.build_project API!)
* Memmap script got a aggregation function to print summary from small 'JSON'
  partial reports.
* Report is generated by `test_api.build_tests` function only!

Example:
```
+----------------------------------------------------------------------+--------+-----------+-------------+------------+-------+-------+-----------+
| name                                                                 | target | toolchain | total_flash | static_ram | stack |  heap | total_ram |
+----------------------------------------------------------------------+--------+-----------+-------------+------------+-------+-------+-----------+
| features-feature_ipv4-tests-mbedmicro-net-nist_internet_time_service | K64F   | GCC_ARM   |      132136 |      62288 | 32768 | 65536 |    160592 |
| features-feature_ipv4-tests-mbedmicro-net-tcp_client_echo            | K64F   | GCC_ARM   |      125613 |      62448 | 32768 | 65540 |    160756 |
| features-feature_ipv4-tests-mbedmicro-net-tcp_client_hello_world     | K64F   | GCC_ARM   |      125949 |      62448 | 32768 | 65540 |    160756 |
| features-feature_ipv4-tests-mbedmicro-net-udp_echo_client            | K64F   | GCC_ARM   |      123613 |      62276 | 32768 | 65536 |    160580 |
| features-storage-tests-cfstore-add_del                               | K64F   | GCC_ARM   |       96080 |      13052 | 32768 | 65540 |    111360 |
| features-storage-tests-cfstore-close                                 | K64F   | GCC_ARM   |       95520 |      12004 | 32768 | 65540 |    110312 |
| features-storage-tests-cfstore-create                                | K64F   | GCC_ARM   |       99144 |      13036 | 32768 | 65540 |    111344 |
| features-storage-tests-cfstore-example1                              | K64F   | GCC_ARM   |       98592 |      12368 | 32768 | 65536 |    110672 |
| features-storage-tests-cfstore-example2                              | K64F   | GCC_ARM   |       95232 |      12012 | 32768 | 65540 |    110320 |
| features-storage-tests-cfstore-example3                              | K64F   | GCC_ARM   |       95264 |      11856 | 32768 | 65536 |    110160 |
| features-storage-tests-cfstore-example4                              | K64F   | GCC_ARM   |       92632 |      12012 | 32768 | 65540 |    110320 |
| features-storage-tests-cfstore-example5                              | K64F   | GCC_ARM   |       92344 |      11856 | 32768 | 65536 |    110160 |
| features-storage-tests-cfstore-find                                  | K64F   | GCC_ARM   |       96344 |      13028 | 32768 | 65540 |    111336 |
| features-storage-tests-cfstore-find2                                 | K64F   | GCC_ARM   |       93192 |      12004 | 32768 | 65540 |    110312 |
| features-storage-tests-cfstore-flash                                 | K64F   | GCC_ARM   |       97784 |      12532 | 32768 | 65540 |    110840 |
| features-storage-tests-cfstore-flush                                 | K64F   | GCC_ARM   |       96464 |      12012 | 32768 | 65540 |    110320 |
| features-storage-tests-cfstore-flush2                                | K64F   | GCC_ARM   |       95056 |      12004 | 32768 | 65540 |    110312 |
| features-storage-tests-cfstore-init                                  | K64F   | GCC_ARM   |       93120 |      12012 | 32768 | 65540 |    110320 |
| features-storage-tests-cfstore-misc                                  | K64F   | GCC_ARM   |       96808 |      12516 | 32768 | 65540 |    110824 |
| features-storage-tests-cfstore-open                                  | K64F   | GCC_ARM   |       98632 |      12540 | 32768 | 65540 |    110848 |
| features-storage-tests-cfstore-read                                  | K64F   | GCC_ARM   |       94112 |      12540 | 32768 | 65540 |    110848 |
| features-storage-tests-cfstore-write                                 | K64F   | GCC_ARM   |       94488 |      12004 | 32768 | 65540 |    110312 |
| features-storage-tests-flash_journal-basicapi                        | K64F   | GCC_ARM   |      104712 |      21236 | 32768 | 65540 |    119544 |
| frameworks-utest-tests-unit_tests-basic_test                         | K64F   | GCC_ARM   |       71534 |      11468 | 32768 | 65540 |    109776 |
| frameworks-utest-tests-unit_tests-case_async_validate                | K64F   | GCC_ARM   |       74598 |      11468 | 32768 | 65540 |    109776 |
| frameworks-utest-tests-unit_tests-case_control_async                 | K64F   | GCC_ARM   |       74630 |      11476 | 32768 | 65540 |    109784 |
| frameworks-utest-tests-unit_tests-case_control_repeat                | K64F   | GCC_ARM   |       72790 |      11452 | 32768 | 65540 |    109760 |
| frameworks-utest-tests-unit_tests-case_selection                     | K64F   | GCC_ARM   |       72302 |      11468 | 32768 | 65540 |    109776 |
| frameworks-utest-tests-unit_tests-case_setup_failure                 | K64F   | GCC_ARM   |       72630 |      11468 | 32768 | 65540 |    109776 |
| frameworks-utest-tests-unit_tests-case_teardown_failure              | K64F   | GCC_ARM   |       72790 |      11468 | 32768 | 65540 |    109776 |
| frameworks-utest-tests-unit_tests-control_type                       | K64F   | GCC_ARM   |       82462 |      11468 | 32768 | 65540 |    109776 |
| frameworks-utest-tests-unit_tests-minimal_async_scheduler            | K64F   | GCC_ARM   |       72182 |      11468 | 32768 | 65540 |    109776 |
| frameworks-utest-tests-unit_tests-minimal_scheduler                  | K64F   | GCC_ARM   |       71998 |      11468 | 32768 | 65540 |    109776 |
| frameworks-utest-tests-unit_tests-test_assertion_failure_test_setup  | K64F   | GCC_ARM   |       71710 |      11460 | 32768 | 65540 |    109768 |
| frameworks-utest-tests-unit_tests-test_setup_case_selection_failure  | K64F   | GCC_ARM   |       71702 |      11468 | 32768 | 65540 |    109776 |
| frameworks-utest-tests-unit_tests-test_setup_failure                 | K64F   | GCC_ARM   |       71710 |      11468 | 32768 | 65540 |    109776 |
| tests-integration-basic                                              | K64F   | GCC_ARM   |       67566 |      10780 | 32768 | 65540 |    109088 |
| tests-integration-threaded_blinky                                    | K64F   | GCC_ARM   |       68326 |      10780 | 32768 | 65540 |    109088 |
| tests-mbed_drivers-c_strings                                         | K64F   | GCC_ARM   |       74438 |      11468 | 32768 | 65540 |    109776 |
| tests-mbed_drivers-callback                                          | K64F   | GCC_ARM   |       88310 |      11972 | 32768 | 65540 |    110280 |
| tests-mbed_drivers-dev_null                                          | K64F   | GCC_ARM   |       90213 |      10784 | 32768 | 65540 |    109092 |
| tests-mbed_drivers-echo                                              | K64F   | GCC_ARM   |       71918 |      11468 | 32768 | 65540 |    109776 |
| tests-mbed_drivers-generic_tests                                     | K64F   | GCC_ARM   |       77624 |      11468 | 32768 | 65540 |    109776 |
| tests-mbed_drivers-rtc                                               | K64F   | GCC_ARM   |       85854 |      11308 | 32768 | 65540 |    109616 |
| tests-mbed_drivers-stl_features                                      | K64F   | GCC_ARM   |       80726 |      11476 | 32768 | 65540 |    109784 |
| tests-mbed_drivers-ticker                                            | K64F   | GCC_ARM   |       70974 |      11308 | 32768 | 65540 |    109616 |
| tests-mbed_drivers-ticker_2                                          | K64F   | GCC_ARM   |       70790 |      11308 | 32768 | 65540 |    109616 |
| tests-mbed_drivers-ticker_3                                          | K64F   | GCC_ARM   |       71038 |      11308 | 32768 | 65540 |    109616 |
| tests-mbed_drivers-timeout                                           | K64F   | GCC_ARM   |       70886 |      11308 | 32768 | 65540 |    109616 |
| tests-mbed_drivers-wait_us                                           | K64F   | GCC_ARM   |       70414 |      11308 | 32768 | 65540 |    109616 |
| tests-mbedmicro-mbed-attributes                                      | K64F   | GCC_ARM   |       71534 |      11460 | 32768 | 65540 |    109768 |
| tests-mbedmicro-mbed-call_before_main                                | K64F   | GCC_ARM   |       73112 |      10780 | 32768 | 65540 |    109088 |
| tests-mbedmicro-mbed-cpp                                             | K64F   | GCC_ARM   |       73400 |      10780 | 32768 | 65540 |    109088 |
| tests-mbedmicro-mbed-div                                             | K64F   | GCC_ARM   |       73176 |      10780 | 32768 | 65540 |    109088 |
| tests-mbedmicro-rtos-mbed-basic                                      | K64F   | GCC_ARM   |       68390 |      10780 | 32768 | 65540 |    109088 |
| tests-mbedmicro-rtos-mbed-isr                                        | K64F   | GCC_ARM   |       74480 |      10780 | 32768 | 65540 |    109088 |
| tests-mbedmicro-rtos-mbed-mail                                       | K64F   | GCC_ARM   |       74992 |      11300 | 32768 | 65540 |    109608 |
| tests-mbedmicro-rtos-mbed-mutex                                      | K64F   | GCC_ARM   |       74048 |      10780 | 32768 | 65540 |    109088 |
| tests-mbedmicro-rtos-mbed-queue                                      | K64F   | GCC_ARM   |       74912 |      11300 | 32768 | 65540 |    109608 |
| tests-mbedmicro-rtos-mbed-semaphore                                  | K64F   | GCC_ARM   |       74296 |      10780 | 32768 | 65540 |    109088 |
| tests-mbedmicro-rtos-mbed-signals                                    | K64F   | GCC_ARM   |       74328 |      10780 | 32768 | 65540 |    109088 |
| tests-mbedmicro-rtos-mbed-threads                                    | K64F   | GCC_ARM   |       75214 |      11460 | 32768 | 65540 |    109768 |
| tests-mbedmicro-rtos-mbed-timer                                      | K64F   | GCC_ARM   |       68430 |      10780 | 32768 | 65540 |    109088 |
| tests-storage_abstraction-basicapi                                   | K64F   | GCC_ARM   |      107808 |      28908 | 32768 | 65540 |    127216 |
+----------------------------------------------------------------------+--------+-----------+-------------+------------+-------+-------+-----------+
```

Refactored after code review

Refactored parse() function

Polishing

Moved memory usage reporting function call to test.py to group all reporters in one place

Bug-fix: on ARM toolchain we were not fetching statistics from last element of memap result list
2016-07-07 08:35:20 +01:00
Bogdan Marinescu e3d29fe5d2 Improve configuration handling in build_project
The configuration object is now created early in the build_project
function. This way, if there's a mbed_app.json that contains a custom
target, that target is taken into account. This is useful (for example)
when compiling tests for an application that defines a custom target.
2016-07-05 15:40:12 +03:00
Bogdan Marinescu b4e8cf655d Fixed config-related options for the IAR assembler
The IAR assembler doesn't accept '--preinclude', but it accepts -D.
This commit changes the way the config-related macros are propagated
to the IAR assembler to use '-D' instead of '--preinclude'. This is
the only change related to functionality, the others are small,
backward compatible changes to the config code to make passing arguments
to the toolchain instances easier.

Tested by compiled blinky with IAR, GCC_ARM and ARM for K64F.
2016-06-27 15:54:38 +03:00
Mihail Stoyanov 89bb38f683 Fixed exporters to support features
Unified how resources are loaded into the configuration system
(Config.load_resources) and applied it to build_api and exporters
2016-06-16 18:12:04 +01:00
Martin Kojtal 1e18ea230a Merge pull request #1957 from mbedmicro/config_headers
Configuration in header files - step 1
2016-06-16 18:47:15 +02:00
Bogdan Marinescu a164224acf Changed prefix file name to mbed_conf.h
Also changed some function names to make it clear that the prefix
headers feature is only used for config.
2016-06-16 17:01:41 +03:00
Bogdan Marinescu 85eca37d29 Added toolchain support for configuration in prefix headers
This commit uses the previously introduced feature of generating
configuration data as a C header file rather than as command line macro
definitions. Each toolchain was modified to use prefix headers if
requested, and build_api.py was modified to set up the toolchain's
prefix header content using the data generated by the config system.

Tested by compiling blinky for GCC and ARMCC. I'm having a few issues
with my IAR license currently, but both ARMCC and IAR use the same
`--preinclude` option for prefix headers, so this shouldn't be an issue.

Note that at the moment all exporters still use the previous
configuration data mechanism (individual macro definitions as opposed to
a prefix header). Exporters will be updated in one or more PRs that will
follow.
2016-06-16 16:13:50 +03:00
Mihail Stoyanov e44566b319 Fix libraries being built with features support 2016-06-16 00:31:25 +01:00
Mihail Stoyanov a81746c8f6 Fix for features not being included
Also improve compile speed by not re-scanning the source locations
2016-06-15 22:21:31 +01:00
Sam Grove 7e0e6854b9 Merge pull request #1940 from geky/fix-features
[build tools] Added better support for features and recursive configs
2016-06-15 18:46:38 +01:00
Mihail Stoyanov 99ed4e03f1 Restore original compile sources routine 2016-06-15 17:18:40 +01:00
Brian Daniels 5a46ac773b Fixing test builds for devices with softdevices.
Previously, .hex files were not copied when building source as a library.
This prevents builds that pre compile source as a library and then
includes the build directory as the only source (because there is no
softdevice present). This PR copies hex files when compiling source
as a library.
2016-06-15 15:21:16 +01:00
Christopher Haster 41daccf8d9 [build tools] Fixed masked out configuration error 2016-06-15 08:38:20 -05:00
Christopher Haster 6da324fa3f [build tools] Added test coverage for config features feature 2016-06-15 08:38:20 -05:00
Christopher Haster ce0606a756 [build tools] Added better support for features and recursive configs
per @screamerbg
2016-06-15 08:38:20 -05:00
Brian Daniels 6796025e78 Fixes for logs and test logic in tools 2016-06-14 02:14:42 +01:00
Mihail Stoyanov dcff9b15e7 Minor update to tools - logging of tests and output 2016-06-14 01:57:01 +01:00
Mihail Stoyanov 9dbf80722d Aligned make.py and build.py options 2016-06-12 01:06:15 +01:00
Mihail Stoyanov f6acb1ffb4 Forward ported changes to tools 2016-06-10 15:19:02 +01:00
Mihail Stoyanov 9f62d70fbf Update project generator script to allow working with any source
Update test exporters script
Update travis build script
Added config system CLI script
Fixed building of legacy libraries and layouts
2016-06-10 02:24:27 +01:00
Mihail Stoyanov c2e3001739 Add config system, memap, updates to build_api and toolchains 2016-06-09 23:50:03 +01:00
Mihail Stoyanov 3d45b2cdbb Renamed workspace_tools folder to tools 2016-06-09 21:34:53 +01:00