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.

Compiler/TMS570LS1227: Retention RAM data after software reset.

Part Number: TMS570LS1227
Other Parts Discussed in Thread: HALCOGEN

Tool/software: TI C/C++ Compiler

Hi, I am trying to get a few bytes data saved on RAM after I perform a software reset (write 1<<15 in SYSECR).

I have tried to use PERSISTENTf like this

#pragma PERSISTENT(x)
#pragma location = 0x0801FFF0  //memory address in RAM of your choice
static uint32_t x;

But it doesn't seems to work.

  • I'd need to look up what that pragma does, but I would suspect that your first issue is that the RAM on this device is automatically initialized to 0's in hardware using the memory init feature.

    The hardware memory initialization is there because the RAM has ECC protection and if the RAM and ECC contents
     just power up and are uninitialized, your RAM will be full of single and double bit ECC errors.


    So what you are asking can be done but it isn't as simple as you might think.   Also I don't think we have a good example for you to follow.

    You will need to follow the HalCoGen (assuming you are using it) code from c_int00() the entry point after reset and see where it initializes RAM.    You'll probably need to

        - add code to read your persistent memory location and keep the value in a register in the CPU.

        - perform the memory init 

        - write the value back to ram for the persistent location


    So something very custom.   This solution also doesn't scale well because I suggested keeping the value in a  CPU register and these are limited plus some are used by the call to the memory init.

    Second you will need to consider how to validate that the persistent memory location's data is good or not.  And you might generate an ECC error just reading it so care needs to be taken to have an appropriate handler in case it's the first time after a power cycle...

    I think you'll need to spend some decent amount of time on this task,  because of these complexities.  Just a warning that it's not a simple thing.


    -Anthony

  • Hi Anthony,

    Thank you for your answer! 

    Since I could read software rest flag (SWRST) from System Exception Status Register (SYSESR), I am wondering if I can skip the initialization of RAM if a software reset is performed.

    Best,

    Charlie

  • Hi Charlie,

    You could try that but then you have to consider why the reset might have occurred... Maybe it got to the state of having a warm reset as an effect of some double bit error in the RAM.

    So you might decide the system would be more robust to always initialize the RAM except for the little bit that needs to be persistent.

    This is somewhat related to the question of running the CPU LBIST at times other than startup. We say you can save the state to RAM but saying it and doing it are two different things and we unfortunately don't have any examples to show how. It's going to be some very tricky code..

    Thanks and Best Regards,
    Anthony
  • Hi Anthony, I am wondering what will happen if bit error occurred. Will there be any flag indicating it is reset from an exception instead a normal software reset?