Commit Graph

111 Commits (a534c20a1745a4162158dda36247e6327c50b18a)

Author SHA1 Message Date
Brian Daniels 427664c789 Passing verbose option to build apis in test.py 2016-06-06 12:31:13 +01:00
Martin Kojtal c6b51d7fe3 Merge pull request #204 from theotherjimmy/1830-counterpart
added support for features array to build tools
2016-06-06 10:23:02 +01:00
Martin Kojtal b1aba7f3c4 Merge pull request #170 from bridadan/build_everything
Adding a "build everything" script
2016-06-06 10:00:11 +01:00
Jimmy Brisson 90ecda6b73 added support for features array to toolchains 2016-06-03 16:18:59 -05:00
Bogdan Marinescu 6f1298b02b Added support for viewing the configuration
get_config.py can be used to view the configuration of the mbed project
that's being compiled:

- without '-v' it displays a simple list of configuration parameters and
  their values
- with '-v' it displays additional data for each configuration parameter
  (like the place of definition and the last place that set a value for
   the configuration parameter).

Tested by running "get_config.py" on a few tests from
tools/test/config_test.
2016-06-03 19:06:21 +03:00
Bogdan Marinescu 0549b1e7c5 Added tests for the configuration mechanism
The tests check a number of features of the configuration mechanism
(mostly the inheritance and overriding of configuration parameters), as
well as the behavarious in various abnormal situations.
2016-06-02 15:09:56 +03:00
Bogdan Marinescu d83dc27fcf Add configuration mechanism
This commit adds the implementation of the configuration mechanism and
applies it for two uses cases:

- building a program (build_project in build_api.py)
- building a library (build_library in build_api.py)

There's also a new method 'get_config' in build_api.py that's used to
return the configuration of a project. Currently, it's used only for
testing, the intention is to use it for the implementation of the 'mbed
config' command.

Tested with various test configurations on the "blinky" example and also
with its own set of tests (to be added in a separate commit).

'make.py' was modified to send the target *name* to build_project, as
opposed to the target *instance*. This is needed because the
coniguration mechanism allows for creating custom targets, but these
targets are not available until the configuration file
mbed_app_config.json is parsed, which happens in build_project (so
before make.py calls 'build_project'). The API of build_project didn't
change, it now accepts both target names and target instances for the
'target' argument.

Known issues:

- doesn't currently work when doing binary builds of the SDK. Currently,
  building the SDK is broken in mbed-os, so this will be added later.
- when building tests, the build process ends up calling
  'build_project', so the configuration mechanism should play well with
  tests. However, this wasn't tested.

A later commit will all documentation for the configuration mechanism.
2016-06-02 15:09:52 +03:00
Bogdan Marinescu 031cc7fbc5 Added scanning for JSON files in the resource scanner
Also added a method to add new macros to the toolchain instance.
Both of these changes are needed by the configuration mechanism.
2016-06-02 11:32:58 +03:00
Bogdan Marinescu 7c920259cc Improvements to the targets implementation
- added a method that can be used to new targets dynamically (this
  will be used by the configuration mechanism).
- the JSON parser now keeps the order of the keys read from the JSON
  file (will also be used by the configuration mechanism).
- there's now a global target cache in targets.py, so that a target
  with a given name will only be created once.
