Hi Jens,

Thank you for the support.

As suggested, modified the changes for the new platform (ARMv7 cortex A5).

I tried to configure 30MB for TZDRAM_SIZE, 1MB for TEE_RAM, 28MB for TA_RAM, 1MB for SHMEM_size

I tried to initialize uart and tried to port op-tee.elf on the ARMv7 board.

While executing "malloc_add_pool(__heap1_start, __heap1_end - __heap1_start);" it is calling "mutex_lock(&__malloc_mu);" and causing a data abort.

Can you please let me know why is it giving a data abort. I have used stack alignment as 32. Did I miss anything while allocating the memory to TEE_RAM or TA_RAM.

Please suggest me in this regard.

Regards,
Ajith



From: Jens Wiklander <jens.wiklander@linaro.org>
Sent: Monday, January 9, 2017 3:58 PM
To: Ajith Kumar Kumsi
Cc: tee-dev@lists.linaro.org
Subject: Re: [Tee-dev] OpTee porting on ARMv7
 
Hi,

On Mon, Jan 9, 2017 at 10:45 AM, Ajith Kumar Kumsi <ajithkumar.kumsi@inedasystems.com> wrote:
Hi,

I have gone through the following link http://www.slideshare.net/linaroorg/lcu14-302-how-to-port-optee-to-another-platform

I have followed each step from slide 9 in the document provided in the above link.

Slide 14 of the document discusses regarding the memory configuration "core_bootconfig.c"

I have configured TZDRAM_BASE, TZDRAM_SIZE, CFG_TEE_CORE_NB_CORE, etc in platform_config.h file.

Do I need to create a core_bootconfig.c file separately? I am using platform device which has an armv7 (cortex A5 processor).

Can I use kern.ld.S file or do I need to create another tz-template.lds as given in slide 10 of the document. Please suggest me on this.

As I am new to op-tee porting please guide me on how to port Op-tee O/s on cortex A5.

The easiest way to start a new platform is to copy an already existing platform and modify it to suit your need. A good candidate could be plat-rcar as it has the fewest number of lines of platform specific code.

Initially try to use as few features as possible of the platform, OP-TEE basically needs some memory and an UART to start with.

Regards,
Jens
 

Regards,
Ajith


From: Jens Wiklander <jens.wiklander@linaro.org>
Sent: Thursday, January 5, 2017 5:05 PM

To: Ajith Kumar Kumsi
Cc: tee-dev@lists.linaro.org
Subject: Re: [Tee-dev] OpTee porting on ARMv7
 


On Thu, Jan 5, 2017 at 12:06 PM, Ajith Kumar Kumsi <ajithkumar.kumsi@inedasystems.com> wrote:

Hi,


I tried to read DFAR and DFSR registers by adding the below code inside _spinlock_loop as shown below:


_spinlock_loop:
    MRC p15, 0, r10, c6, c0, 0
    MRC p15, 0, r9, c5, c0, 0
    ldrex r1, [r0]


In r10 the value is FFFFFFFC

In r9 the value is 8


Any suggestions in this regard.


So DFSR says "Synchronous external abort" and the address is 0xfffffffc. I'm afraid I don't have much to add to that.

Regards,
Jens 


Regards,

Ajith


From: Jens Wiklander <jens.wiklander@linaro.org>
Sent: Thursday, January 5, 2017 3:54:51 PM

To: Ajith Kumar Kumsi
Cc: tee-dev@lists.linaro.org
Subject: Re: [Tee-dev] OpTee porting on ARMv7
 


On Thu, Jan 5, 2017 at 10:43 AM, Ajith Kumar Kumsi <ajithkumar.kumsi@inedasystems.com> wrote:


Hi,


Thanks for the quick response.


R0 holds an valid address which belongs to TEE_RAM.


Inside that address the value is 0.


So what's causing the abort then? DFAR and DFSR will give you some clues. Is the address in r0 4 byte aligned? 

Regards,
Jens


Regards,

Ajith


From: Jens Wiklander <jens.wiklander@linaro.org>
Sent: Thursday, January 5, 2017 2:55:32 PM

