Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] retain data memory after reset (PIC24FJ64GA004)

Status
Not open for further replies.

siongboon

Advanced Member level 1
Joined
Jan 24, 2006
Messages
425
Helped
45
Reputation
88
Reaction score
10
Trophy points
1,298
Location
Singapore
Activity points
4,069
Hi,

I am having problem looking for in the datasheet for PIC24FJ64GA004.
I couldn't find any information on the status of the data memory
after the microcontroller reset.

I understand that after a power lost, the memory should be reset to 0x00
When I do a reset on MCLR, I would expect that the data would
be retain on the data memory.
This is not the case in my test code, indicating that the data memory
are initialised to 0x00.

Is there anyone of you who can guide me to
locate further information on data memory.

I would like to know if it is possible to retain the data
in the data memory after a reset on MCLR pin.

Thank you very much.
Siong Boon

MODERATOR - SIGNATURE LINKS ARE NOT ALLOWED
 

btbass

Advanced Member level 5
Joined
Jul 20, 2001
Messages
1,897
Helped
438
Reputation
880
Reaction score
287
Trophy points
1,363
Location
Oberon
Activity points
12,861
You might be able to do this by using the linker option

'--no-data-init'

The linker links in the start up file 'crt0.s' which you will find in the '\src\pic30' directory. You can open the file to view it. This is the file that initializes the Micro.
There is an alternate version 'crt1.s' that does not initialize data memory.
 

    siongboon

    Points: 2
    Helpful Answer Positive Rating

siongboon

Advanced Member level 1
Joined
Jan 24, 2006
Messages
425
Helped
45
Reputation
88
Reaction score
10
Trophy points
1,298
Location
Singapore
Activity points
4,069
Hi btbass,

Thank you very much.
I managed to see the files in the pic30 folder.

I didn't realised that there are much more coding
added to our source code, and been searching up and down
in their microcontroller documentation.

Thank you.

Best Regards,
Siong Boon

Added after 1 hours 3 minutes:

Hi btbass,

I managed to find the linker option in the MPLAB
Project->Build Options...->Project->MPLAB LINK30->Don't initialize data sections.

One thing I still have question on.
Can the linker option '--no-data-init' be written in the source code itself?

Thanks.
Siong Boon

MODERATOR - SIGNATURE LINKS ARE NOT ALLOWED
 

btbass

Advanced Member level 5
Joined
Jul 20, 2001
Messages
1,897
Helped
438
Reputation
880
Reaction score
287
Trophy points
1,363
Location
Oberon
Activity points
12,861
Hi Siong Boon,

I don't think you can write it in the source file, it's a command line option to the linker. You could look at the linker documentation, there might be something in there.
The C run time file 'crt0.s' is the first code that is executed on Micro reset. It initializes the stack, constants and memory and then calls your 'main' function.
It is worth looking at to learn what it does. You can get it to call your own start up functions if there is something you want to do before the 'main' program entry point.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top