A processor system comprising: a central processing unit , CPU, comprising a register for storing a stack pointer value; a random-access memory, RAM, coupled to the CPU and having a first RAM region and a second RAM region ; a non-volatile memory coupled to the CPU and having a first non-volatile memory region configured to store instructions executable by the CPU and a second non-volatile memory region configured to store a RAM-image comprising program context data ; and wherein the processor system is configured to have a first operating mode where the RAM data values are not retained and a second operating mode where the RAM is powered on and is further configured to change from the first operating mode to the second operating mode by: applying power to the RAM , setting the stack pointer value to an address in the second RAM region , copying the program context data from the second non-volatile memory region to the first RAM region , and setting the stack pointer value to an address within a segment of the first RAM region ; wherein the program context data comprises a stack area and a heap area arranged towards opposite ends of the program context data and separated by an uninitialized data segment and a data segment and wherein in the second operating mode the stack and the heap are configured to increase in opposite directions. a central processing unit , CPU, comprising a register for storing a stack pointer value; a random-access memory, RAM, coupled to the CPU and having a first RAM region and a second RAM region ; a non-volatile memory coupled to the CPU and having a first non-volatile memory region configured to store instructions executable by the CPU and a second non-volatile memory region configured to store a RAM-image comprising program context data ; and wherein the processor system is configured to have a first operating mode where the RAM data values are not retained and a second operating mode where the RAM is powered on and is further configured to change from the first operating mode to the second operating mode by: applying power to the RAM , setting the stack pointer value to an address in the second RAM region , copying the program context data from the second non-volatile memory region to the first RAM region , and setting the stack pointer value to an address within a segment of the first RAM region ; wherein the program context data comprises a stack area and a heap area arranged towards opposite ends of the program context data and separated by an uninitialized data segment and a data segment and wherein in the second operating mode the stack and the heap are configured to increase in opposite directions. applying power to the RAM , setting the stack pointer value to an address in the second RAM region , copying the program context data from the second non-volatile memory region to the first RAM region , and setting the stack pointer value to an address within a segment of the first RAM region ; wherein the program context data comprises a stack area and a heap area arranged towards opposite ends of the program context data and separated by an uninitialized data segment and a data segment and wherein in the second operating mode the stack and the heap are configured to increase in opposite directions. <EOS>