1 / 24

Address Management

Address Management. Objectives. After completing this module, you will be able to: Describe address management for PowerPC  processors Define a system address space Define an advanced user address space Describe the object file sections Describe what a linker script does. Outline.

dagan
Download Presentation

Address Management

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Address Management This material exempt per Department of Commerce license exception TSU

  2. Objectives After completing this module, you will be able to: • Describe address management for PowerPC processors • Define a system address space • Define an advanced user address space • Describe the object file sections • Describe what a linker script does

  3. Outline • Address Management • System Address Space • Advanced User Address Space • Object File Sections • Linker Scripts

  4. Address Management • Embedded processor design requires you to manage the following: • Address map for the peripherals • Location of the application code in the memory space • Block RAM • External memory • Memory requirements for your programs are based on the following: • The amount of memory required for storing the instructions • The amount of memory required for storing the data associated with the program

  5. 0xFFFF_FFFC Reset Address PLB/OPB Memory 0xFFFF_0000 PLB/OPB Memory Peripherals 0x0000_0000 PowerPC Processor • Memory and peripherals • PPC405 uses 32-bit addresses • Special addresses • Every PowerPC™ system should havethe boot section starting at0xFFFFFFFC • Default linker options • Program space occupies a contiguousaddress space from 0xFFFF0000 to0xFFFFFFFF • Stack size: 4 KB • Heap size: 4 KB

  6. Outline • Address Management • System Address Space • Object File Sections • Linker Scripts

  7. Advanced User Address Space • Different base address, contiguous user address space • The user program can run from any memory PLB, OCM, OPB, or LMB • To execute a program from any address location other than default, you must provide the compiler gcc with a Program Start Address

  8. Advanced UserAddress Space • Different base address, noncontiguous user address space • You can place different components of your program in different memories • For example, on PowerPC systems, you can keep your code on instruction cache memory and the data on ZBT memory • Noncontiguous executables that represent the application must be created • To do this, a linker script must be used

  9. Outline • Address Management • Advanced User Address Space • Object File Sections • Linker Scripts

  10. Object File Sections • What is an object file? • An object file is an assembled piece of code • Machine language: li r31,0 = 0x3BE0 0000 • Constant data • There may be references to external objects that are defined elsewhere • This file may contain debugging information

  11. Object File Sections .text .rodata .sdata2 .data .sdata .sbss .bss Text section Read-only data section Small read-only data section (less than eight bytes) Read-write data section Small read-write data section Small uninitialized data section Uninitialized data section

  12. Object File Sections .init .fini .ctors .dtors .got2 .got .eh_frame Language initialization code Language cleanup code List of functions to be invoked at program startup List of functions to be invoked at program end Pointers to program data Pointers to program data Frame unwind information for exception handling

  13. Sections Example int ram_data[10] = {0,1,2,3,4,5,6,7,8,9}; /* DATA */ const int rom_data[10] = {9,8,7,6,5,4,3,2,1}; /* RODATA */ int I; /* BSS */ main(){ ... I = I + 10; /* TEXT */ ... }

  14. Outline • Address Management • System Address Space • Object File Sections • Linker Scripts

  15. Linker Scripts • Linker scripts • Control the linking process • Map the code and data to a specified memory space • Set the entry point to the executable • Reserve space for the stack • Required if the design contains a discontinuous memory space

  16. Link Linker and Locator Flows Executable Image foo1.o Merged Output Sections 0xFFFF .text1 Code .text .data1 0xF000 Locate 0xEFFF .bss1 uninitialized data 0xEF00 .data 0xEEFF foo2.o .bss Unused .text2 0x2000 .data2 0x1FFF Initialized data .bss2 0x0000

  17. PowerPC Processor Script Example STACKSIZE = 4k; MEMORY { ddr : ORIGIN = 0x00000000, LENGTH = 32m sram : ORIGIN = 0x10000000, LENGTH = 2m flash : ORIGIN = 0x18000000, LENGTH = 32m bram : ORIGIN = 0xffff8000, LENGTH = 32k - 4 boot : ORIGIN = 0xfffffffc, LENGTH = 4 } SECTIONS { .text : { *(.text) } > bram .boot : { *(.boot) } > boot .data : { *(.data) *(.got2) *(.rodata) *(.fixup)} > bram .bss : { *(.bss) } > bram __bss_start = ADDR(.bss); __bss_end = ADDR(.bss) + SIZEOF(.bss); }

  18. Sections Command • This is where most of the work takes place • Output sections are named, and the input sections are grouped and linked together into the output sections • Example: • Explanation: • .text is the name of the output section • { *(.text) *.(init) } includes all input sections named text and init from the object files being linked • > bram locates the .text output section in the next available memory in the block RAM area • .text : { *(.text) *(.init) } > bram

  19. Linker Script Generator GUI • XPS contains a graphical Linker Script Generator • Table-based GUI allows you to define the memory space for any section • Launch from Software → Generate LinkerScript, or from the Applications Tab, right-click on <project> → Generate LinkerScript • The tool will create a new linker script (the old script is backed up)

  20. Knowledge Check • When do you need to use a linker script? • What does a linker script do?

  21. Answers • When do you need to use a linker script? • When you have software developed in multiple source files and the compiled object code needs to be placed in different memory structures or in nonstandard configurations • What does a linker script do? • The linker script controls the placement of the object code, data, stack, and heap in specific memory locations

  22. Knowledge Check • What does .sdata2 section contain? • What does .sdata section contain? • What does .sbss section contain?

  23. Answers • What does .sdata2 section contain? • Small read-only data • What does .sdata section contain? • Small read-write data • What does .sbss section contain? • Small uninitialized data

  24. Where Can I Learn More? • Tool documentation • Embedded System Tools Guide  Address Management • Embedded Systems Tools Guide  Stand-Alone Board Support Package • Embedded Systems Tools Guide  GNU Compiler Tools • Support Website • EDK Website: www.xilinx.com/edk • GNU Website: http://gcc.gnu.org/onlinedocs/gcc-3.4.4/gcc

More Related