This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/CC1310: Memory issues when using both ECC and crypro drivers together

Part Number: CC1310

Tool/software: Code Composer Studio

I make a project where:

1. Key is generated and initialized using the ECC driver 
2. using the key generated, the data is encrypted
3. data is sent to the other CC1310 board through Sub-GHz communication
4. data is received from the other CC1310 board through Sub-GHz communication
5. data received is decrypted.

When I made unit testing where I tried to encrypt and decrypt the data sent over the Sub-GHz communication, the crypto module works just fine and the data sent and received and decrypted correctly. Then, I added the key exchange mechanism (according to the example AES key agreement), issues happen with the crypto module where the data is passed to the function to be encrypted and the encryption is done successfully, but no encrypted data is saved in the array that is passed to the encryption function to return the encrypted data in.

you can find the code snippet below:

#define ROM_CRYPTO_BUFFER_ADDR 0x20004F00
#define ROM_CRYPTO_BUFFER_SIZE 0x100

#ifdef __TI_COMPILER_VERSION__
    #pragma LOCATION(romCryptoOutputBuffer, ROM_CRYPTO_BUFFER_ADDR);
    uint8_t romCryptoOutputBuffer[ROM_CRYPTO_BUFFER_SIZE];
#endif

#if defined(__TI_COMPILER_VERSION__)
#pragma DATA_ALIGN (rxDataEntryBuffer, 4);   
static uint8_t rxDataEntryBuffer[RF_QUEUE_DATA_ENTRY_BUFFER_SIZE(
        NUM_DATA_ENTRIES, 255, NUM_APPENDED_BYTES)];
#endif

uint8_t eccWorkzone[825];

CryptoCC26XX_init();

                memset(romCryptoOutputBuffer, 0, ROM_CRYPTO_BUFFER_SIZE);
                memset(eccWorkzone, 0, 825);

                TRNG_init();

                ECC_initialize((uint32_t*)eccWorkzone);


                CryptoCC26XX_Handle cryptoHandle;

                cryptoHandle = CryptoCC26XX_open(Board_CRYPTO0, false, NULL);
                if (cryptoHandle == NULL) {
                    /* CryptoCC26XX_open failed*/
                    while (1);
                }

                Crypto_Config.TRNGHandle= TRNG_open(Board_TRNG0, NULL);
                if (!Crypto_Config.TRNGHandle) {
                    while (1)
                        ;
                }

Testing Scenarios


1. when I change the array of the eccworkzone to be of type uint32_t, the communication will be affected and stopped after a while.

2. when I change the ROM_CRYPTO_BUFFER_ADDR to be 0x20004000 instead of 0x20004F00 and change the type of the eccworkzone array to uint32_t, it gives the same issues and behavior I mentioned before 

and here is the change I made to the linker file:

/* The starting address of the application. Normally the interrupt vectors */
/* must be located at the beginning of the application. */
#define FLASH_BASE 0x0
#define FLASH_SIZE 0x20000
#define RAM_BASE 0x20000000
#define RAM_SIZE 0x5000
#define RAM_RESERVED_OFFSET 0x4F00

/* System memory map */

MEMORY
{
/* Application stored in and executes from internal flash */
FLASH (RX) : origin = FLASH_BASE, length = FLASH_SIZE
/* Application uses internal RAM for data */
SRAM (RWX) : origin = RAM_BASE, length = RAM_RESERVED_OFFSET
}