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

tools - turn off page alignment of sections #4049

Merged
merged 1 commit into from Mar 29, 2017

Conversation

Projects
None yet
6 participants
@tung7970
Contributor

tung7970 commented Mar 28, 2017

Description

By default, ld sets page alignment of sections to 0x8000, which bloats
up elf file size. This behavior is unnecessary for MCU.

Example:

  1. page alignment on

mbed.elf file size 144936

Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x008000 0x00000000 0x00000000 0x00400 0x00400 R 0x8000
LOAD 0x008400 0x00000400 0x00000400 0x00010 0x00010 R 0x8000
LOAD 0x008410 0x00000410 0x00000410 0x0ab3c 0x0ab3c RWE 0x8000
LOAD 0x018000 0x20000000 0x0000af4c 0x008d0 0x008d0 RW 0x8000
LOAD 0x01b81c 0x0000b81c 0x0000b81c 0x00000 0x00004 RW 0x8000
LOAD 0x020000 0x1fff0000 0x1fff0000 0x00000 0x00400 RW 0x8000
LOAD 0x0188d0 0x200008d0 0x200008d0 0x00000 0x08860 RW 0x8000

  1. page alignment off

mbed.elf file size 91792

Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x000114 0x00000000 0x00000000 0x00400 0x00400 R 0x4
LOAD 0x000514 0x00000400 0x00000400 0x00010 0x00010 R 0x1
LOAD 0x000528 0x00000410 0x00000410 0x0ab3c 0x0ab3c RWE 0x8
LOAD 0x00b068 0x20000000 0x0000af4c 0x008d0 0x008d0 RW 0x8
LOAD 0x00b938 0x0000b81c 0x0000b81c 0x00000 0x00004 RW 0x1
LOAD 0x00b938 0x1fff0000 0x1fff0000 0x00000 0x00400 RW 0x1
LOAD 0x00b938 0x200008d0 0x200008d0 0x00000 0x08860 RW 0x8

Status

READY

Migrations

NO

Related PRs

NONE

Todos

NONE

Deploy notes

NONE

Steps to test or reproduce

NONE

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Mar 28, 2017

@c1728p9

This comment has been minimized.

Contributor

c1728p9 commented Mar 28, 2017

This option doesn't effect the binary output, just the layout of the elf on disk. This change looks good to me.

@c1728p9

This comment has been minimized.

Contributor

c1728p9 commented Mar 28, 2017

/morph test

@mbed-bot

This comment has been minimized.

mbed-bot commented Mar 28, 2017

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 1760

All builds and test passed!

@theotherjimmy

This is not the correct place to do this. Please update the build profiles in tools/profiles.

tools - turn off page alignment of sections
By default, ld sets page alignment of sections to 0x8000, which bloats
up elf file size. This behavior is unnecessary for MCU.

Example:

1. page alignment on

mbed.elf file size 144936

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x008000 0x00000000 0x00000000 0x00400 0x00400 R   0x8000
  LOAD           0x008400 0x00000400 0x00000400 0x00010 0x00010 R   0x8000
  LOAD           0x008410 0x00000410 0x00000410 0x0ab3c 0x0ab3c RWE 0x8000
  LOAD           0x018000 0x20000000 0x0000af4c 0x008d0 0x008d0 RW  0x8000
  LOAD           0x01b81c 0x0000b81c 0x0000b81c 0x00000 0x00004 RW  0x8000
  LOAD           0x020000 0x1fff0000 0x1fff0000 0x00000 0x00400 RW  0x8000
  LOAD           0x0188d0 0x200008d0 0x200008d0 0x00000 0x08860 RW  0x8000

2. page alignment off

mbed.elf file size 91792

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x000114 0x00000000 0x00000000 0x00400 0x00400 R   0x4
  LOAD           0x000514 0x00000400 0x00000400 0x00010 0x00010 R   0x1
  LOAD           0x000528 0x00000410 0x00000410 0x0ab3c 0x0ab3c RWE 0x8
  LOAD           0x00b068 0x20000000 0x0000af4c 0x008d0 0x008d0 RW  0x8
  LOAD           0x00b938 0x0000b81c 0x0000b81c 0x00000 0x00004 RW  0x1
  LOAD           0x00b938 0x1fff0000 0x1fff0000 0x00000 0x00400 RW  0x1
  LOAD           0x00b938 0x200008d0 0x200008d0 0x00000 0x08860 RW  0x8

Signed-off-by: Tony Wu <tonywu@realtek.com>

@tung7970 tung7970 force-pushed the tung7970:fix-tools branch to 72589df Mar 28, 2017

@tung7970

This comment has been minimized.

Contributor

tung7970 commented Mar 28, 2017

Done.

@theotherjimmy

Thanks!

@theotherjimmy theotherjimmy added needs: CI and removed needs: work labels Mar 28, 2017

@theotherjimmy

This comment has been minimized.

Contributor

theotherjimmy commented Mar 28, 2017

/morph test

@mbed-bot

This comment has been minimized.

mbed-bot commented Mar 29, 2017

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 1771

All builds and test passed!

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Mar 29, 2017

Restarted CI jenkins, should be fixed.

@0xc0170 0xc0170 added ready for merge and removed needs: CI labels Mar 29, 2017

@sg- sg- merged commit 782395d into ARMmbed:master Mar 29, 2017

4 checks passed

Cam-CI uvisor Build & Test Success
Details
ci/morph-test Job has completed
Details
continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment