cancel
Showing results for 
Search instead for 
Did you mean: 

IAP Go to infinite loop when Hard Fault

vbruno1
Associate III
Posted on June 08, 2016 at 16:57

STM3210E_EVAL on board after erasing the flash, I installed IAP application as STM32Cube_FW_F1_V1.3.0.

Running the IAP program without having loaded any user application code, the micro goes hard fault. I think it is normal.

After I tried to load the bin file obtained by compiling the application CDC_Standalone as applicatione user.

But the micro is still hard fault.

What am I doing wrong?

The generated bin file of the sample file?

I'm using the STM32Cube_FW_F1_V1.3.0 applications.
6 REPLIES 6
Posted on June 08, 2016 at 17:41

What are you using to build the firmware, and is it (via linker script/scatter file) linking it for the correct memory address?

Have your Hard Fault Handler provide some diagnostic information so you can pin point the fault.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
vbruno1
Associate III
Posted on June 09, 2016 at 10:12

Pretty sure you can't have the application reside at the base of flash (0x08000000) as that is where the IAP loader resides.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
vbruno1
Associate III
Posted on June 09, 2016 at 15:11

if I understand correctly I need to change

http://www.image-share.com/ijpg-3257-html

to the user application? right? What value is that I have to use?

#define APPLICATION_ADDRESS (uint32_t)0x08004000 /* Start user code address: ADDR_FLASH_PAGE_8 */

Posted on June 09, 2016 at 16:10

I think the read me associated with the project does explain the mechanics.

STM32Cube_FW_F1_V1.3.0\Projects\STM3210C_EVAL\Applications\IAP\IAP_Main\readme.txt

I'm neither an IAR or HAL user.

I think more specifically you need to change the ROM definition, moving the address forward by 0x4000 (16 KB) to 0x08004000 and shrinking the size by 0x4000. This may well move the vector setting with it, but if not change it also. Make sure that wherever in your code you change SCB->VTOR (perhaps SystemInit, in system_stm32f1xx.c) that this address reflects the address of the vector table for the application, otherwise interrupt won't work properly.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
vbruno1
Associate III
Posted on June 09, 2016 at 17:25

Thank you so much.

Now the user application is successful. I've changed this value as you say me.

#define VECT_TAB_OFFSET 0x4000 //default value is 0x0 
/*!< Vector Table base offset field. 
This value must be a multiple of 0x */

And I'm changed the value in the Linker of the Vector Table in0x08004000 and range of ROM, start is0x08004000 and end is0x08080000.