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.

RM48L952: RM48L952 bootloader is not jumping to application code after writing APPLICATION_CODE code Flash memory.

Part Number: RM48L952
Other Parts Discussed in Thread: UNIFLASH

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

  • Hi Murali,

    This is my time to see that the application is placed at the 1st sector of the flash, and the bootloader is located in the middle of the flash. It is a pretty good idea.

    The cmd files look good to me.

    Do app1 and app2 have the same size? If app1 is larger than app2, for example app1 takes 3 sectors, and app2 uses only 2 sectors. When the bootloader programs app2 to flash0, the bootloader may only erase sector 1 and sector2, the sector3 may not be erased. The remaining app1 code in sector3 may affect the execution of your app1.
  • Hi wang,

    Thanks for the response.

    APP1 size is 174 Kbytes ((1,78,622 bytes)and APP2 size is 174 Kbytes (1,78,744 bytes) almost same size. Bootloader erases the complete FLASH0 of 0x00180000(Bank0 to Bank14) where application code will be written after erasing.

    Thanks and Regards,
    Murali Prasad
  • We are facing one more issue, If comment a line of code then we when we compile it.
    Vector table content changes even we have not enabled/ disabled the interrupts in the changed code.

    We are generating Hex file, Intel Hex file format

    APP1.hex :20 0000 00 0547 00EA FEFF FFEA FEFF FFEA FEFF FFEA 4547 00EA D548 00EA B0F1 1FE5 B0F1 1FE5 31
    APP2.hex :20 0000 00 1E47 00EA FEFF FFEA FEFF FFEA FEFF FFEA 5E47 00EA EE48 00EA B0F1 1FE5 B0F1 1FE5 E6


    Thanks and Regards,
    Murali Prasad
  • Hi Murali,

    Have you solved the application issue? I think one disadvantage of not placing the bootloader at first sector is that if any exception occurs during the flash erasing, the code will run away. After that, you wont be able to run the bootloader again (no exception vector table).
  • Hi Wang,

    Issue Is still exist. when compile the code with small change in application code just adding delay in app code interrupt vector table is changing as we have mentioned in my previous post.

    Thanks & Regards,
    Murali Prasad