This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
We facing problem with bootloader is not jumping to application code after writing APPLICATION_CODE code Flash memory.
Description:
1) Bootloader code is stored in the FLASH1 -0x00180000
2) Application code is stored in the FLASH0 -0x00000000
First we will load bootloader to the controller then using UNIFLASH, then using bootloader we load .hex(Application code)
When applicaion code is running when we issue BOOT command from serial port
we are disabling all interrupts then jumping to bootloader address 0x00180000
using pointer ((void (*)(void))0x00180000)(); then Bootloader code runs and ask for confirmation to flash erase then send .hex file of application code
after writing to application code we are resetting using systemREG1->SYSECR = 0x00; /*Global System Reset*/
Application code runs for first time app1.hex file flashing and if we flash again same app1.hex application code runs
if we change the application code then flash app2.hex code will be written by bootloader to 0x00000000 address and soft reset will not occur and application doesn't run.
We tried using ((void (*)(void))0x00000000)(); to jump from bootloader to application code still we are facing problem when we are loading app2.hex file
We tried application code with all safety feature disabled still the same issue.
Bootloader firmware link.cmd file content as follows:
/* Linker Settings */
--retain="*(.intvecs)"
/* Memory Map */
MEMORY
{
/* USER CODE BEGIN (2) */
VECTORS (X) : origin=0x00000000 length=0x00000020
FLASH0 (RX) : origin=0x00000020 length=0x0017FFE0
VECTORS_1(RX): origin=0x00180000 length=0x00000020
FLASH1 (RX) : origin=0x00180020 length=0x0017FFE0
STACKS (RW) : origin=0x08000000 length=0x00001500
RAM (RW) : origin=0x08001500 length=0x0003eb00
/* USER CODE END */
}
/* Section Configuration */
SECTIONS
{
/* USER CODE BEGIN (4) */
.intvecs : {} >VECTORS
USER_FLASH_SECTION : {} > VECTORS_1 /* bootloader vector codes*/
.text : {} > FLASH1
.const : {} > FLASH1
.cinit : {} > FLASH1
.pinit : {} > FLASH1
.bss : {} > RAM
.data : {} > RAM
.sysmem : {} > RAM
/* USER CODE END */
}
Application code link.cmd file content as follows:
/* Linker Settings */
--retain="*(.intvecs)"
/* Memory Map */
MEMORY
{
/* USER CODE BEGIN (2) */
VECTORS (X) : origin=0x00000000 length=0x00000020
FLASH0 (RX) : origin=0x00000020 length=0x0017FFE0
FLASH1 (RX) : origin=0x00180000 length=0x00180000
STACKS (RW) : origin=0x08000000 length=0x00001500
RAM (RW) : origin=0x08001500 length=0x0003EB00
/* USER CODE END */
}
/* Section Configuration */
SECTIONS
{
/* USER CODE BEGIN (4) */
.intvecs : {} > VECTORS
.text : {} > FLASH0
.const : {} > FLASH0
.cinit : {} > FLASH0
.pinit : {} > FLASH0
.bss : {} > RAM
.data : {} > RAM
.sysmem : {} > RAM
/* USER CODE END */
}
sys_intvecs.asm file content of application code as follows:
.sect ".intvecs"
.arm
;-------------------------------------------------------------------------------
; import reference for interrupt routines
.ref _c_int00
.ref _dabort
.ref phantomInterrupt
.def resetEntry
;-------------------------------------------------------------------------------
; interrupt vectors
resetEntry
b _c_int00
undefEntry
b undefEntry
svcEntry
b svcEntry
prefetchEntry
b prefetchEntry
b _dabort
b phantomInterrupt
ldr pc,[pc,#-0x1b0]
ldr pc,[pc,#-0x1b0]
;--------------------------------------------------------------------------
Kindly let us know if any issue in the above and what could cause the application code to not to run second time.
Thanks and Regards,
Murali Prasad