Skip to content

Linker script produces excessively large binaries for LPC1549 #14572

Open
@ducky64

Description

@ducky64

Description of defect

The compiled binaries from objcopy are 33,587,200 bytes (=0x2008000), which is equivalent to the contents of flash, empty space inbetween, ram1, and ram2 banks. This causes problems with OpenOCD flashing, which uses the .bin (instead of .elf) files and seems to try to write past the flash banks.

This seems to be a problem in the LPC1549.ld and a result of different RAM banks for the .data and .heap sections, since (at least some) other LPC targets do not have this issue.

Experimentally, the .bin files have saner sizes if:

  • line 141 is removed
  • the .heap and .data section are in the same RAM bank
  • an AT relocation directive is applied to .heap

I'm not super familiar with linker scripts, so I don't know which of the above is the right fix. But this might be an easy fix for someone more familiar with linker scripts?

Originally submitted as bug to platformio/platform-nxplpc#23

Target(s) affected by this defect ?

LPC1549

Toolchain(s) (name and version) displaying this defect ?

PlatformIO, which uses GCC-ARM

What version of Mbed-os are you using (tag or sha) ?

5.15.6
(per /platform/mbed_version.h; here is the version as defined by PlatformIO build scripts)

What version(s) of tools are you using. List all that apply (E.g. mbed-cli)

PlatformIO latest

How is this defect reproduced ?

Create a PlatformIO project with the LPC1549 and build it. It will produce an excessively large firmware.bin file.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions