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.

CCS/TMS570LS0432: Problem flashing the code

Part Number: TMS570LS0432


Tool/software: Code Composer Studio

I am not able to flash my code in the launchpad board. I am attaching the screen shot of the problem that I am getting while debugging the code. Please help.

Thanks and Regards,

Saurabh Shah,

COEP.

  • Hello Saurabh,

    TMS570LS0432 has only one flash bank, and it is not allowed to program/erase the flash sectors from the code executing in the same flash bank. You need copy the flash API related code to SRAM, and execute the flash operation code from SRAM.
  • Hello QJ Wang,

    Thankyou for your reply.

    Please guide me how I can do that.

    Thanks and Regards,

    Saurabh Shah

    CoEP.

  • Hello Saurabh,

    1. add section in link.cmd file

       define a section for flasg API related objects: bl_flash.obj, Fapi_userDefinedFunction.obj, and API Library

    2. Write a function to copy the flashAPI function to SRAM

    ; Copy the Flash API from flash to SRAM.
    ;

    .def _copyAPI2RAM_
    .asmfunc

    _copyAPI2RAM_

    .ref api_load
    flash_load .word api_load
    .ref api_run
    flash_run .word api_run
    .ref api_size
    flash_size .word api_size

    ldr r0, flash_load
    ldr r1, flash_run
    ldr r2, flash_size
    add r2, r1, r2
    copy_loop1:
    ldr r3, [r0], #4
    str r3, [r1], #4
    cmp r1, r2
    blt copy_loop1
    bx lr

    .endasmfunc

    3. Call the function defined in step 2 in main()

  • Attached is the example cmd file

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/312/4431.bl_5F00_link.cmd

  • Hello QJ Wang,

    As per your guidelines I have written the function. But now I am getting the following error.

    Please help.

    Thanks and Regards,

    Saurabh Shah,

    CoEP.

  • Hello Saurabh,

    I am not what statements in sys_main() cause this problem. Can you enable the verbose option in compile option: --verbose_diagnostics. This causes the compiler to echo the problem line, with a pointer to where on the line the problem starts.
  • Hello QJ Wang,

    Below is the function written in sys_main.c. I have enabled the verbose_diagnostic but no help from that as well. Help me out.

    Thanks and regards,

    Saurabh Shah,

    CoEP

  • Hello Saurabh,

    The spi_size, api_load and api_run should be defined in link.cmd file. For example:

      flashAPI :

      {

        Fapi_UserDefinedFunctions.obj (.text)

        bl_flash.obj (.text)

        --library= ..\..\..\lib\F021_API_CortexR4_BE.lib (.text)

      } load = FLASH_API, run = SRAM, LOAD_START(api_load), RUN_START(api_run), SIZE(api_size)

    api_size is size of the API related code (Fapi_UserDefinedFunctions.obj,  bl_flash.obj, the lib).

    api_run is the address of the API related code in SRAM (copied)

    api_load is the address of the API related code in flash

    Please use those three variable in your code copy function.

     

     

  • Hello QJ Wang,

    Thanks for your reply. I have tried everything as per your instruction. But the problem is not resolved. I have purchased a new board to continue my work. One last thing I want to ask is what may be the reason for this error (The first screenshot). So far I have read many TI forums and I have come to conclusion that the bootloader may get corrupted. Am I right? Or is there any other reason?

    Thanks and Regards,

    Saurabh Shah,

    CoEP 

  • Hello,

    How is the code running on your new launchpad?
  • Hello QJ,

    The code is running perfectly. Please tell me the reason of that error. Is it software or hardware problem?

    Thanks and regards,

    Saurabh Shah,

    CoEP