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.

[PIC] PIC32 Application Jump to Bootloader code

Status
Not open for further replies.

dipk11

Junior Member level 2
Joined
Jul 27, 2017
Messages
23
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
245
Hi i am new to Pic32.
I want to jump from the application code to the bootloader when i receive a FW upgrade command from the PC.
The bootloader checks 2 conditions-valid application and a external trigger.
In my case, i do not want to use a switch press a s an external condition.
Can i set a GPIO Pin(as a condition for external trigger) and then jump to the bootloader without any reset?
Is there any other register that can be set in PIC32 for this implementation.

i want to check the register value in the bootloader code and then proceed with the fw upgrade process.

Any other idea for PIC32 MCu will be accepted.
 

The straightforward way would be to modify the bootloader code respectively. You didn't tell why this isn't an option.

If it's possible to fake a GPIO input to the bootloader depends on it's implementation details. It might work if it relies on POR default GPIO register settings and doesn't reprogram the pin to input. In this case an output state set in the application would be preserved.

The backside when jumping into the bootloader is, you possibly need to restore various registers to expected POR conditions. Jump anywhere in code space is however possible, at least using inline assembly code.
 
  • Like
Reactions: dipk11

    dipk11

    Points: 2
    Helpful Answer Positive Rating
The straightforward way would be to modify the bootloader code respectively. You didn't tell why this isn't an option.

If it's possible to fake a GPIO input to the bootloader depends on it's implementation details. It might work if it relies on POR default GPIO register settings and doesn't reprogram the pin to input. In this case an output state set in the application would be preserved.

The backside when jumping into the bootloader is, you possibly need to restore various registers to expected POR conditions. Jump anywhere in code space is however possible, at least using inline assembly code.

Yeah i am aware that when you jump from application code to bootloader we need to set all register as POR expected values.
I just wanted an alternative for external trigger as in my case i do not have access to the switches/external inputs for the bootloader to check.So i was thinking without doing an reset just set a GPIO and then jump to bootloader.

Is there any other way to implement it?
 

Yes i am modifyin the bootloader code for that external trigger condition. In the curent code, it checks for the switch pressed on the eval board.
I do not have access to the switch in my application so wanted to do it using a register.
You are correct, before switching to bootloader all the registers needs to be set at POR expected values.
Is there any register which can retain its value even after reset?
is there any other way to implement this external trigger?
 

Hi,

Is there any register which can retain its value even after reset?
I assume the SRAM isn´t cleared by a reset.
The datasheet should give you this information.

Klaus
 

Yes i am modifyin the bootloader code for that external trigger condition.
As said, if you customize the bootloader, there are much simpler ways to achieve what you want.

I use to have a flag in a memory range not cleared by the RTL init code.
E.g. assigned to an absolute address
Code:
unsigned int bootldr_info[4] __attribute__((section(".bootldr_info"),address(0xa001fff0), space(data)));
 

you can use Non volatile EEPROM.Whenever Application receives firmware upgrade command,just write flags in EEPROM and then reset the firmware.After reset firmware shall go to bootloader and read EEPROMflag.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top