To: Ajith Kumar Kumsi
Cc: tee-dev@lists.linaro.org
Subject: Re: [Tee-dev] OpTee porting on ARMv7
 
Hi,

On Thu, Jan 5, 2017 at 10:11 AM, Ajith Kumar Kumsi
<ajithkumar.kumsi@inedasystems.com> wrote:
> Hi,
>
> While porting Op-tee.elf on ARM A5 board, it is giving a data abort.
>
> I further tried to debug the code, and I could see that in generic_boot.c
> inside "init_runtime" function when malloc_add_pool(__heap1_start,
> __heap1_end - __heap1_start) is called, __mutex_lock is getting called and
> when cpu_spin_lock(&m->spin_lock) is called
> at the below point it gives a data abort exception after "cmp r1,
> #SPINLOCK_UNLOCK".
>
> _spinlock_loop:
>     ldrex r1, [r0]
>     cmp r1, #SPINLOCK_UNLOCK
>     wfene
>
> Can you let me know if I need to make any modifications to make it work.

That piece of code is used by other platforms so I guess the problem
is with the input. What's in r0 would give some clue, because it's
supposed to point ot spinlock within __malloc_mu

Regards,
Jens

>
> Regards,
> Ajith
>
> ________________________________
> From: Jens Wiklander <jens.wiklander@linaro.org>
> Sent: Tuesday, November 29, 2016 6:25:53 PM
> To: Ajith Kumar Kumsi
> Cc: tee-dev@lists.linaro.org
> Subject: Re: [Tee-dev] OpTee porting on ARMv7
>
>
>
> On Tue, Nov 29, 2016 at 1:31 PM, Ajith Kumar Kumsi
> <ajithkumar.kumsi@inedasystems.com> wrote:
>>
>>
>> Hi,
>>
>> Thank you for the reply.
>>
>> As suggested, I have gone through the
>> http://www.slideshare.net/linaroorg/lcu14-302-how-to-port-optee-to-another-platform
LCU14 302- How to port OP-TEE to another platform ----- Speaker: Joakim Bech, Jens Wiklander and Pascal Brand

>> and https://github.com/OP-TEE/optee_os#3-platforms-supported
The optee_os git, contains the source code for the TEE in Linux using the ARMŽ TrustZoneŽ technology. This component meets the GlobalPlatform TEE System ...

>>
>> I have downloaded optee_os.
>>
>> I have gone through the other platforms given under
>> "optee_os/core/arch/arm" and created a new platform and modified changes in
>> platform_config.h, conf.mk, main.c, uart.c, uart.h files accordingly related
>> to the new platform (arm7v-a (cortex a5)).
>>
>> I tried to export the platform to the new-platform name and tried to build
>> using "make".
>>
>> I can see that tee.bin got generate in optee_os/out/arm-plat-new/core.
>>
>> I tried to flash tee.elf in to SRAM and I tried to debug using eclipse, I
>> can see that it is getting halted at
>> optee_os/core/arch/arm/kernel/generic_entry_a32.S at line 58.
>>
>>  FUNC _start , :
>>
>>      58         b       .       /* Data abort */
>>
>> Please suggest me on how to proceed further in this regard.
>
>
> Since you've obviously got a data abort I'd suggest checking LR and DFAR for
> more clues to the abort.
>
> Regards,
> Jens
>
> ______________________________________________________________________
> This email has been scanned by the Symantec Email Security.cloud service.
> For more information please visit http://www.symanteccloud.com
Backed by one of the most comprehensive global threat intelligence networks, Symantec protects against known and emerging cyber security threats.

> ______________________________________________________________________
> This email and any files transmitted with it are confidential and intended
> solely for the use of the individual or entity to whom they are addressed.
> If you have received this email in error please notify the system manager.
> This message contains confidential information and is intended only for the
> individual named. If you are not the named addressee you should not
> disseminate, distribute or copy this e-mail. Please notify the sender
> immediately by e-mail if you have received this e-mail by mistake and delete
> this e-mail from your system. If you are not the intended recipient you are
> notified that disclosing, copying, distributing or taking any action in
> reliance on the contents of this information is strictly prohibited.

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.


______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.


______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.


______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.