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.

TMS320F280037C: Uploading application through debugger when there is a bootloader already installed

Part Number: TMS320F280037C
Other Parts Discussed in Thread: SYSCONFIG

Hello,

In our application, we have two separate codes, a bootloader that is located at the flash entry point and application code which resides in bank1. We have encoutered a strange behavior when we try to upload the application by means of the debugger instead of the bootloader. After debugging and power cycling, the application seems to not match with the expected one, for example, leds are not working as expected, motor is not moving as expected, etc.

I am troubleshooting this issue and I would like to ask some questions regarding the bootloading flow and debugging.

- How does affect uploading a code through debugger instead of uploading through bootloader, the procedure should be as simple as uploading the .txt file like in bootloader?

- I have different .cmd and .asm between projects. For example, I have a .asm file for the DCSM module to modify the default boot modes in the bootloader project. The files are converted in .obj by the compiler and always executed after power cycling even though I uploaded an application with the debugger?

- In the .asm file of bootloader for example, before branching to application, the bootloader supposedly resets the cpu registers and flushes the stack. THis should always be executed no when the mcu is power cycled right? It should no matter if I uploaded application code through debugger or am I missing something here too?

I followed pretty much the example of the bootloader foun in the sci examples.

Thank and regards,

David

  • Hi David,

    >How does affect uploading a code through debugger instead of uploading through bootloader, the procedure should be as simple as uploading the .txt file like in bootloader?

    When uploading code through the debugger, you are uploading a .out file to the device, compared to the .txt that the bootloader receives. 

    >The files are converted in .obj by the compiler and always executed after power cycling even though I uploaded an application with the debugger?

    Are these converted files from the kernel or the application? Can you provide an example of the DCSM .asm file that you used

    >THis should always be executed no when the mcu is power cycled right? It should no matter if I uploaded application code through debugger or am I missing something here too?

    Yes, after a reset the stack is also cleared.

    Thanks and regards,

    Charles

  • Hello Charles,

    When uploading code through the debugger, you are uploading a .out file to the device, compared to the .txt that the bootloader receives. 

    Yes but in essence the code should be the same right?

    The files are .cmd files that i modified in osme degree or .asm files used for the initialization device or for the DCSM, The .asm file to configure the DCSM is as follows (I obtained it from sysconfig):


    ;----------------------------------------------------------------------
    ; Zone 1
    ;----------------------------------------------------------------------
         .sect "dcsm_otp_z1_linkpointer"
          .retain
          .long 0x00003FFF
          .long 0x00003FFF
          .long 0x00003FFF

         .sect "dcsm_otp_z1_jlm_enable"
          .retain
          .long 0xFFFF000F     ;Z1OTP_JLM_ENABLE
    ;;     .sect "dcsm_otp_z1_jtag_pswdh"
    ;;      .retain
    ;;      .long 0x4BFFFFFF     ;Z1OTP_JTAGPSWDH0
    ;;      .long 0x3FFFFFFF     ;Z1OTP_JTAGPSWDH1

         .sect "dcsm_otp_z1_cmac_key"
          .retain
          .long 0x00000000     ;Z1OTP_CMACKEY0
          .long 0x00000000     ;Z1OTP_CMACKEY1
          .long 0x00000000     ;Z1OTP_CMACKEY2
          .long 0x00000000     ;Z1OTP_CMACKEY3

         .sect "dcsm_otp_z1_pswdlock"
          .retain
          .long 0xFB7FFFFF

         .sect "dcsm_otp_z1_crclock"
          .retain
          .long 0x7FFFFFFF

         .sect "dcsm_otp_z1_gpreg"
          .retain
          .long 0x5AFFFFFF     ;Z1OTP_GPREG1 = Z1_BOOTPIN
          .long 0x5AFFFFff     ;Z1OTP_GPREG2
          .long 0xFFFFFF03     ;Z1OTP_GPREG3 = Z1OTP_BOOTDEF_LOW
          .long 0xFFFFFFFF     ;Z1OTP_GPREG4 = Z1OTP_BOOTDEF_HIGH
         .sect "dcsm_zsel_z1"
          .retain
          .long 0xFFFFFFFF     ;Z1OTP_CSMPSWD0 (LSW of 128-bit password)
          .long 0x4D7FFFFF     ;Z1OTP_CSMPSWD1
          .long 0xFFFFFFFF     ;Z1OTP_CSMPSWD2
          .long 0xFFFFFFFF     ;Z1OTP_CSMPSWD3 (MSW of 128-bit password)

          .long 0xAAAAAAAA     ;Z1OTP_GRABSECT1
          .long 0xAAAAAAAA     ;Z1OTP_GRABSECT2
          .long 0xAAAAAAAA     ;Z1OTP_GRABSECT3
          .long 0x0000AAAA     ;Z1OTP_GRABRAM1
          .long 0xFFFFFFFF     ;Reserved
          .long 0xFFFFFFFF     ;Reserved

          .long 0xFFFFFFFF     ;Z1OTP_EXEONLYSECT1
          .long 0x0000FFFF     ;Z1OTP_EXEONLYSECT2
          .long 0x000000FF     ;Z1OTP_EXEONLYRAM1
          .long 0xFFFFFFFF     ;Reserved
          .long 0xFFFFFFFF     ;Z1OTP_JTAGPSWDL0
          .long 0x2BFFFFFF     ;Z1OTP_JTAGPSWDL1


    ;----------------------------------------------------------------------

    ; For code security operation,after development has completed, prior to
    ; production, all other zone select block locations should be programmed
    ; to 0x0000 for maximum security.
    ; If the first zone select block at offset 0x10 is used, the section
    ; "dcsm_rsvd_z1" can be used to program these locations to 0x0000.
    ; This code is commented out for development.

    ;       .sect "dcsm_rsvd_z1"
    ;        .loop (1e0h)
    ;              .int 0x0000
    ;        .endloop


    ;----------------------------------------------------------------------
    ; Zone 2
    ;----------------------------------------------------------------------
    ;;     .sect "dcsm_otp_z2_linkpointer"
    ;;      .retain
    ;;      .long 0x00003FFF
    ;;      .long 0x00003FFF
    ;;      .long 0x00003FFF
    ;;
    ;;     .sect "dcsm_rsvd_z2"
    ;;      .retain
    ;;      .long 0xFFFFFFFF     ;Reserved
    ;;     .sect "dcsm_otp_z2_pswdlock"
    ;;      .retain
    ;;      .long 0x1F7FFFFF
    ;;
    ;;     .sect "dcsm_otp_z2_crclock"
    ;;      .retain
    ;;      .long 0x3FFFFFFF
    ;;
    ;;     .sect "dcsm_otp_z2_gpreg"
    ;;      .retain
    ;;      .long 0x5AFF1820     ;Z2OTP_GPREG1 = Z2_BOOTPIN
    ;;      .long 0x5AFFFFff     ;Z2OTP_GPREG2
    ;;      .long 0x00000000     ;Z2OTP_GPREG3 = Z2OTP_BOOTDEF_LOW
    ;;      .long 0xFFFFFFFF     ;Z2OTP_GPREG4 = Z2OTP_BOOTDEF_HIGH
    ;;     .sect "dcsm_rsvd1_z2"
    ;;      .retain
    ;;      .long 0xFFFFFFFF     ;Reserved
    ;;      .long 0xFFFFFFFF     ;Reserved
    ;;
    ;;     .sect "dcsm_zsel_z2"
    ;;      .retain
    ;;      .long 0xFFFFFFFF     ;Z2OTP_CSMPSWD0 (LSW of 128-bit password)
    ;;      .long 0x1F7FFFFF     ;Z2OTP_CSMPSWD1
    ;;      .long 0xFFFFFFFF     ;Z2OTP_CSMPSWD2
    ;;      .long 0xFFFFFFFF     ;Z2OTP_CSMPSWD3 (MSW of 128-bit password)
    ;;
    ;;      .long 0xAAAAAAAA     ;Z2OTP_GRABSECT1
    ;;      .long 0xAAAAAAAA     ;Z2OTP_GRABSECT2
    ;;      .long 0xAAAAAAAA     ;Z2OTP_GRABSECT3
    ;;      .long 0x0000AAAA     ;Z2OTP_GRABRAM1
    ;;      .long 0xFFFFFFFF     ;Reserved
    ;;      .long 0xFFFFFFFF     ;Reserved
    ;;
    ;;      .long 0xFFFFFFFF     ;Z2OTP_EXEONLYSECT1
    ;;      .long 0x0000FFFF     ;Z2OTP_EXEONLYSECT2
    ;;      .long 0x000000FF     ;Z2OTP_EXEONLYRAM1
    ;;      .long 0xFFFFFFFF     ;Reserved
    ;;      .long 0xFFFFFFFF     ;Reserved
    ;;      .long 0xFFFFFFFF     ;Reserved


    ;----------------------------------------------------------------------

    ; For code security operation,after development has completed, prior to
    ; production, all other zone select block locations should be programmed
    ; to 0x0000 for maximum security.
    ; If the first zone select block at offset 0x10 is used, the section
    ; "dcsm_rsvd_z2" can be used to program these locations to 0x0000.
    ; This code is commented out for development.

    ;       .sect "dcsm_rsvd_z2"
    ;        .loop (1e0h)
    ;              .int 0x0000
    ;        .endloop


    ;----------------------------------------------------------------------
    ; End of file
    ;----------------------------------------------------------------------

    Therefore, to conclude. The should be no difference between running from debugger and running from flash

    Regards,

    David

  • >Yes but in essence the code should be the same right?

    Yes.

    I'll need some more time to review with my team the rest of this post, will get back to you by early next week.

    Thanks and regards,
    Charles

  • Hi David,

    Something to note on the DCSM modules generated .asm and .cmd files, when the edits are made to the .asm and .cmd files themselves, they are overwritten by the contents of SysConfig when regenerating the project. Can you list the exact steps for how these files are being made and added to the project?

    Thanks and regards,

    Charles

  • Hello Charles,

    Sorry for the inconvinience, I missclicked your message as this resolved my issue. Regarding your question, the .asm files generated by the DCSM module are copied from another sysconfig. It was obtained from the application project. Therfore, I only copied the .asm and .cmd files regarding the dcsm and put them into the bootlaoder project. However, in the bootloader sysconfig file, I did not configure the DCSM module

    Regards,

    David

  • Hi David,

    Are you able to share your map and .txt files for the generated application sent to the bootloader? Is it the same as what is being sent using the debugger?

    Thanks and regards,

    Charles

  • Hello Charles,

    I checked the app file generated by the compiler and the one used in the debugger. I found that there were minimal diferences and therefore, different applications. I will check why did this happen. For now, thank you for your help in finiding the issue.

    Regards,

    David