Is it possible to run a 32kb program from L1_code in secure mode (going through the authentication process only one time & without using overlays)?
The size of the program that you wish to execute in secure mode in a single authentication is limited by the size of available internal data memory, where the authentication will take place, and by the size of available internal code memory, where the program will execute after authentication.
On BF54x processors, you can authenticate the program either in L1 Data Bank A, which is 32KBytes in size, or in L2, which is 64KBytes in size.
(Note that since the digital signature, which is 48Bytes long, should immediately preceed the message, the maximum program size in the case of L1 Data Bank A authentication is slightly less than 32KBytes, but close enough.)
After authentication, you can execute the program from L1 code, which has a size of 32KBytes, or in L2, which has a size of 64KBytes.
On BF52x processors, you can authenticate the message in L1 Data Bank A, which is 32KBytes in size. After authentcaction, you can execute the program from L1 code, which is also 32KBytes in size.
Hope this helps,
Thank you for your answer.
I'm trying to decrypt a n encrypted code and then excute it.
I'm having a problem moving The decypted code from L1_data_bank_A to L1_code.
do you have an idea what could be the problem?
Can you describe what you're trying to do? To be clear, lockbox does not perform any decryption. To move executable opcodes from L1 Data to L1 Code, you must use memory DMA?
the decryption is working Properly.
Ihavea problem To move executable opcodes from L1 Data to L1 Code, all dmas are enable (I'm not sure i must use them).
How are you doing your decryption? If you are not using DMA's, what other method are you using to move the code from data memory to instruction memory?
after entering secure mode I enable all dmas.
The encrypted code is placed in L1_data when loading the program. When I decrypt The code I place it in The same location(L1_data )
I wasn't able to locate it in L1_code .
Are you saying that you can decrypt it in-place in data memory but when you try to decrypt it to L1 Code it doesn't work? If so, then yes it will not work. The core cannot write data out to instruction memory. You must use other methods, such as DMA.
How are you attempting to copy/move the decrypted application code from L1 data into L1 code memory? As Gabby stated, you must use DMA for this process. How have you set up the DMA process? What is the failure you observe? Please provide as much detail as possible so we can try to help further.
after entering scure I enable jtag & dmas ( SECURE_SYSSWT = 00000000000000000001100000000010).
and I using the command : _memcpy_l1.
I'm getting an Unknwon exception.
How are you calling _memcpy_l1? What are your arguments? Can you provide a sample project that reproduces this error?
Thank you for your interest.
I solved it with the _memcpy_l1 command :
// use of _memcpy_l1
unsigned char *dec_code =(unsigned char *) 0xffa00850;
extern unsigned char PlainData;
Decription code for PlainData
I still have the problem that i'm decrypting a much larger code then 656 bytes. (26k)
but this is an other problem
thank you for helping me
If copying a small buffer into L1 is working while copying a large buffer is causing exceptions, then a possible cause may be that live functions in L1 code are being overwritten by the copy operation.
Is there enough memory allocated in L1 code to receive the decrypted code?
the problem is to allocate large buffer in l1_data .
I guess i will have to make some changes in the ldf file or to devide this opertion.
I was able to allocate a large buffer(19kbytes) in L1_code
now I have a new problem : The Instruction section is still divided with the old division (old labels / function that with the new code that a placed have no meaninig) . How do I rearange L1_code?
You are not using the overlay model correct?
The buffer allocated in L1 code will serve as the target to the message (secure function) after it gets authenticated, correct?
In other words, initially, this buffer does not contain the message yet. Instead, the message exists as a data buffer in data memory. Therefore, the symbols (labels) of the message are not live at this point.
Are you asking how to rearrange L1 code in order to reuse the allocated buffer while the message is not in L1? If so, then the Lockbox example in VisualDSP, which uses overlays, addresses this requirement.
Retrieving data ...