Continue to Site

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] Jumping to an erased location

Status
Not open for further replies.

kanni1303

Full Member level 3
Joined
Jun 29, 2012
Messages
164
Helped
12
Reputation
24
Reaction score
11
Trophy points
1,298
Location
Chennai, Tamil Nadu, India
Activity points
2,708
Hi,
I came across this following code, and my understanding from it as, the particular memory is erased and the same address is pointed by a function. Using this function pointer the address is invoked. my questions is what will the behavior is accessing or jumping to an erased memory, most case it will reset, but which one causes it to reset....??? the watchdog is disabled.

This code is taken from microchip bootloader application note.
Code:
    pFlash = (void*) (0x9D006000 + 0x1000);
    result = NVMemErasePage(pFlash);

    // Assert on NV error. This must be caught during debug phase.
    ASSERT(result == 0);

    void (*fptr)(void);
    fptr = (void (*)(void))(0x9D006000 + 0x1000);
    fptr();
 

Executing erased memory will have the same effect as the executing 'nop' command. Command pointer will be just increased by 1 every cycle till the end of memory or starting user-code.
 
Executing erased memory will have the same effect as the executing 'nop' command. Command pointer will be just increased by 1 every cycle till the end of memory or starting user-code.
True for "small" PICs. The shown code is apparently dedicated to PIC32, it generates an exception when executing code outside existing memory range (similar to ARM etc.). Also PIC24 may run into an address error trap.
 
I think it should be address error trap, since the handler for this exception is reset. They are using this to jump from application to bootloader.
So for micro PIC we can't use the same technique to jump.
Thank you guys
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top