This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Determinate the RAM size

Dear All

Keil: 5.17
Language: Assembler (and later C)
"Use Memory Layout from target Dialog" is checked
CPU: LPC1768
Target environment: The simulator
Target set up:
The default values created by the uVision Wizard, that is

Area  Start        Size
IROM1 0x0        - 0x80000   Checked
IRAM1 0x10000000 - 0x8000    Checked
IRAM2 0x2007C000 - 0x8000    UnChecked

I do not have a "private" scatter file, the project is using the auto generated.

I am trying to write a ram check routine in assembler for the RAM and use it before I
call the SystemInit and __main.

If I show various $$ linker values I get the following result.

LDR             R0, =|Load$$RW_IRAM1$$Base|                 R0  = 0x00001DD4
LDR             R1, =|Load$$RW_IRAM1$$Limit|                R1  = 0x00001DDC

LDR             R2, =|Image$$RW_IRAM1$$Base|                R2  = 0x10000000
LDR             R3, =|Image$$RW_IRAM1$$Length|              R3  = 0x00000008
LDR             R4, =|Image$$RW_IRAM1$$Limit|               R4  = 0x10000008

LDR             R5, =|Image$$RW_IRAM1$$RO$$Base|            R5  = 0x10000000
LDR             R6, =|Image$$RW_IRAM1$$RO$$Length|          R6  = 0x00000000
LDR             R7, =|Image$$RW_IRAM1$$RO$$Limit|           R7  = 0x10000000

LDR             R8, =|Image$$RW_IRAM1$$RW$$Base|            R8  = 0x10000000
LDR             R9, =|Image$$RW_IRAM1$$RW$$Limit|           R9  = 0x10000008
LDR             R10, =|Image$$RW_IRAM1$$RW$$Length|         R10 = 0x00000008

LDR             R11, =|Image$$RW_IRAM1$$ZI$$Base|           R11 = 0x10000008
LDR             R12, =|Image$$RW_IRAM1$$ZI$$Limit|          R12 = 0x10000298
LDR             R13, =|Image$$RW_IRAM1$$ZI$$Length|         R13 = 0x10000290

Question 1:
Shall I use |Image$$RW_IRAM1$$RO$$Base| to determinate the start of the RAM ?

Question 2:
How do I get the actual size/end of the RAM, as defined in the project ?
It seems that no linker variable is either 0x00008000 or 0x10008000

Question 3:
How can I compile/linker time determinate if the IRAM2 is checked?
The following does not work

    IF      :DEF:|Image$$RW_IRAM2$$Base|
    IMPORT  |Image$$RW_IRAM2$$Base|
    ENDIF

    IF      :DEF:|Image$$RW_IRAM2$$Base|
    LDR         R13,|Image$$RW_IRAM2$$Base|
    ENDIF