2016-06-02 11:32:58 +03:00
Brian Daniels f649a2a2a8 Making the default number of build jobs 0 (auto/fully parallel) 2016-06-01 09:07:20 -05:00
Brian Daniels 8877ac40f6 Adding a script to build mbed OS and all tests for all targets and toolchains 2016-05-31 17:34:02 -05:00
Brian Daniels a333ec8ef0 Fixing issue with binary name.
There was an issue where the binary name was incorrectly set when building
from any directory that isn't the project root. This fixes that issue by
first getting the absolute path, then finding the binary name using that.
2016-05-31 12:41:12 -05:00
Martin Kojtal 583ed4320d Merge pull request #155 from bridadan/fix-binary-naming
Fixing issue where project_name was an empty string
2016-05-30 10:36:32 +01:00
Russ Butler 3dac400d38 Pull in mbedmicro/mbed
Pull in mbedmicro/mbed.  Make the following changes in addition:
- Ignore unused directories in mbed
- Add stub mbed-drivers/mbed.h for backwards compatibility
- Remove targets.json and instead use mbed's version
2016-05-28 00:40:59 -05:00
Russ Butler aa3c0deb70 Merge pull request #156 from theotherjimmy/mbedignore-fix
check for .mbedignore in root of source folders
2016-05-27 15:36:25 -05:00
Russ Butler 4443116172 Merge pull request #137 from bridadan/continue-test-build-if-fail
Allowing test builds to continue if one test build fails
2016-05-27 14:48:58 -05:00
Jimmy Brisson ba29012abb check for .mbedignore in root of source folders 2016-05-27 14:01:06 -05:00
Brian Daniels 6e4d74bc24 Fixing issue where project_name was an empty string 2016-05-27 12:00:26 -05:00
Jimmy Brisson 2d47ab1cdd projects are now named via command line -n 2016-05-27 09:46:03 +01:00
Jimmy Brisson d772ea7a00 Allowed multiple --source specifications on the export command
The project name is set to the first --source argument.
Resources (the class) is now a monoid.
2016-05-27 09:45:45 +01:00
Russ Butler bb17d6ada9 Rename disassembly file to fix testing with IAR
Disassembly files can unintentionally get picked up by the test build
system.  This patch changes the file extension on those files from
".s" to ".s.txt" so they are ignored.
2016-05-26 17:37:43 -05:00
Brian Daniels 6dbc9601f8 Reflecting build failures in the status code of the process 2016-05-26 09:20:24 -05:00
Brian Daniels 7a627b3fdd Allowing test builds to continue if one test build fails
This ensures that a build report is produced, even if a build fails. This
allows you to see what went wrong later.
2016-05-26 09:10:17 -05:00
Martin Kojtal c71e81b371 Merge pull request #122 from bridadan/test-script-macros
Adding macro option to test.py script
2016-05-26 13:12:01 +01:00
Martin Kojtal bfe4c20e4b Merge pull request #130 from bridadan/default-parallel-test-build
Defaulting to parallel builds for tests
2016-05-25 13:53:30 +01:00
Brian Daniels c29f66e851 Defaulting to parallel builds for tests 2016-05-24 16:44:42 -05:00
Russ Butler 960941cb0a Add IAR support
Make the following changes for IAR support:
-define __deprecated_message for IAR
-fix python error in iar.py
-move variable length array in buffered serial from cpp file to c file.
    IAR only supports variable length arrays in c.
2016-05-24 14:37:14 -05:00
Brian Daniels d676b19105 Adding macro option to test.py script 2016-05-24 09:10:37 -05:00
Bogdan Marinescu 8a6e9c3a26 Merge pull request #98 from ARMmbed/json_targets
Moved target definitions to JSON format
2016-05-24 12:58:59 +03:00
Sam Grove 42624d06af Merge pull request #89 from bridadan/test-build-reporting
Test build reporting
2016-05-24 08:18:25 +08:00
Brian Daniels 40cc3eef9e Splitting the upload of tests.
Added a parameter '-l' to control how many project runs are uploaded at a
time. The default is 1000. The prevents HTTP errors when the POST request
is too large.
2016-05-23 10:51:52 -05:00
Brian Daniels bc86aa92a0 Adding JUnit build reporting option to test.py 2016-05-23 10:50:22 -05:00
Brian Daniels ec2e4a1d6a Adding default id for the build report if no id is provided 2016-05-23 10:50:21 -05:00
Sam Grove 6c3ce1ea64 Merge pull request #112 from SeppoTakalo/master
Implement the .mbedignore functionality.
2016-05-23 23:30:44 +08:00
Sam Grove 59f5751b6d Merge pull request #113 from theotherjimmy/error-bad-source
added a check for existance of sources
2016-05-20 16:40:52 -05:00
Sam Grove c4ed177930 Merge pull request #68 from 0xc0170/dev_gcc_sizes
gcc - print section sizes
2016-05-20 15:49:28 -05:00
Sam Grove 373fb55441 Merge pull request #114 from c1728p9/iar_vla
Turn on variable length arrays in C for IAR
2016-05-20 15:36:21 -05:00
Bogdan Marinescu cdfa46c790 Fixes to the new targets code
It is now possible to remove a macro using "_remove" for both macros
without vale (MACRO) and macros with value (MACRO=VALUE) simply by
specifying the macro name.
2016-05-20 17:27:43 +03:00
Russ Butler c4986eed9f Create map file when building
Add compiler flags to ARM, GCC and IAR so map files get created.
2016-05-19 15:52:02 -05:00
Russ Butler 080f9e2371 Turn on variable length arrays in C for IAR
Turn on support for variable length arrays for the IAR C compiler.
This provides greater compatibility with GCC and ARMCC.

