Skip to content

Build No Longer Fails if 'target.restrict_size' Exceeded #9012

Closed
@mattbrown015

Description

@mattbrown015

Description

It appears Add support for nrf52_dk bootloader #8097 has broken things for us! :-(

We have "target.restrict_size": "0x35800" set in our mbed_app.json and previously our build would fail if we exceeded the size. For example:

Using ROM regions application, post_application in this build.
  Region application: size 0x35800, offset 0x8000000
  Region post_application: size 0xa800, offset 0x8035800
...
Merging Regions
  Filling region application with .\BUILD\TEST_TARGET\GCC_ARM\application.bin
[ERROR] Contents of region application does not fit
[mbed] ERROR: "c:\python27\python.exe" returned error.
...

This is no longer the case, I suspect because of tools: fix up build_api padding logic and clean up unused code which removes:

if part_size > region.size:
    raise ToolException("Contents of region %s does not fit"
                         % region.name)

Build output now look likes:

Using ROM regions application, post_application in this build.
  Region application: size 0x35800, offset 0x8000000
  Region post_application: size 0xa800, offset 0x8035800
...
Merging Regions
  Filling region application with .\BUILD\PENGUIN\GCC_ARM\temperature-sensor_application.bin
Space used after regions merged: 0x359cc
Merging Regions
  Filling region application with .\BUILD\PENGUIN\GCC_ARM\temperature-sensor_application.bin
Space used after regions merged: 0x359cc

Our app started crashing and it has taken a couple of hours to realise why because the '0x359cc' wasn't noticed. Primarily because we were under the impression we would get a build failure if it exceeded '0x35800'.

We've been hit with a double whammy this week because it is changes to Mbed OS that have caused our code to grow in size! MPU API #8335 added 824 bytes of code, see MPU API Increases Code Size and Cannot be Completely Removed #9007.

We shall spend the rest of the afternoon removing some cruft so that our app fits again. :-)

Issue request type

[ ] Question
[ ] Enhancement
[X] Bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions