Presentation is loading. Please wait.

Presentation is loading. Please wait.

* ========.cmd file======== * */ MEMORY { SDRAM : origin = 0x80000000, len = 0x400000 } SECTIONS {.vectors > SDRAM.text > SDRAM.bss > SDRAM.cinit.

Similar presentations


Presentation on theme: "* ========.cmd file======== * */ MEMORY { SDRAM : origin = 0x80000000, len = 0x400000 } SECTIONS {.vectors > SDRAM.text > SDRAM.bss > SDRAM.cinit."— Presentation transcript:

1

2

3

4

5 * ========.cmd file======== * */ MEMORY { SDRAM : origin = 0x80000000, len = 0x400000 } SECTIONS {.vectors > SDRAM.text > SDRAM.bss > SDRAM.cinit > SDRAM.const > SDRAM.far > SDRAM.stack > SDRAM.cio > SDRAM.sysmem > SDRAM }

6 Sections A section is a block of code or data that occupies contiguous space in the memory map with other sections. Each section of an object file is separate and distinct.

7 There are two basic types of sections: Initialized sections contain data or code. The.text and.data sections are initialized; named sections created with the. sect assembler directive are also initialized.

8 Uninitialized sections reserve space in the memory map for uninitialized data. The.bss section is uninitialized; named section screated with the.usect assembler directive are also uninitialized. COFF object files always contain three default sections:.text section usually contains executable code.data section usually contains initialized data.bss section usually reserves space for uninitialized variables

9

10 Named sections They are sections that you create. You can use them like the default. text,.data, and.bss sections, but they are assembled separately. Two directives let you create named sections:  The.usect directive creates uninitialized sections that are used like the.bss section. These sections reserve space in RAM for variables.  The.sect directive creates initialized sections, like the default.text and.data sections, that can contain code or data. The.sect directive creates named sections with relocatable addresses.

11 Subsections Subsections are smaller sections within larger sections. Like sections,subsections can be manipulated by the linker. Subsections give you tighter control of the memory map The syntaxes for a subsection name are:  symbol.usect ”section name:subsection name”, size in bytes[, alignment[, bank offset] ] .sect ”section name:subsection name”

12 For example, we create a subsection called _func within the.text section: .sect ”.text:_func” Section Program Counters The assembler maintains a separate program counter for each section. These program counters are known as section program counters, or SPCs.

13 An SPC represents the current address within a section of code or data. Initially, the assembler sets each SPC to 0. As the assembler fills a section with code or data, it increments the appropriate SPC

14 Using Sections Directives Example 2−1 shows how you can build COFF sections incrementally, using the sections directives to swap back and forth between the different sections.

15

16

17

18 The Example above creates five sections

19

20 External Symbols External symbols are symbols that are defined in one module and referenced in another module. You can use the.def,.ref, or.global directive to identify symbols as external: .def The symbol is defined in the current module and used in another module.

21 .ref The symbol is referenced in the current module, but defined in another module. .global The symbol may be either of the above.

22 Assembler Directives Symbol name.byte value1,value2.word,.half, uhalf,.string,.int,.uint,.long,.ulong,etc...if,.endif,.else,.elseif.loop,.endloop.struct,.endstruct.union,.endunion

23 ..break,.field,.align

24 More details refer pdf in C:\CCStudio\docs\pdf/spru186n(chapter-2)


Download ppt "* ========.cmd file======== * */ MEMORY { SDRAM : origin = 0x80000000, len = 0x400000 } SECTIONS {.vectors > SDRAM.text > SDRAM.bss > SDRAM.cinit."

Similar presentations


Ads by Google