Hi Andrej,

 

You seem to be right.

 

In the current platforms NS_DATA_SIZE is defined as either of the following:

 

Which means NS_DATA_SIZE Is the maximum available RAM for the NS Software.

 

So the maximum available size of the RW and ZI data is decreased by the amounts you enumerate in your mail.

 

I created a task to fix this: https://developer.trustedfirmware.org/T687

 

Thanks,

Mate

 

From: TF-M <tf-m-bounces@lists.trustedfirmware.org> On Behalf Of Andrej Butok via TF-M
Sent: Thursday, March 12, 2020 9:23 AM
To: tf-m@lists.trustedfirmware.org
Subject: [TF-M] NS DATA Linker file

 

Hello,

 

It looks like there is a mistake for ER_DATA region in  the NS armclang linker file.

 

    ER_DATA NS_DATA_START NS_DATA_SIZE {

        * (+ZI +RW)

    }

   

    /* MSP */

    ARM_LIB_STACK_MSP +0 ALIGN 32 EMPTY NS_MSP_STACK_SIZE {

    }

 

    /* PSP */

    ARM_LIB_STACK +0 ALIGN 32 EMPTY NS_PSP_STACK_SIZE {

    }

 

    ARM_LIB_HEAP +0 ALIGN 8 EMPTY NS_HEAP_SIZE {

    }

 

ER_DATA does not take into account the NS_MSP_STACK_SIZE+NS_PSP_STACK_SIZE+EMPTY NS_HEAP_SIZE size:

#define NS_DATA_SIZE    (TOTAL_RAM_SIZE - S_DATA_SIZE)

 

Guess, the NS linker file should be:

    ER_DATA NS_DATA_START NS_DATA_SIZE-NS_MSP_STACK_SIZE-NS_PSP_STACK_SIZE-EMPTY NS_HEAP_SIZE {

        * (+ZI +RW)

    }

 

Or, did I miss something?

 

Thank you,

Andrej Butok