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.

TMS320F280049C: Will there be a memory conflict when the bootloader and the app share a RAM area?

Part Number: TMS320F280049C

Hi Team,

Recently, I've been using 280049 to develop the bootloader, and I've fulfilled the program upgrading function in the bootloader. When switching from the bootloader to the app, I used the asm ("LB 0x00084002") command. When switching from the app to the bootloader, I used the watchdog to reset the chip. There are some questions I would like to ask you all.

For Bootloader and app, these two projects are stored in two independent sectors of FLASH and do not conflict with each other, but both projects use the same RAM memory area to store global variables during operation and files copied from FLASH to RAM code (ramfuncs). In this case,

1. Will there be a memory conflict on the RAM? If after power-on and switching from the bootloader to the app, do some global variables and codes (ramfuncs) stored in the RAM in the bootloader still exist? and is there any possibility of affecting the running of the app?

2. Do I need to clear the RAM before this switching?

3. After switching from the bootloader to the app, if I re-execute the c_int00 function to build the C language environment, will the c_int00 function clear the RAM (mainly the .bss and .ebss sections) to ensure that the memory is cleared before swtching to the app main()?

4. When bootloader and app use RAM, do they need to use different memory areas independently?

Kind regards,

Katherine

  • Hi Katherine,

    Are you using the ROM bootloader or a bootloader of your own? It would be a good idea to clear the RAM and reinitialize the stack pointer after jumping to the application.

    Regards, Pawan

  • Hi Pawan,

    I used my own bootloader. Does TI provide library functions for clearing RAM and initializing stack pointers?

    Kind regards,

    Katherine

  • Katherine,

    1. Will there be a memory conflict on the RAM? If after power-on and switching from the bootloader to the app, do some global variables and codes (ramfuncs) stored in the RAM in the bootloader still exist? and is there any possibility of affecting the running of the app?

    Yes, there could be conflicts, when you switch from the bootloader to the app, if you didn't take adequate care in the linker command files to separate them and avoid conflicts/overlaps. However, when you switch from the bootloader to the app, if you go through the C initialization routine (provided by the compiler), it will initialize whatever the application needs in RAM and initialize the SP before arriving at main(). In the process, it may end up overwriting some RAM areas that were being used earlier by the bootloader. This should not be an issue since you are not going to switch back LIVE to the bootloader from the App. When you switch from the bootloader to the App, you have a watchdog reset occurring.

    So, to summarize, I don't foresee an issue here. Question to you - what behavior are you observing in practice? Is it consistent with whatever I've predicted?

    2. Do I need to clear the RAM before this switching?

    Based on the above, No.

    3. After switching from the bootloader to the app, if I re-execute the c_int00 function to build the C language environment, will the c_int00 function clear the RAM (mainly the .bss and .ebss sections) to ensure that the memory is cleared before swtching to the app main()?

    Yes, this should work.

    4. When bootloader and app use RAM, do they need to use different memory areas independently?

    Only if you're doing a LFU (Live firmware update).

    Thanks,

    Sira