Note: The current version of iccarm at the time of this patch
(V7.40.3.8902) does not support variable length arrays in C++.
2016-05-18 19:58:46 -05:00
Jimmy Brisson f44b8fc9bf added a check for existance of sources
I ran into this earlier today and yesterday:
If you spelled something wrong/forgot to tab complete and had build succesfully before it woild silently and incorrectly build successfully
2016-05-18 17:28:33 -05:00
Seppo Takalo 3d3b0a771f Implement the .mbedignore functionality.
Check the content of `.mbedignore` files and try to match the file
patterns against the directories and source files found while travelling
the directory structure.

Every line in `.mbedignore` file is treated as a unix style glob pattern.
Before matching, the pattern is appended with its directory location, so
it will match only folder on same level, or deeper in the directory structure.

For example:
Directory ./source/test contains .mbedignore with content:
`unittest/*`

Then everything under ./source/test/unittest/ is ignored, including the
unittest folder itself.

Another example:
When .mbedignore file contains just `*`, then everything under the folder
it is located, is ignored. It won't even be added to include paths.
2016-05-19 00:23:37 +03:00
Martin Kojtal c357216217 Add static ram/rom info
After a build has been completed print out ram and rom usage.
The sizes shown are the same as those reported by
arm-none-eabi-size.exe.  The output looks like:

