2023-03-24 02:29 AM
hi,
I make bootloader to switch the code between two bank starting at address 0x08000000.
and two application starting at 0x08020000 and 0x08100000 respectively, when I individual run the code it work fine, but when I hard reset the code, it goes to bootloader and then it jump to the application , execute the line before task, And then dont know what happening in the code , the define task wont run.
after kernel it wont jump to the task
Flash_Read_Data(0x081E0000 , Rx_Data, 4);
if(Rx_Data[0] == 0x01 && Rx_Data[1] == 0x02 && Rx_Data[2] == 0x03 && Rx_Data[3] == 0x04)
{
__disable_irq();
goto_application_0x08100000();
}
if(Rx_Data[0] == 0x04 && Rx_Data[1] == 0x05 && Rx_Data[2] == 0x06 && Rx_Data[3] == 0x07)
{
__disable_irq();
goto_application_0x08020000();
}
if(Rx_Data[0] == 0xFFFFFFFF && Rx_Data[1] == 0xFFFFFFFF && Rx_Data[2] == 0xFFFFFFFF && Rx_Data[3] == 0xFFFFFFFF)
{
__disable_irq();
goto_application_0x08100000();
}
this is my bootloader code.
/* Specify the memory areas */
MEMORY
{
FLASH (rx) : ORIGIN = 0x08100000, LENGTH = 1024K
DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
RAM_D1 (xrw) : ORIGIN = 0x24000000, LENGTH = 512K
RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 288K
RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 64K
ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K
}
#define USER_VECT_TAB_ADDRESS
#if defined(USER_VECT_TAB_ADDRESS)
//#if defined(DUAL_CORE) && defined(CORE_CM4)
/*!< Uncomment the following line if you need to relocate your vector Table
in D2 AXI SRAM else user remap will be done in FLASH BANK2. */
/* #define VECT_TAB_SRAM */
#if defined(VECT_TAB_SRAM)
#define VECT_TAB_BASE_ADDRESS D2_AXISRAM_BASE /*!< Vector Table base address field.
This value must be a multiple of 0x200. */
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
This value must be a multiple of 0x200. */
#else
#define VECT_TAB_BASE_ADDRESS FLASH_BANK2_BASE /*!< Vector Table base address field.
This value must be a multiple of 0x200. */
#define VECT_TAB_OFFSET 0x00100000U /*!< Vector Table base offset field.
This value must be a multiple of 0x200. */
#endif /* VECT_TAB_SRAM */
#else
/*!< Uncomment the following line if you need to relocate your vector Table
in D1 AXI SRAM else user remap will be done in FLASH BANK1. */
/* #define VECT_TAB_SRAM */
#if defined(VECT_TAB_SRAM)
#define VECT_TAB_BASE_ADDRESS D1_AXISRAM_BASE /*!< Vector Table base address field.
This value must be a multiple of 0x200. */
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
This value must be a multiple of 0x200. */
#else
#define VECT_TAB_BASE_ADDRESS FLASH_BANK1_BASE /*!< Vector Table base address field.
This value must be a multiple of 0x200. */
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
This value must be a multiple of 0x200. */
#endif /* VECT_TAB_SRAM */
#endif /* DUAL_CORE && CORE_CM4 */
//#endif /* USER_VECT_TAB_ADDRESS */
#define FLASH_BANK1_BASE (0x08020000UL) /*!< Base address of : (up to 1 MB) Flash Bank1 accessible over AXI */
#define FLASH_BANK2_BASE (0x08100000UL) /*!< Base address of : (up to 1 MB) Flash Bank2 accessible over AXI */
#define FLASH_END (0x081FFFFFUL) /*!< FLASH end address
/* Legacy define */
#define FLASH_BASE FLASH_BANK2_BASE
the above setting is for flash bank _2
please someone guide me, since last one week i am doing this,
Thanking you.