cancel
Showing results for 
Search instead for 
Did you mean: 

Jump Application Code And Eeprom Fault

DCtech
Associate II

I am trying to jump user application from boot code:

Boot code only include below lines:

  

HAL_Init();
    SystemClock_Config();
    // Jump proccess start
    uint32_t reset_handler_add=*((volatile uint32_t*)(FLASH_APP_START_ADDRESS+4));
    void (*app_reset_handler)(void) = (void*)reset_handler_add;
HAL_RCC_DeInit();                  
    HAL_DeInit();
    __HAL_RCC_SYSCFG_CLK_DISABLE(); 
    SysTick->CTRL = 0;                   
    SysTick->LOAD = 0;                   
    SysTick->VAL = 0;                    
    __disable_irq();     
    SCB->VTOR = FLASH_APP_START_ADDRESS;                                                        
    uint32_t msp_value = *((volatile uint32_t*)(FLASH_APP_START_ADDRESS));
    __set_MSP(msp_value);
    app_reset_handler();

Also #define FLASH_APP_START_ADDRESS 0x080A0000 this is application code start address.

But when I jump the User application I2C and DMA not working so, I couldnt use eeprom

In the User application I stuck in while (HAL_I2C_GetState(hi2c) != HAL_I2C_STATE_READY) function when I jump the User App. But If User App work on the base 0x080000000 address everything successfull, When I jump I have problem.

I changed flash.Ld file:

MEMORY
{
RAM (xrw)      : ORIGIN = 0x20000000, LENGTH = 192K
CCMRAM (rw)      : ORIGIN = 0x10000000, LENGTH = 64K
FLASH (rx)      : ORIGIN = 0x080A0000, LENGTH = 256K
}

And changed #define VECT_TAB_OFFSET 0xA0000 value.

Where is the faults ?

7 REPLIES 7

I'd imagine disabling IRQs has some down stream consequences if you expect those to be working..

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
  1. I remove this line __disable_irq(); I get same error again.

Does SysTick run?

If the code works in one scenario and not another, you're going to need to start​ comparing core and peripheral register states, and establishing where functionality starts breaking down.

Best ​to set VTOR on the app side using linker symbols, and not defines.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Yes Systic Run and another perhipheral UART etc run except I2C. Only I2C not working correctly.

I2C flag return always HAL_I2C_STATE_BUSY_TX when I want to use HAL_I2C_Master_Transmit_DMA in User Application.

But User Application if start in base 0x0800000 adress everything working perfectly.

In the boot application there is no initilize any perhipheral, I only init Systick and HAL init.

How can I do below advise ?

you're going to need to start​ comparing core and peripheral register states, and establishing where functionality starts breaking down.

Best ​to set VTOR on the app side using linker symbols, and not defines.

Failing in code you're not showing. Perhaps simplify the code you've shown so the base code at 0x08000000 transfers control immediately out of Reset_Handler so you can eliminate what that is doing.

Dump registers in the memory space as you would any other memory content, either dump data to a UART or use the debugger memory or peripheral views?​

The linker exports a symbol for the vector table, use that. Assuming some familiarity with assemblers, compilers, linkers and loaders..​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Very interesting but I solved.

Boot code does not include any DMA process but If I enable DMA clocks before the jump User App,

0693W00000JOQpyQAH.pngUser App working correctly, If I disable this clocks before jump I get same error.

What is this situation reason, Does DMA only get clocks in start address (0x0800000) ?

anybody idea about this solution reason ?