Memory sections sizes:
text                 37244
data                 60
bss                  7800
2016-05-18 15:55:10 -05:00
Mihail Stoyanov faa9ce76af Removed fixes intended for different PR 2016-05-17 19:46:42 +01:00
Bogdan Marinescu 7c57269dcf Moved target definitions to JSON format
(long commit message ahead. Sorry about that, it can't be helped.)

This commit changs targets definition from Python to JSON format, as
part of the configuration mechanism implementation. There is a new file
under tools/ called "targets.json" which contains the target
definitions. "targets.py" remains, but becomes a wrapper on top of
"targets.json", with the same interface as before. This has the
advantage of not requiring code changes outside "targets.py".

Most of the JSON definitions of targets were automatically generated by a
script (available upon request since it doesn't make a lot of sense to
include it here), only those targets that had more than one parent in
the Python implementation were converted by hand. The target definitions
should be pretty self-explanatory. A number of things are different in
the JSON implementation (this is just a summary, a separate commit that
documents how to write target definitions will follow later):

- "program_cycle_s" is now a value (as opposed to a function in the
Python implementation), since it only returned a number in all the
Python target implementations. The main definition that actually contains
some code (in class "Target") remains in target.py
- array values in "macros" and "extra_labels" can be modified
dynamically. Values can be added using "macros_add" and
"extra_labels_add" or removed using "macros_remove" and
"extra_labels_remove". This mechanism is available for all attributes
with a list type, but it's currently enabled only for "macros" and
"extra_labels" to keep things simple.
- "init_hooks"/"binary_hook" are now implemented in terms of a single
JSON key valled "post_binary_hook". The corresponding code is also in
"targets.py", under the various TargetCode classes (see for example
LPC4088Code in targets.py).

Just like in the Python implementation, a target can inherit from zero,
one or more targets. The resolution order for the target's attributes
follows the one used by the Python code (I used
http://makina-corpus.com/blog/metier/2014/python-tutorial-understanding-python-mro-class-search-path
as a reference for the implementation of resolution order).

This is obviously a very dangerous commit, since it affects all targets.
Unfortunately, since mbed-os only compiles for K64F, I didn't have many
chances to try to compile mbed-os with different targets. I did it for
K64F in different scenarios (pretending that it has hooks, for example),
but there's definitely a lot more to be done there. The threaded blinky
example for K64F compiles and works.

I tried to test in a different way: I wrote a script that imports the
old (Python) and the new (JSON) implementations and verifies that the
attributes in the old implementations exist and have the same values
in the new implementations (it also verifies that the attribute
resolution order is the same in the two implementations). If you're
interested, the script is here:

https://gist.github.com/bogdanm/4caf3a11613dcec834b05d5ab87c65dc

And the results of running the script are below (note that the script
outputs only the target names that were found to be problematic):

F51_MICROBIT_BOOT:
    Resolution order is different in old and new
        old: ['NRF51_MICROBIT_BOOT', 'MCU_NRF51_16K_BOOT_S110', 'MCU_NRF51_16K_BOOT_BASE', 'MCU_NRF51_16K_BASE', 'MCU_NRF51', 'Target', 'MCU_NRF51_S110']
        new: ['NRF51_MICROBIT_BOOT', 'MCU_NRF51_16K_BOOT_S110', 'MCU_NRF51_S110', 'MCU_NRF51_16K_BOOT_BASE', 'MCU_NRF51_16K_BASE', 'MCU_NRF51', 'Target']
    'extra_labels' has different values in old and new
        old: ['NORDIC', 'MCU_NRF51', 'MCU_NRF51822', 'MCU_NORDIC_16K', 'MCU_NRF51_16K', 'MCU_NRF51_16K_BOOT', 'MCU_NRF51_16K_S110', 'NRF51_MICROBIT']
        new: ['NORDIC', 'MCU_NRF51', 'MCU_NRF51822', 'MCU_NORDIC_16K', 'MCU_NRF51_16K', 'MCU_NRF51_16K_S110', 'MCU_NRF51_16K_BOOT', 'NRF51_MICROBIT']
    'macros' has different values in old and new
        old: ['NRF51', 'TARGET_NRF51822', 'TARGET_MCU_NORDIC_16K', 'TARGET_MCU_NRF51_16K', 'TARGET_MCU_NRF51_16K_BOOT', 'TARGET_OTA_ENABLED', 'TARGET_MCU_NRF51_16K_S110', 'TARGET_NRF51_MICROBIT', 'TARGET_NRF_LFCLK_RC']
        new: ['NRF51', 'TARGET_NRF51822', 'TARGET_MCU_NORDIC_16K', 'TARGET_MCU_NRF51_16K', 'TARGET_MCU_NRF51_16K_S110', 'TARGET_MCU_NRF51_16K_BOOT', 'TARGET_OTA_ENABLED', 'TARGET_NRF51_MICROBIT', 'TARGET_NRF_LFCLK_RC']
NRF51_MICROBIT:
    Resolution order is different in old and new
        old: ['NRF51_MICROBIT', 'MCU_NRF51_16K_S110', 'MCU_NRF51_16K_BASE', 'MCU_NRF51', 'Target', 'MCU_NRF51_S110']
        new: ['NRF51_MICROBIT', 'MCU_NRF51_16K_S110', 'MCU_NRF51_S110', 'MCU_NRF51_16K_BASE', 'MCU_NRF51', 'Target']
    'extra_labels' has different values in old and new
        old: ['NORDIC', 'MCU_NRF51', 'MCU_NRF51822', 'MCU_NORDIC_16K', 'MCU_NRF51_16K', 'MCU_NRF51_16K_S110']
        new: ['NORDIC', 'MCU_NRF51', 'MCU_NRF51822', 'MCU_NRF51_16K_S110', 'MCU_NORDIC_16K', 'MCU_NRF51_16K']
    'macros' has different values in old and new
        old: ['NRF51', 'TARGET_NRF51822', 'TARGET_MCU_NORDIC_16K', 'TARGET_MCU_NRF51_16K', 'TARGET_MCU_NRF51_16K_S110', 'TARGET_NRF_LFCLK_RC']
        new: ['NRF51', 'TARGET_NRF51822', 'TARGET_MCU_NRF51_16K_S110', 'TARGET_MCU_NORDIC_16K', 'TARGET_MCU_NRF51_16K', 'TARGET_NRF_LFCLK_RC']
NRF51_MICROBIT_OTA:
    Resolution order is different in old and new
        old: ['NRF51_MICROBIT_OTA', 'MCU_NRF51_16K_OTA_S110', 'MCU_NRF51_16K_OTA_BASE', 'MCU_NRF51_16K_BASE', 'MCU_NRF51', 'Target', 'MCU_NRF51_S110']
        new: ['NRF51_MICROBIT_OTA', 'MCU_NRF51_16K_OTA_S110', 'MCU_NRF51_S110', 'MCU_NRF51_16K_OTA_BASE', 'MCU_NRF51_16K_BASE', 'MCU_NRF51', 'Target']
    'extra_labels' has different values in old and new
        old: ['NORDIC', 'MCU_NRF51', 'MCU_NRF51822', 'MCU_NORDIC_16K', 'MCU_NRF51_16K', 'MCU_NRF51_16K_OTA', 'MCU_NRF51_16K_S110', 'NRF51_MICROBIT']
        new: ['NORDIC', 'MCU_NRF51', 'MCU_NRF51822', 'MCU_NORDIC_16K', 'MCU_NRF51_16K', 'MCU_NRF51_16K_S110', 'MCU_NRF51_16K_OTA', 'NRF51_MICROBIT']
    'macros' has different values in old and new
        old: ['NRF51', 'TARGET_NRF51822', 'TARGET_MCU_NORDIC_16K', 'TARGET_MCU_NRF51_16K', 'TARGET_MCU_NRF51_16K_OTA', 'TARGET_OTA_ENABLED', 'TARGET_MCU_NRF51_16K_S110', 'TARGET_NRF51_MICROBIT', 'TARGET_NRF_LFCLK_RC']
        new: ['NRF51', 'TARGET_NRF51822', 'TARGET_MCU_NORDIC_16K', 'TARGET_MCU_NRF51_16K', 'TARGET_MCU_NRF51_16K_S110', 'TARGET_MCU_NRF51_16K_OTA', 'TARGET_OTA_ENABLED', 'TARGET_NRF51_MICROBIT', 'TARGET_NRF_LFCLK_RC']
NOT OK: ['NRF51_MICROBIT', 'NRF51_MICROBIT_BOOT', 'NRF51_MICROBIT_OTA']

The reasons for the above output are subtle and related to the
extremely weird way in which we defined target data in the old
implementation: we used both class attributes and instance attributes.
This can complicate resolution order quite a bit and those two levels
don't exist in JSON: there's only one attribute type (equivalent to
Python's instance attributes). To make that work, I had to change the
inheritance order of the above targets (that use multiple inheritance)
which in turn changed the order of some macros and extra_labels (and of
course the resolution order). No harm done: the values are the same,
only their ordering is different. I don't believe this causes any
problems for 'extra_labels' and 'macros'.

This method of testing has its limitations though; in particular, it
can't test the hooks. I'm opened to ideas about how to test this better,
but I think that we need to remember that this commit might break some
targets and keep an eye out for "weird errors" in the future.
2016-05-17 11:34:02 +03:00
Mihail Stoyanov b57fbf4c68 Exclude folders from build that contain .buildignore file (part of de-fork of mbed HAL+RTOS) 2016-05-16 13:06:54 +01:00
Brian Daniels 4ae7d54830 Fixing build issues for tests.
Build artifacts from previous builds were polluting the current build. Now
shared sources are built as a library, then tests are built into their own
folder.
2016-05-10 14:53:35 +01:00
Bogdan Marinescu 904ea446eb Merge pull request #84 from screamerbg/compile-response-files
Response files for includes, de-duplicate includes and more
2016-05-10 12:05:16 +03:00
Mihail Stoyanov 7e3b69ec13 Add dot to include response file name, which follows the naming convention with .link_totals.txt and .link_files.txt 2016-05-09 19:08:56 +01:00
Mihail Stoyanov d33f890fdd Minor code cleanup 2016-05-09 19:08:56 +01:00