Skip to content

kinetis: Share ldscripts between CPUs#2393

Merged
jfischer-no merged 1 commit intoRIOT-OS:masterfrom
jnohlgard:pr/kinetis-ldscripts
Feb 9, 2015
Merged

kinetis: Share ldscripts between CPUs#2393
jfischer-no merged 1 commit intoRIOT-OS:masterfrom
jnohlgard:pr/kinetis-ldscripts

Conversation

@jnohlgard
Copy link
Copy Markdown
Member

We decided it would be a good idea to share the base of the linker scripts between the different Kinetis CPUs since they share the same memory layout.

Use the following as a template for the CPU-specific part of the ldscript:

OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
OUTPUT_ARCH(arm)

MEMORY
{
    vectors (rx)   : ORIGIN = 0x0,        LENGTH = 0x400
    flashsec (rx)  : ORIGIN = 0x400,      LENGTH = 0x10
    flash (rx)     : ORIGIN = 0x410,      LENGTH = 256K - 0x410
    sram_l (rwx)   : ORIGIN = 0x20000000 - 32K, LENGTH = 32K /* Only accessible via code bus. */
    sram_u (rwx)   : ORIGIN = 0x20000000, LENGTH = 32K /* Only accessible via system bus. */
}

INCLUDE kinetis-base.ld

sram_l is currently only used for accelerating code execution, .ramcode section.
sram_u is used for all variables (.data and .bss)

Add the following to the cpu-specific Makefile.include:

export LINKFLAGS += -L$(RIOTCPU)/$(CPU)/ldscripts

@jnohlgard jnohlgard added Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation labels Feb 5, 2015
@jnohlgard
Copy link
Copy Markdown
Member Author

@jnohlgard
Copy link
Copy Markdown
Member Author

This may be something that we will want to change: In this ldscript, the heap is its own section which uses up all remaining memory, so the .bss size will seem very high when using arm-none-eabi-size to examine the binary.

@jfischer-no
Copy link
Copy Markdown
Contributor

@gebart It's not as easy as I thought. What do you think of this:

  • to name the memory markers as in stm and samd21 startup code? Then it's all uniform.
  • fcfield should be configurable, it can be placed in startup.c
  • ramvect should be optional
  • ramcode should be optional (ok, sram_l can be set to zero)

If it's ok, then I will open a PR against your branch.

@jnohlgard
Copy link
Copy Markdown
Member Author

@gebart It's not as easy as I thought. What do you think of this:

  • to name the memory markers as in stm and samd21 startup code? Then it's all uniform.

OK

  • fcfield should be configurable, it can be placed in startup.c

I agree

  • ramvect should be optional

I agree

  • ramcode should be optional (ok, sram_l can be set to zero)

I agree

However, there is a distinction between sram_l and sram_u in hardware, but I think it will only be of importance if you use ramcode.

https://community.freescale.com/thread/329666

You can open a PR against this branch with your changes.

@jnohlgard jnohlgard added the CI: needs squashing Commits in this PR need to be squashed; If set, CI systems will mark this PR as unmergable label Feb 9, 2015
@jnohlgard
Copy link
Copy Markdown
Member Author

The proposed changes from @jfischer-phytec-iot is now merged into this PR.
Ready to squash?

@jfischer-no
Copy link
Copy Markdown
Contributor

yep

@jnohlgard jnohlgard force-pushed the pr/kinetis-ldscripts branch from 28b436a to 29d3959 Compare February 9, 2015 16:52
@jnohlgard
Copy link
Copy Markdown
Member Author

squashed and rebased on latest master

@jnohlgard jnohlgard removed the CI: needs squashing Commits in this PR need to be squashed; If set, CI systems will mark this PR as unmergable label Feb 9, 2015
jfischer-no pushed a commit that referenced this pull request Feb 9, 2015
kinetis: Share ldscripts between CPUs
@jfischer-no jfischer-no merged commit 0326385 into RIOT-OS:master Feb 9, 2015
@jnohlgard jnohlgard deleted the pr/kinetis-ldscripts branch February 27, 2015 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants