- 
                Notifications
    You must be signed in to change notification settings 
- Fork 180
Closed
Labels
Description
I have noticed that randomly our test application breaks in CI testing and have been investigating the reason for it. I noticed that the binary size of the final binary varies between builds and some builds work fine, others fail on error below:
RTX error code: 0x00000001, task ID: 0x20015210
[0255][DBG ][mClt]: M2MInterfaceImpl::~M2MInterfaceImpl() - IN
[0256][DBG ][mClt]: M2MNsdlInterface::~M2MNsdlInterface() - IN
[0257][DBG ][mClt]: M2MNsdlInterface::~M2MNsdlInterface() - OUT
[0258][DBG ][mClt]: M2MConnectionHandlerPimpl::stop_listening()
[0259][DBG ][mClt]: M2MConnectionHandlerPimpl::~M2MConnectionHandlerPimpl()
sys_mbox_post error
We then through that this might be related to the -j flag. Compiling code with -j1 produces reliably nearly similar binary sizes, but using anything else makes it quite random.
For ex. building with -j32
+-----------------------------+--------+-------+-------+
| Module                      |  .text | .data |  .bss |
+-----------------------------+--------+-------+-------+
| Fill                        |    541 |    14 |  2237 |
| Misc                        |  88062 | 11229 |  8195 |
| features/FEATURE_CLIENT     |  70573 |     3 |    57 |
| features/FEATURE_COMMON_PAL |  25298 |    89 | 10452 |
| features/frameworks         |   3823 |    52 |   784 |
| features/mbedtls            | 127373 |    51 |   119 |
| features/net                |  34692 |   102 | 51261 |
| hal/common                  |   2977 |    20 |   297 |
| hal/targets                 |  15237 |    12 |   200 |
| rtos/rtos                   |    205 |     4 |     0 |
| rtos/rtx                    |   7385 |    20 |  2686 |
| Subtotals                   | 376166 | 11596 | 76288 |
+-----------------------------+--------+-------+-------+
Allocated Heap: 65536 bytes
Allocated Stack: 32768 bytes
Total Static RAM memory (data + bss): 87884 bytes
Total RAM memory (data + bss + heap + stack): 186188 bytes
Total Flash memory (text + data + misc): 388802 bytes
Image: ./.build/K64F/GCC_ARM/mbed-client-testapp.bin
with -j12
+-----------------------------+--------+-------+-------+
| Module                      |  .text | .data |  .bss |
+-----------------------------+--------+-------+-------+
| Fill                        |    493 |    14 |  2241 |
| Misc                        |  88067 | 11229 |  8195 |
| features/FEATURE_CLIENT     |  70506 |     3 |    57 |
| features/FEATURE_COMMON_PAL |  25298 |    89 | 10452 |
| features/frameworks         |   3823 |    52 |   784 |
| features/mbedtls            | 127204 |    51 |   119 |
| features/net                |  34692 |   102 | 51261 |
| hal/common                  |   2977 |    20 |   297 |
| hal/targets                 |  15237 |    12 |   200 |
| rtos/rtos                   |    205 |     4 |     0 |
| rtos/rtx                    |   7385 |    20 |  2686 |
| Subtotals                   | 375887 | 11596 | 76292 |
+-----------------------------+--------+-------+-------+
Allocated Heap: 65540 bytes
Allocated Stack: 32768 bytes
Total Static RAM memory (data + bss): 87888 bytes
Total RAM memory (data + bss + heap + stack): 186196 bytes
Total Flash memory (text + data + misc): 388523 bytes
Image: ./.build/K64F/GCC_ARM/testapp2.bin
while with -j0
+-----------------------------+--------+-------+-------+
| Module                      |  .text | .data |  .bss |
+-----------------------------+--------+-------+-------+
| Fill                        |    469 |    14 |  2241 |
| Misc                        |  88067 | 11229 |  8195 |
| features/FEATURE_CLIENT     |  70506 |     3 |    57 |
| features/FEATURE_COMMON_PAL |  25298 |    89 | 10452 |
| features/frameworks         |   3823 |    52 |   784 |
| features/mbedtls            | 127204 |    51 |   119 |
| features/net                |  34684 |   102 | 51261 |
| hal/common                  |   2977 |    20 |   297 |
| hal/targets                 |  15237 |    12 |   200 |
| rtos/rtos                   |    205 |     4 |     0 |
| rtos/rtx                    |   7385 |    20 |  2686 |
| Subtotals                   | 375855 | 11596 | 76292 |
+-----------------------------+--------+-------+-------+
Allocated Heap: 65540 bytes
Allocated Stack: 32768 bytes
Total Static RAM memory (data + bss): 87888 bytes
Total RAM memory (data + bss + heap + stack): 186196 bytes
Total Flash memory (text + data + misc): 388491 bytes
Image: ./.build/K64F/GCC_ARM/testapp.bin
There is a few hundred byte difference in the produced binary size with completely identical builds otherwise (expect maybe time-stamp).
Could there by some issue that the build order of the files result in broken linking with bad luck?
mbed-cli 0.9.1
arm-none-eabi-gcc (15:4.9.3+svn231177-1) 4.9.3 20150529 (prerelease)
mbed-client-testapp (784f1742d26e)
|- mbed-client-cli (d4844ef43abd)
|- mbed-os (0712b8adf6bb)
|  |- features/FEATURE_CLIENT/mbed-client (47a2eea08c0c)
|  |- features/FEATURE_CLIENT/mbed-client-classic (3f8574348306)
|  |- features/FEATURE_CLIENT/mbed-client-mbed-tls (68f93f7834e9)
|  `- features/FEATURE_COMMON_PAL/mbed-client-c (758fd1e11cb9)