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.

TMS570LS3137: F021 v02.01.01 API causes prefetch abort

Part Number: TMS570LS3137

Hello,

I am using TI's F021 API for erasing and writing to both bank 0 and bank 1.

The entire F021 API runs in RAM as well as my code calling it. The rest of my code runs in bank 0.

Erasing/Writing bank 1 works perfectly but when erasing/writing bank 0 I quite consistently (about 9 / 10 times) get a very confusing prefetch abort.

For details see: https://community.arm.com/developer/ip-products/processors/f/cortex-r-forum/44736/atcm-ecc-error-causes-prefetch-abort-despite-ecc-check-being-disabled 

Two questions:

  1. Am I using the API incorrectly / Do I need to move more stuff into RAM?
  2. Where can I find more information on the FSM registers? The TRM (http://www.ti.com/lit/ug/spnu499c/spnu499c.pdf) only references two of them (FSM_WR_ENA, FSM_SECTOR) making it impossible for me to implement my own flash routines.

  • Hello,

    Please, take a look at this thread:

    e2e.ti.com/.../452343

  • Thank you,

    I have already relocated the API code as well as the calling code into RAM and am executing from there as described in that thread. I would like to take a look at "the bootloader" mentioned by QJ Wang in their reply. Any idea how I can get my hands on "the bootloader"'s source code?

    Regards,

    Lukas

  • Hello Lukas,

    You can download  bootloaders and more example code from here:

  • Lukas,

    Please take a look at this E2E:

    https://e2e.ti.com/support/microcontrollers/hercules/f/312/p/849928/3150652#3150652

    To download the Hercules_examples including bootloaders:

    Ubuntu user: with git, git clone git://git.ti.com/hercules_examples/hercules_examples.git

    Windows user: download one of the compressed file formats under the commit page.

    In  your case, the example project which can be imported to CCS is here:

    \hercules_examples\Bootloaders\SafetyMCU_Bootloaders\TMS570LS31x

    Take a look at bl_link.cmd file, please note not to forget about the const section when you move Flash API from Flash to RAM:

      flashAPI:
       {
         .\F021_Flash_API\02.01.01\source\Fapi_UserDefinedFunctions.obj (.text)
         .\source\bl_flash.obj (.text)
         //.\source\bl_dcan.obj (.text)
         --library= ..\..\..\F021_Flash_API\02.01.01\F021_API_CortexR4_BE.lib (.text)
       } palign=8 load = FLASH0, run = SRAM, LOAD_START(apiLoadStart), RUN_START(apiRunStart), SIZE(apiLoadSize)

       .text  : {} > FLASH0 /*Initialized executable code and constants*/
       .const : {} load=FLASH0, run = SRAM, LOAD_START(constLoadStart), RUN_START(constRunStart), SIZE(constLoadSize)

    Please note bl_flash.c which is under SafetyMCU_Bootloaders\source folder, that is calling Flash APIs. So in your case, make sure all source code calling Flash APIs be included in this load & run structure, i.e., within flashAPI{} in command file.

    Also please take a  look at :

    \hercules_examples\Bootloaders\SafetyMCU_Bootloaders\source\bl_main.c. Make sure you copy both sections as well:


        /* Copy the flash APIs to SRAM*/
        //_copyAPI2RAM_(&apiLoadStart, &apiRunStart, &apiLoadSize);
        memcpy(&apiRunStart, &apiLoadStart, (uint32)&apiLoadSize);

        /* Copy the .const section */
        //_copyAPI2RAM_(&constLoadStart, &constRunStart, &constLoadSize);
        memcpy(&constRunStart, &constLoadStart, (uint32)&constLoadSize);

    Hopefully this helps.

    best regards,

    David Zhou

  • Hello,

    Thank you for the detailed answer.

    After comparing with the example bootloader and some more expermentation it seems that the issue is caused by another library we use.

    Best regards,

    Lukas