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.

Debugging F021 Flash API - IAR Crashes - Is This A Known Issue?

Hello All,

First question - F021 API is circa 2014 - will that be updated soon?  IAR for one seems to be changing their linker every release.

Second question - when running the IAR debugger - the F021 API will crash the debugger when the following is being executed:

status=Fapi_initializeFlashBanks(Freq_In_MHz); /* used for API Rev2.01 */

Is that a known issue? 

The app I am running is fine when running standalone but will crash if I try to run in the debugger once the above is executed.

In this instance I am running out of Bank 0 and writing to Bank 1.

Thanks,
johnw

  • status =  Flash_Erase_Check((uint32_t)eraseStartAddr0, Size_In_Bytes);

    =>

    Here's an update - it crashes here (bl_flash.c)
    uint32_t Flash_Erase_Check(uint32_t Start_Address, uint32_t Bytes)
    {
    uint32_t error=0;
    register uint32_t *dst1 = (uint32_t *) Start_Address;
    register uint32_t bytes = Bytes;

    while(bytes > 0)
    {
    if(*dst1++ != 0xFFFFFFFF){ <<<=== debugger will crash on first execution of this.
    error = 2;
    }
    bytes -= 0x4;
    }

  • Hi John,
    Don't think I've seen this before. What do you mean by debugger crashing? It actually exits or it throws a fatal error and disconnects?
    Or the code itself jumps into an exception?
    Maybe you can try the CCS debugger if you have it - as a sanity check. It can debug any ARM / ELF doesn't need to be one generated with the TI ARM compiler.
    I wonder if some scripting or memory window update is going on in the background here and causing a problem....
    -Anthony
  • Anthony,

    Code seems to throw an exception but this is apparently caused by a memory window being open - has to do with running out of Bank 0 and then accessing Bank 1 in the memory window - but all of the Flash registers should be correct. If I disable run to main in the debugger then I can see what is in Bank 1 OK at the beginning - after I start running I can only see the memory in bank 0.

    Regards,
    John W.
  • Hi John,

    Ok I am not sure I understand - but good news is we've got Bob on forum this week and he's pretty much a flash expert.

    I think you're saying that if you have a memory window open on the bank that is being programmed, while you are debugging the API code then the code takes an exception? But if you don't view the flash bank being programmed all is good? If so this probably is explainable.

    The IDE itself never crashes though - correct?

    Best Regards,
    Anthony
  • Anthony,

    Yes - basically that is correct. I have talked about this to IAR in the past - but my notes about this are incomplete and was hoping someone had seen this here. I will talk again with IAR tomorrow - but yes, I am sure this is explainable.

    The code seems to run fine outside of the debugger also - I am working on the CAN Bootloader for the '3137PGE under IAR. Since the linker doesn't seem to understand how to load and run that from RAM - I am running from Bank0 and writing to Bank1 using IAR.

    Thanks,
    John W.
  • If the debugger tries to read from the flash bank that is being programmed or erased, the read access will be stalled until the program or erase operation has completed. I don't know what the IAR debugger does in this case. If it does a timeout, that may explain the behavior you are seeing. 

  • Hello Bob,

    Yes - this could be what is happening. I am waiting to hear back from IAR now.

    Thanks,
    John W.
  • Bob,

    Are you the FLASH guy? Just wondering - will there be an F021 API update soon?
    Also - have you been able to get the F021 API to execute out of RAM using the IAR compiler?

    Thanks,
    John W.
  • I am one of several "Flash" guys, but more hardware than software. I am not aware of any near term release, but I suggest you go to the F021 API software folder (link), and select "ALERT ME" if you have not already done so. This way you will be sent an e-mail when updated software is released. I personally have never used the IAR compiler.

  • Bob,

    OK - just making sure you are the person Anthony was mentioning above.
    Yes - I have had an ALERT ME set there previously.
    The issue with getting the F021 API to run out of RAM w/IAR is interesting - but since I was getting no where fast I decided to run that out of Bank0 and use Bank1 as the APP - which works out fine in this case.

    Thanks,
    John W.