Hi everyone,
I'm trying to jump to the USB DFU flash with Stm32cubeprogrammer using this code :
"uint32_t address = 0x1FFFD800;
am3_reset_watchdog_counter();
jump_to(address);
void clear_and_disable_isr(void)
{
/* Clear pending interrupts just to be on the safe side*/
SCB->ICSR = SCB_ICSR_PENDSVCLR_Msk;
/* Disable all interrupts */
uint8_t i;
for(i=0; i<8; i++)
NVIC->ICER[i] = 0xFFFFFFFF;//NVIC->IABR[i];
}
void jump_to(uint32_t addr)
{
typedef void (*pFunction)(void);
/* get jump address from application vector table */
pFunction jump_app_function = (pFunction) (((uint32_t*) addr)[1]);
clear_and_disable_isr();
/* set stack pointer as in application's vector table */
__set_MSP((uint32_t) ( (((uint32_t*) addr)[0])));
jump_app_function();
}"
But it's not working.
I'm using ChibiOS 17.6.0
My chip is an stm32f303cbt6.
Can you help me to make it work ?
Thanks.
[USB] Jump to internal bootloader
Moderators: tfAteba, barthess, RoccoMarco, lbednarz, utzig
- Giovanni
- Site Admin
- Posts: 14563
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1111 times
- Been thanked: 937 times
- Contact:
Re: [USB] Jump to internal bootloader
Hi,
Have you tried to single step at asm level? "not working" is a bit generic.
Giovanni
Have you tried to single step at asm level? "not working" is a bit generic.
Giovanni
Re: [USB] Jump to internal bootloader
Giovanni wrote:Hi,
Have you tried to single step at asm level? "not working" is a bit generic.
Giovanni
Hi Giovanni,
Thanks for your reply.
I just did it but i don't know what i supposed to get.
i got this as a last message : "No source available for "0x1ffff1bc""
- Giovanni
- Site Admin
- Posts: 14563
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1111 times
- Been thanked: 937 times
- Contact:
Re: [USB] Jump to internal bootloader
It jumped at that address, the debugger is unable to proceed because there is no source code for that address.
Giovanni
Giovanni
Re: [USB] Jump to internal bootloader
Giovanni wrote:It jumped at that address, the debugger is unable to proceed because there is no source code for that address.
Giovanni
How can i know it going to work without debugger ? what i have supposed to get at the end ?
- Giovanni
- Site Admin
- Posts: 14563
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1111 times
- Been thanked: 937 times
- Contact:
Re: [USB] Jump to internal bootloader
Apparently it jumped into the bootloader or whatever code is there, why it does not work I have no idea, it is possible you need to undo any initialization performed by the application, not just those NVIC registers. This should be directed to ST support.
Giovanni
Giovanni
Re: [USB] Jump to internal bootloader
I make sure virtually everything is reset to startup values, which may well be overkill. In particular, I found that not clearing down the MPU caused some problems.
Re: [USB] Jump to internal bootloader
Hi,
Thanks for your replies.
I added lines to disable initializations and the MPU, i still have the same result.
I checked the design(it's not mine) i found that the 1.5K resistance of D+ is connected to another pin to generate enable and disable for the USB and initialize it in a function, can you tell me if it's correct or i should connect it to 3.3V ? The boot_0 is connected to the ground, i think this one is correct.
Thanks for your replies.
I added lines to disable initializations and the MPU, i still have the same result.
I checked the design(it's not mine) i found that the 1.5K resistance of D+ is connected to another pin to generate enable and disable for the USB and initialize it in a function, can you tell me if it's correct or i should connect it to 3.3V ? The boot_0 is connected to the ground, i think this one is correct.
Who is online
Users browsing this forum: No registered users and 9 guests