cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with custom bootloader and STM32F042 (Solved)

RamiroGJ
Associate II

Dear Friends,

 

Edited:

I have a bootloader that I made via I2C through the mailbox of an ST25DV04.
The bootloader works fine, it is able to save in the flash the whole content of the hex file (valid data).
I have added vector table remapping in my "blink" application as indicated in the following post:
https://community.st.com/t5/embedded-software-mcus/how-to-boot-to-random-address-without-vect-tab-offset-stm32f072/m-p/170236#M10247 

The problem is that when I go to launch the application the program goes to HardFault_Handler and I can't figure out why.

The code I use to jump into my application:

 

static void runApp()
{
	typedef void (*pFunction)(void);
	pFunction Jump_To_Application;
	uint32_t JumpAddress;

	HAL_I2C_MspDeInit(&hi2c1);

	HAL_DeInit();

	/* Jump to user application */
	JumpAddress = *(__IO uint32_t*) (APP_START + 4);
	Jump_To_Application = (pFunction) JumpAddress;

	/* Initialize user application's Stack Pointer */
	__set_MSP(*(__IO uint32_t*) APP_START);

	/* Jump to application */
	Jump_To_Application();
}

 

The content of the flash once the bootloader is executed is the same as if I load my application directly with Cube Ide. I can check this both in Cube Ide and with Cube Programmer.

I would appreciate some help with this issue.

 

1 ACCEPTED SOLUTION

Accepted Solutions
RamiroGJ
Associate II

Dear administrators, you can delete the post if you want, I finally found the problem.
The problem derived from an erroneous offset in my flashing protocol through the mailbox of st25dv04, it is now solved and works 100%.

View solution in original post

1 REPLY 1
RamiroGJ
Associate II

Dear administrators, you can delete the post if you want, I finally found the problem.
The problem derived from an erroneous offset in my flashing protocol through the mailbox of st25dv04, it is now solved and works 100%.