mikroc PRO for PIC32 v4.0.0 sets RAM variables to 0

General discussion on mikroC PRO for PIC32.
Post Reply
Author
Message
Wapayk
Posts: 12
Joined: 18 Feb 2013 13:41

mikroc PRO for PIC32 v4.0.0 sets RAM variables to 0

#1 Post by Wapayk » 05 Jun 2021 08:27

Hi,

My hardware runs on battery so power is always available and I have written program on mikroc for PIC32 v3.6.1., MCU is PIC32MX170F256B
I use four unsigned long variables to store counter data while device is in sleep. Sometimes during maintence operator needs to reset MCU via MCLR to wake it up.

After upgrading compiler to V4.0.0. RAM variables are cleared to 0.

Is there a way to keep RAM state after software(SWRST) or MCLR reset events on mikroc pro for PIC32 V4.0.0.

so short code is like this..

Code: Select all

unsigned long counter1 absolute 0xA0000000;

void main(){
counter1++;
asm wait;
}
before on v3.6.1 it kept RAM state after MCLR reset , and now it sets it to zero after MCLR reset

B.r.,
Marjan

User avatar
filip.grujcic
Posts: 822
Joined: 14 May 2018 08:34

Re: mikroc PRO for PIC32 v4.0.0 sets RAM variables to 0

#2 Post by filip.grujcic » 07 Jun 2021 11:23

Hello,

I modified the system library according to this and attached it below. Please extract it and copy the .emcl file to C:\Users\Public\Documents\Mikroelektronika\mikroC PRO for PIC32\Uses (default installation path).
Rebuild your project with Alt + F9 and the RAM shouldn't be getting erased after MCLR reset.

Regards,
Attachments
__Lib_System_12_preserveRAM.zip
(1.69 KiB) Downloaded 47 times
Filip Grujcic

Post Reply

Return to “mikroC PRO for PIC32 General”