This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
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

How to execute code from RAM on nRF51 using GCC Environment

How to execute code from RAM on nRF51 using GCC Environment

  • Hi Anand, It seems like there is some incompatibilities in SDK v6 with regards to placing functions in RAM (and calling flash-functions). I could not get this to work properly either. Could you try this on SDK v7.x or newer?

  • Hi Håkon,

    I tested with SDK v7 , Still I am facing the same issue as below. (.data+0x1a): relocation truncated to fit: R_ARM_THM_CALL against symbol `simple_uart_putstring' defined in .text.simple_uart_putstring section in _build/simple_uart.o

    Can you please check this on higher priority.

    Regards, Anand

  • Hi Anand,

    You're seeing a conflict between the function you state to be placed in RAM, where it calls functions that have been placed in .text (flash) and therefore the linker throws an error back. In order to link the application properly, you will have to make sure that all functions called within the function that you have placed in RAM, also are located in RAM. If not, only partial segments of the call tree is present in RAM, thus invoking a higher current consumption. I would recommend that you look into the gcc linker scripts and create proper RAM-segments, or manually trace the call tree of your function and place the sub-functions into RAM using attribute. However; What I have to ask is which functions do you need to place in RAM? Normally you want time-consuming functions to be placed in RAM, for instance flash-writing operations, or interrupt functions.

    Cheers, Håkon

  • Hi Håkon

    unsigned char *encryptedData; unsigned int encryptedDataAfterAppendingLength;

    memset(encryptedData, 0, encryptedDataAfterAppendingLength);

    In order to execute this from RAM , how I can rewrite this code using for loop.

    Regards, Anand

Related