-
Notifications
You must be signed in to change notification settings - Fork 3k
Add --build-data switch to mbed compile and test #4110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
9b1aa84
to
4c9e6dc
Compare
could you add
I think its still usefull.. |
|
So, this is what the file looks like for an incremental build: {
"builds": [
{
"bin": "./BUILD/K64F/gcc_arm/mbed-os-example-fat-filesystem.bin",
"linker": {
"flags": [
"-Wl,--gc-sections",
"-Wl,--wrap,main",
"-Wl,--wrap,_malloc_r",
"-Wl,--wrap,_free_r",
"-Wl,--wrap,_realloc_r",
"-Wl,--wrap,_calloc_r",
"-Wl,--wrap,exit",
"-Wl,--wrap,atexit",
"-Wl,-n",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=softfp"
]
},
"description": "mbed-os-example-fat-filesystem",
"library_configs": [
"mbed-os/features/netsocket/mbed_lib.json",
"mbed-os/features/frameworks/utest/mbed_lib.json",
"mbed-os/features/filesystem/mbed_lib.json",
"mbed-os/rtos/mbed_lib.json",
"mbed-os/platform/mbed_lib.json",
"mbed-os/events/mbed_lib.json",
"mbed-os/features/FEATURE_LWIP/lwip-interface/mbed_lib.json",
"mbed-os/features/storage/FEATURE_STORAGE/cfstore/mbed_lib.json"
],
"target_name": "K64F",
"assembler": {
"symbols": [
"__CORTEX_M4",
"CPU_MK64FN1M0VMD12",
"ARM_MATH_CM4",
"__FPU_PRESENT=1",
"__MBED_CMSIS_RTOS_CM",
"__CMSIS_RTOS",
"FSL_RTOS_MBED"
],
"flags": [
"-x",
"assembler-with-cpp"
]
},
"elf": "./BUILD/K64F/gcc_arm/mbed-os-example-fat-filesystem.elf",
"cxx_compiler": {
"symbols": [
"FEATURE_LWIP=1",
"__MBED__=1",
"DEVICE_I2CSLAVE=1",
"__FPU_PRESENT=1",
"TARGET_Freescale",
"DEVICE_PORTINOUT=1",
"TARGET_RTOS_M4_M7",
"DEVICE_LOWPOWERTIMER=1",
"DEVICE_RTC=1",
"TOOLCHAIN_object",
"DEVICE_SERIAL_ASYNCH=1",
"__CMSIS_RTOS",
"FSL_RTOS_MBED",
"DEVICE_STORAGE=1",
"TARGET_KPSDK_MCUS",
"TARGET_FLASH_CMSIS_ALGO",
"TOOLCHAIN_GCC",
"ARM_MATH_CM4",
"TARGET_KSDK2_MCUS",
"TARGET_LIKE_CORTEX_M4",
"DEVICE_ANALOGOUT=1",
"TARGET_M4",
"TARGET_UVISOR_UNSUPPORTED",
"TARGET_K64F",
"DEVICE_SPI_ASYNCH=1",
"DEVICE_PWMOUT=1",
"DEVICE_INTERRUPTIN=1",
"DEVICE_I2C=1",
"DEVICE_PORTOUT=1",
"__CORTEX_M4",
"DEVICE_STDIO_MESSAGES=1",
"CPU_MK64FN1M0VMD12",
"TARGET_LIKE_MBED",
"TARGET_FF_ARDUINO",
"TARGET_KPSDK_CODE",
"TARGET_RELEASE",
"DEVICE_SERIAL_FC=1",
"DEVICE_ERROR_RED=1",
"DEVICE_TRNG=1",
"__MBED_CMSIS_RTOS_CM",
"DEVICE_SLEEP=1",
"TOOLCHAIN_GCC_ARM",
"TARGET_FRDM",
"TARGET_MCUXpresso_MCUS",
"DEVICE_SPI=1",
"FEATURE_STORAGE=1",
"MBED_BUILD_TIMESTAMP=1491336376.18",
"DEVICE_SPISLAVE=1",
"DEVICE_ANALOGIN=1",
"DEVICE_SERIAL=1",
"DEVICE_FLASH=1",
"DEVICE_PORTIN=1",
"TARGET_MCU_K64F",
"TARGET_CORTEX_M"
],
"flags": [
"-std=gnu++98",
"-fno-rtti",
"-Wvla"
]
},
"elapsed_time": 0.5062179565429688,
"c_compiler": {
"symbols": [
"FEATURE_LWIP=1",
"__MBED__=1",
"DEVICE_I2CSLAVE=1",
"__FPU_PRESENT=1",
"TARGET_Freescale",
"DEVICE_PORTINOUT=1",
"TARGET_RTOS_M4_M7",
"DEVICE_LOWPOWERTIMER=1",
"DEVICE_RTC=1",
"TOOLCHAIN_object",
"DEVICE_SERIAL_ASYNCH=1",
"__CMSIS_RTOS",
"FSL_RTOS_MBED",
"DEVICE_STORAGE=1",
"TARGET_KPSDK_MCUS",
"TARGET_FLASH_CMSIS_ALGO",
"TOOLCHAIN_GCC",
"ARM_MATH_CM4",
"TARGET_KSDK2_MCUS",
"TARGET_LIKE_CORTEX_M4",
"DEVICE_ANALOGOUT=1",
"TARGET_M4",
"TARGET_UVISOR_UNSUPPORTED",
"TARGET_K64F",
"DEVICE_SPI_ASYNCH=1",
"DEVICE_PWMOUT=1",
"DEVICE_INTERRUPTIN=1",
"DEVICE_I2C=1",
"DEVICE_PORTOUT=1",
"__CORTEX_M4",
"DEVICE_STDIO_MESSAGES=1",
"CPU_MK64FN1M0VMD12",
"TARGET_LIKE_MBED",
"TARGET_FF_ARDUINO",
"TARGET_KPSDK_CODE",
"TARGET_RELEASE",
"DEVICE_SERIAL_FC=1",
"DEVICE_ERROR_RED=1",
"DEVICE_TRNG=1",
"__MBED_CMSIS_RTOS_CM",
"DEVICE_SLEEP=1",
"TOOLCHAIN_GCC_ARM",
"TARGET_FRDM",
"TARGET_MCUXpresso_MCUS",
"DEVICE_SPI=1",
"FEATURE_STORAGE=1",
"MBED_BUILD_TIMESTAMP=1491336376.18",
"DEVICE_SPISLAVE=1",
"DEVICE_ANALOGIN=1",
"DEVICE_SERIAL=1",
"DEVICE_FLASH=1",
"DEVICE_PORTIN=1",
"TARGET_MCU_K64F",
"TARGET_CORTEX_M"
],
"flags": [
"-std=gnu99"
]
},
"app_config": null,
"result": "OK",
"toolchain_name": "GCC_ARM",
"date": "2017-04-04 15:06:16.690662",
"output": "Building project mbed-os-example-fat-filesystem (K64F, GCC_ARM)\nScan: .\nScan: FEATURE_LWIP\nScan: FEATURE_COMMON_PAL\nScan: FEATURE_UVISOR\nScan: FEATURE_BLE\nScan: FEATURE_LOWPAN_ROUTER\nScan: FEATURE_ETHERNET_HOST\nScan: FEATURE_NANOSTACK\nScan: FEATURE_THREAD_END_DEVICE\nScan: FEATURE_THREAD_ROUTER\nScan: FEATURE_THREAD_BORDER_ROUTER\nScan: FEATURE_LOWPAN_BORDER_ROUTER\nScan: FEATURE_NANOSTACK_FULL\nScan: FEATURE_LOWPAN_HOST\nScan: FEATURE_STORAGE\nScan: env\nScan: mbed\nCompile [100.0%]: main.cpp\nLink: mbed-os-example-fat-filesystem\nElf2Bin: mbed-os-example-fat-filesystem\n+--------------------------+-------+-------+-------+\n| Module | .text | .data | .bss |\n+--------------------------+-------+-------+-------+\n| Fill | 172 | 0 | 2391 |\n| Misc | 54505 | 2556 | 754 |\n| drivers | 148 | 0 | 0 |\n| features/filesystem | 15821 | 0 | 807 |\n| features/storage | 42 | 0 | 184 |\n| hal | 418 | 0 | 8 |\n| platform | 2787 | 20 | 614 |\n| rtos | 135 | 4 | 4 |\n| rtos/rtx | 5869 | 20 | 6870 |\n| targets/TARGET_Freescale | 8382 | 12 | 384 |\n| Subtotals | 88279 | 2612 | 12016 |\n+--------------------------+-------+-------+-------+\nAllocated Heap: 24576 bytes\nAllocated Stack: unknown\nTotal Static RAM memory (data + bss): 14628 bytes\nTotal RAM memory (data + bss + heap + stack): 39204 bytes\nTotal Flash memory (text + data + misc): 91931 bytes\n",
"id": "MBED-OS-EXAMPLE-FAT-FILESYSTEM",
"memory_usage": [
{
"module": "Fill",
"size": {
".data": 0,
".bss": 2391,
".text": 172
}
},
{
"module": "Misc",
"size": {
".data": 2556,
".bss": 754,
".text": 54505
}
},
{
"module": "drivers",
"size": {
".data": 0,
".bss": 0,
".text": 148
}
},
{
"module": "features/filesystem",
"size": {
".data": 0,
".bss": 807,
".text": 15821
}
},
{
"module": "features/storage",
"size": {
".data": 0,
".bss": 184,
".text": 42
}
},
{
"module": "hal",
"size": {
".data": 0,
".bss": 8,
".text": 418
}
},
{
"module": "platform",
"size": {
".data": 20,
".bss": 614,
".text": 2787
}
},
{
"module": "rtos",
"size": {
".data": 4,
".bss": 4,
".text": 135
}
},
{
"module": "rtos/rtx",
"size": {
".data": 20,
".bss": 6870,
".text": 5869
}
},
{
"module": "targets/TARGET_Freescale",
"size": {
".data": 12,
".bss": 384,
".text": 8382
}
},
{
"summary": {
"total_flash": 91931,
"static_ram": 14628,
"stack": 0,
"heap": 24576,
"total_ram": 39204
}
}
]
}
]
} |
4c9e6dc
to
0994111
Compare
for me this is good now. 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, brought up one point but it's definitely bikeshedding, so don't spend too much time arguing with me 😄
tools/make.py
Outdated
@@ -173,6 +186,11 @@ | |||
default=False, | |||
help="Link with mbed test library") | |||
|
|||
parser.add_argument("--metadata", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize this is bikeshedding, so feel free to shut this down immediately. Is metadata
really a descriptive enough name? Perhaps this could be --build-data
or --json-report
? --metadata
almost sounds like it could affect the build, which may be confusing with --app-config
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yesh metadata might not be the best name for this. I was also thinking do we need this parameter at all - could we generate it just always - just like we do with test_spec..?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how long does it take to generate this? costs nothing? The build could contain this. Or do we consider this to be part of logging (=verbose) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably just some milliseconds, perhaps ten - I think - this seems to just pick pre-defined properties all over the place and put them all to one place - json file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metadata is probably not descriptive enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for generating this json file with relevant data. However thinking as my comment above how to treat this. do we need special option for it? can't be by default ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we doesn't need any cli option for this - it's kind of final report for whole build process which contains all details how build was done. Useful for bug reporting as well in future ;)
@@ -548,6 +550,9 @@ def build_project(src_paths, build_path, target, toolchain_name, | |||
cur_result["output"] = toolchain.get_output() + memap_table | |||
cur_result["result"] = "OK" | |||
cur_result["memory_usage"] = toolchain.map_outputs | |||
cur_result["bin"] = res | |||
cur_result["elf"] = splitext(res)[0] + ".elf" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this exists every time ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after #3994 is merged, yes.
tools/make.py
Outdated
@@ -173,6 +186,11 @@ | |||
default=False, | |||
help="Link with mbed test library") | |||
|
|||
parser.add_argument("--metadata", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably just some milliseconds, perhaps ten - I think - this seems to just pick pre-defined properties all over the place and put them all to one place - json file.
CC: @sg- This would help e.g. to collect static memory information from any kind of test binaries we have. |
FYI, we already generate a JSON file in the build directory upon every build. This contains the memap data. Are we looking to replace this, or have this sit next to it? Might make the build dir pretty cluttered, maybe in another release we can look at consolidating a bit. |
Lets do it now ! |
@bridadan The purpose of adding the flag was to give the user the option of placing it outside the build directory. The expected use case puts it in the root of the project. |
I think keeping in the build directory by default is best and should be consolidated with what memmap creates so we don't just create duplicates of everything. Also, mind looking at why user libraries and main doesn't seem to be itemized in the memory dump? |
Is those relative paths working then.. ?
yes there is some - but to get that using external script we have to dig folders deeply to find it - this simplify also that step - user can rely that file is available every time in exactly same place with all details - including individual build details when we build all unit tests. |
The paths are always relative from the root of the project. I can change that behavior in a bit. |
ok good. What you are changing ? |
Make all paths relative to the location of the file. |
This becomes difficult when you are building for multiple targets or toolchains. As soon as you switch your target/toolchain you'll overwrite the already created json file. At least this way there is a unique and consistent place to dump build data. Also, people don't like us cluttering up the root directory 😄 ARMmbed/mbed-cli#467 |
Nope. you append. |
That's why I had the switch. |
Oops, I goofed :) You're right @theotherjimmy, thanks! |
After offline bikeshedding, I'm deciding that the switch will be |
would be needed also when building tests :) |
In that case would there just a be a big json file in the root dir with all the builds in an array? |
yes big json file with builds array - main user will be tools which eat that file so no reason to split it to multiple places - it just make tool more complicated. But target folder is user configurable ( |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
could we integrate this whole thing inside elf file to own section ? |
@jupe I don't know how we could do that. |
7464ddb
to
c4c6e13
Compare
something like:
|
Thanks @jupe. Could we do that in another PR? I would like to get this one in ASAP since it's ready. |
sure |
/morph test |
@bridadan Can you run mbed 2 tests for this one? |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
It looks like this PR is dependent upon changes added in #3994 , which is targeted for 5.5.0 . Thus re-targeting this one to 5.5.0 also. |
@theotherjimmy please be aware that if you have any further changes coming in this area to check for dependencies on this PR or #3994 as they would also need to go to 5.5.0 |
The
--build-data
switch is used to specify a file that will be filledwith build metadata.
Testing