Start the file startup in Keil. add the following code to S to import the information first. In the DCD namespace, export the information to other files for use. For example, baseofrom can be automatically adapted in the nvic relocation function.
Import | image $ er_irom1 $ Ro $ base |; ROM code start
Import | image $ er_irom1 $ Ro $ limit |; Ram data starts after Rom Program
Import | image $ rw_iram1 $ RW $ base |; pre-initialised Variables
Import | image $ er_iram1 $ RW $ limit |; end of variable RW Space
Import | image $ rw_iram1 $ Zi $ base |; uninitialised variables
Import | image $ rw_iram1 $ Zi $ limit |; end of Variable RAM Space
Baseofrom DCD | image $ er_irom1 $ Ro $ base |
Topofrom DCD | image $ er_irom1 $ Ro $ limit |
Baseofbss DCD | image $ rw_iram1 $ RW $ base |
Endofbssdcd | image $ rw_iram1 $ RW $ limit |
Baseofzerodcd | image $ rw_iram1 $ Zi $ base |
Endofzerodcd | image $ rw_iram1 $ Zi $ limit |
Export baseofrom
Export topofrom
Export baseofbss
Exportendofbss
Export baseofzero
Export endofzero
Topofrom is only RO (code + RO code limit, the actual topofrom should be topofrom + (endofbss-baseofbss), that is, code + RO + RW );
Endofbss = baseofzero: the actual size of endofzero is used by Ram, excluding stack and heap.
Appendix:
In ads, you usually need to set Ro base and RW base in the Link Control option of the project, so that you can compile the link
The generated image file specifies the location of the RO, RW, and Zi region, and uses image $ RW $ base,
Image $ RW $ limit, image $ Ro $ base, image $ Ro $ limit, image $ Zi $ base and
Image $ Zi $ limit and other six segment address descriptors can be referenced in the program. While the realview MDK chain
The program uses the Link Control Command Option (similar to ads, but the link script file *. SCT will still be generated) and
Distribute the link to the script file *. SCT to control the link of the program. In the link script file, the segment Address Descriptor
Format: Image $ segment name $ region name $ base and image $ segment name $ region name $ limit. The following section describes
The Distributed Loading link script file led. SCT generated by the Control Option shown in 6.20 of the LED instance.
; **************************************** *********************
; *** Scatter-loading description file generated by uvision ***
; **************************************** *********************
Lr_rom1 0x30000000 0x01000000 {; load region size_region
Er_rom1 0x30000000 0x01000000 {; load address = Execution address
*. O (reset, + first)
* (Inroot $ sections)
. Any (+ RO)
}
Rw_ram1 0x31000000 0x01000000 {; RW data
. Any (+ RW + zi)
}
Rw_iram1 0x40000000 0x00001000 {
. Any (+ RW + zi)
}
}
We can introduce these segment descriptors in the Assembly file. In this script: | image $ er_rom1 $ Ro $ base |
The value is 0x30000000, corresponding to | image $ Ro $ base |; | image $ er_rom1 $ Ro $ limit | value in ads1.2
Is related to the Code Compiled in practice. If the code is 1000 and the hexadecimal value is 0x3e8
| Image $ er_rom1 $ Ro $ limit | the value is 0x300003e8, corresponding to | image $ Ro $ limit in ads1.2 |;
| Image $ rw_ram1 $ RW $ base | the value is 0x31000000, corresponding to | image $ RW $ base in ads1.2 | such
If RW-Data = 8 in the code, | image $ rw_ram1 $ RW $ limit | and | image $ rw_ram1 $ Zi $ base |
The value is 0x31000008, corresponding to | image $ RW $ limit | and | image $ Zi $ base |;
| Image $ rw_ram1 $ Zi $ limit | value: | image $ rw_ram1 $ Zi $ base |
Zi-data, which corresponds to | image $ Zi $ limit | in ads1.2. In addition, the script contains rw_iram1, which
Like rw_ram1, RW and Zi are also available.