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.

Using F05aFlashAPI_V.36 for SM470R1B1M with IAR Embedded Workbench 6.3

Other Parts Discussed in Thread: TMS470R1A384, TMS470R1B1M, SM470R1B1M-HT

Hi,

I am using the SM470R1B1M with IAR Embedded Workbench 6.3.

I would like to use the FlashAPI functions to write Data (e.g. Product serial number, data for calibration.....) to the flash of the device. I downloaded the Flash API from the SM470R1B1M page and installed it. I got the headers f05.h, fapiver.h, flash470.h and Flash470ErrorDefines.h. There is also a file called f05a.r79. I added the headers to my project, but what I have to do with the file f05a.r79? I have already tried to add it to the additional libraries in the linker options, but it seems as if this is not the correct way. There is the following linker error: "Fatal Error[Li004]: file "C:\Program Files (x86)\Texas Instruments\F05aFlashAPI_V.36\f05a v.36\f05a.r79" is not an object or archive file".

So what steps are to do, to be able to use the API?

 

Best regards

Christoph 

  • Christoph,

    I have been working with the team that provided the flash api's to me several years ago.  Unfortunately there are issues at this moment to verify them.

    I can attempt to resolve if you can provide me with your project that is attempting to link in the elf API. 

    You can email it to me at w a d e v b (at) t i . c o m  and I will see what I can do to help.

    Regards,

    Wade

  • Wade,

    Yesterday I tried to mail you an IAR project in which I tried to use the API. I just want to play safe,  because of our IT-security. So, did you receive the mail?

    Regards,

    Christoph

  • Christopher, i did receive your email, but I am out of the office for the week. I will try to look at it early next week thanks

    Regards,

    Wade 

  • Hello! Christoph,

    whether your problem is solved? i too experiencing the same problem but in my case i am getting

    Fatal Error[Li004]: file "C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\examples\ST\STM32F0xx_StdPeriph_Lib_V1.0.0\Project\
    STM32F0xx_StdPeriph_Templates\EWARM\STM320518-EVAL\Obj\main.o" is not an object or archive file

    if you get to know the reason please let me know.

    Regards,

    Manjunatha

  • Hi Manjunatha,

    my problem is not solved already. I will let you know if there is a solution.

    Regards,

    Christoph

  • Hello! christoph,

    In my case the problem has been solved. i made the following changes in my project settings.

    Project options---> General Options---> Library Configurations(in this Select Use CMSIS)

    Regards,

    Manjunatha S

  • Hello All,

    I too am stuck -- have a product in production for several years now, using TMS470R1A384, and F05 Flash libraries.  Now have upgraded IAR from 4.41 to 6.6 and have same problem in that the .r79 libraries for F05 will not link -- are not recognized by the linker.  The problem is identified in this older post in another forum:

    http://e2e.ti.com/support/microcontrollers/hercules/f/312/t/130138.aspx?pi24527=1  that is titled "f05 Flash TMS470R1B1M API help".  Unfortunately the F05 libraries are in wrong format, need to be UBROF for newer IAR (since 5.x).  BUT they are not available since TI says part is not for new design.

    I believe the only way out of this is if TI will supply the source code for the libraries so that they can be compiled as part of your project.  I need help on this too, as I have exceeded the code size limit of my IAR 4.41 tools and had to now go to 6.6 to fix this.  Please let us all know what we're supposed to do!!!!

    Doug

  • Correction:  the F05 libraries in .r79 files are UBROF, now need to be ELF

  • Replied via email for possible solution.

    Regards,

    Wade

  • Hi Wade,

    I am facing the same problem too and need to be able to use the Flash APIs in my firmware.

    Could you please provide me the solution for the same.

    Thanks,

    Vinod

  • Provided.

    Regards,

    Wade

  • Hi!

    Our team is using the gcc tools so the IAR tool is no option for us. Is the workaround still possible for our use. Of course we are also very keen on obtaining an ELF version (or perhaps a converter from UBROF to ELF)

    Regards

  • Are there any news on this ? We still need it!

  • We are working on it.  The software update is complete and we are testing out the solution this week.

  • Ajandra, could you please e-mail me to j-vallemayorga@ti.com so that I can send you the solution to the API problem.

    Thanks,

    JV

  • Hi,

    I have one more question. What do I have to do to execute the api functions out of RAM (i.e. in case of a firmware update)? Do I have to edit the linker configuration file? I'm still using IAR Embedded Workbench 6.3.

     

    Here is my current linker file:

     

    /*###ICF### Section handled by ICF editor, don't touch! ****/

    /*-Editor annotation file-*/

    /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */

    /*-Specials-*/

    define symbol __ICFEDIT_intvec_start__ = 0x00000000;

    /*-Memory Regions-*/

    define symbol __ICFEDIT_region_DEVICEINFO_start__ = 0x00000080;

    define symbol __ICFEDIT_region_DEVICEINFO_end__   = 0x000000FF;

    define symbol __ICFEDIT_region_ROM_start__        = 0x00000100;

    define symbol __ICFEDIT_region_ROM_end__          = 0x000FFFFF;

    define symbol __ICFEDIT_region_RAM_start__        = 0x00400000;

    define symbol __ICFEDIT_region_RAM_end__          = 0x0040FFFF;

    /*-Sizes-*/

    define symbol __ICFEDIT_size_cstack__   = 0x400;

    define symbol __ICFEDIT_size_svcstack__ = 0x400; /*40*/

    define symbol __ICFEDIT_size_irqstack__ = 0x400; /*100*/

    define symbol __ICFEDIT_size_fiqstack__ = 0x400; /*100*/

    define symbol __ICFEDIT_size_undstack__ = 0x0;

    define symbol __ICFEDIT_size_abtstack__ = 0x0;

    define symbol __ICFEDIT_size_heap__     = 0x100; /*1000*/

    define symbol __ICFEDIT_size_libcode__  = 0x800;

    /**** End of ICF editor section. ###ICF###*/

     

    define symbol __FlashKeyStartAddr__ = 0x0000FFE0;

    define symbol __FlashKeyEnd_Addr__  = 0x0000FFFF;

    define memory mem with size = 4G;

    define region DEVICEINFO_region = mem:[from __ICFEDIT_region_DEVICEINFO_start__ to __ICFEDIT_region_DEVICEINFO_end__];

    define region ROM_region   = mem:[from  __ICFEDIT_region_ROM_start__   to (__FlashKeyStartAddr__-1)] |

                                 mem:[from (__FlashKeyEnd_Addr__+1)         to __ICFEDIT_region_ROM_end__];

    define region RAM_region   = mem:[from  __ICFEDIT_region_RAM_start__   to __ICFEDIT_region_RAM_end__];

    define block CSTACK    with alignment = 8, size = __ICFEDIT_size_cstack__   { };

    define block SVC_STACK with alignment = 8, size = __ICFEDIT_size_svcstack__ { };

    define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { };

    define block FIQ_STACK with alignment = 8, size = __ICFEDIT_size_fiqstack__ { };

    define block UND_STACK with alignment = 8, size = __ICFEDIT_size_undstack__ { };

    define block ABT_STACK with alignment = 8, size = __ICFEDIT_size_abtstack__ { };

    define block HEAP      with alignment = 8, size = __ICFEDIT_size_heap__     { };

    define block DEVICEINFO{ ro section .device_info };

    initialize by copy { readwrite };

    do not initialize  { section .noinit };

    place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };

    place in DEVICEINFO_region { first block DEVICEINFO };

    place in ROM_region   { readonly};

    place in RAM_region   { readwrite,

                            block CSTACK, block SVC_STACK, block IRQ_STACK, block FIQ_STACK,

                            block UND_STACK, block ABT_STACK, block HEAP };

     

    Regards,

    Christoph

  • Please see the newly releases API for question 1.

    http://www.ti.com/product/sm470r1b1m-ht

    For second question, you will not be able to overwrite code that is being executed.

    Unfortunately I do not have representative code tor field firmware update.

    Regards,

    Wade

  • Hi Wade,

    I have been working through the updated F05 implementation, and am using IAR ARM V7.10 to compile my project that was originally done under V4.42.  So this is mature source code, and we have had it in production for several years.  I've been trying to implement the updated F05 library and have a new problem:  it appears that the "F05a.a" library was built using a code-size limited IAR tool, limited to 32K.  My product has a program that exceeds 200K, so we build with full IAR tools.  However, with the updated F05a.a library, now the program won't link, puts out [Li016] error and says codesize exceeds 32K.  IAR tells me (and we have confirmed) that my project is "inheriting" the codesize limitation from your F05a.a library, and that trips up the linker.

    I need either the F05 source (as was mentioned earlier in this thread), or the library recompiled on full IAR tools -- what can we do?

  • Doug,

    We are working on getting a version compiled.

    Need to get oldest ELF toolset installed for backward compatibility.

    I will send you message with more information.

    Regards,

    Wade

  • Hello everyone, 

    I use SM470R1B1M and IAR's Embedded Workbench version 7.30.4. 

    My application needs to store some data into internal flash memory.

    First I have modified SM470R1B1m.lcf. I reduce ROM size by 1 section (64KB). I make internal flash memory bank 1 section 7 as data memory. 

    Second I use f05a.a library and FlashSM470R1B1M.c wrapping API function. Everything seems work fine. However when I look at data section, I have found that there are a few bytes of data have errors. The error data doesn't locate at same address every time. If I do a few test, I have found the error data appears in different addresses. That means there is no bad flash memory element. I have contacted IAR. According to IAR's reply, it seems the interrupts in my application program caused the problem. So I have done a few tests to erase/write/read the top flash memory section at very beginning of my program, before any peripherals are initialized. Only in this situation there is no error data. 

    If flash memory access is after peripherals initialization, but call __disable_interrupt() and/or set REQMASK = 0x0 before access internal flash memory,  I still see error data.

    Why? Am I missing something? Anybody has faced this issue? 

    Thanks in advance!

    Lisa

  • Lisa,

    I am not aware of this type of problem occurring prior.

    I will check with some other experts and see if they have any ideas.

    Regards,

    Wade

  • Hi Wade,

    Thank you for help! I really appreciate your quick response. 

    Lisa

  • Hi Wade,

    According to "IAR C/C++ Development Guide Compiling and Linking", this intrinsic function can only be used in privileged mode. That means in order to disabling global interrupt, the program has to change to privileged mode first. 

    Have you got any feedback from expert yet?

    The whole purpose is to use one sector of internal flash memory f05a for calibration data. 

    Thank you!

    Lisa

  • I did get feedback that interrupts must be disabled.
    Regards,
    Wade
  • Hi Wade,

    Thank you!

    Yes, I know that interrupts should be disabled. However my current problem is that calling __disable_interrupt() at user mode would not solve the problem. It seems I have to change to system mode. Is there a safe way to change to system mode?

    Lisa
  • Hi Everyone,

    This issue has been solved. I have contacted IAR's technical support. I have been informed that this internal flash memory driver doesn't work when GCR is assigned with ZPLL_CLK_DIV_PRE_1 (SYSCLK = 8 X Fosc). If I assign GCR to ZPLL_CLK_DIV_PRE_2 (SYSCLK = 4 * Fosc), it works fine. That means the internal flash memory driver doesn't work at 60 Mhz, but it will work at 30 Mhz if oscillator is 7.5 Mhz. 

    Lisa

  • Hi all,

    I am trying to store calibration values to internal flash. I have added all the required files as mentioned in API but when i run my application my IDE is strucking in Flash_Prog_B. Is it possible for to provide simple example on how to use this API.

    Regards,

    Pavan.

  • Hi Pavan,

    1. You should change link command file SM470R1B1M.icf or your own link command file if you don't use SM470R1B1M.icf. The original ROM started at 0x00000080 and end at 0x000FFFF. If you want the very top sector for your data storage, then you should change ROM range to be 0x00000080 to 0x000EFFFF. That will prevent compiler to generate code in that range. Now your data storage range become 0x000F0000 to 0x000FFFFF. 

    2. I use function uint32_t FlashWrite() from driver wrapper file FlashSM470R1B1M.c, the function calling is like this:

     Ret = FlashWrite((unsigned int*)INT_FLASH_BK_SEC7, OffStartAddr, LenInByte, pBufAddr)

    Note the #define INT_FLASH_BK_SEC7 is defined by you which equals to 0x000F0000. OffStartAddr is the off starting address of the top sector. LenInByte is    the byte number you want to write. pBufAddr is the buffer pointer for you target data buffer. 

    I hope this will help you. Good luck!

    Lisa

                                           

  • Lisa, thanks for the input!
    Regards,
    Wade
  • Hi Lisa,

    Thanks for your explanation and help.

    I am trying as per your suggestion but i am missing some header files. When i tried to use driver wrapper file  FlashSM470R1B1M.c. I am geting error like

    "Fatal Error[Pe1696]: cannot open source file "flash_loader.h" .

    I can see one more header file error "flash_loader_extra.h".

    I didn't find these files in IAR system\arm\src\flashloader\texasinstruments\sm470r1b1m. ANy suggestions?

    Regards,

    Pavan.

  • Hi Pavan,

    Both flash_loader.h and flash_loader_extra.h locate at ...\Embedded Workbench 7.0\arm\src\flashloader\framework2. 

    I hope you can build use this driver now. 

    Good luck!

    Lisa

  • Hi Lisa,

    Thanks for pointing me to the header files. I was able to write.

    I have one moredoubt which function you used to read from the flash address. I didn't see any read function in wrapper driver file.? 

    Regards,

    Pavan.

  • Hi Pavan,

    There is no read function API. You can read the internal flash memory as RAM data read. Specify the sector, off start address, data length and your read buffer. 

    Good luck!

    Lisa

  • Hi, 

    I am working on developing a bootloader for TMS470R1B1m. I looked at the forums and understand that I will need a Flash Library to write to Flash memory. Could you please provide the library and the steps involved in this process? 

    Thanks in advance. 

    Pinakin

      

  • Hello all,

    I am trying to save some values to SM470R1B1M internal falsh. I am using IAR compiler and fallowed the steps mentioned in this post. 

    I am successfully able to write and read as well.

    I have a problem with rewriting. If i rewrite into the same address location then the new data is not writing?

    Do I need to erase to rewrite into same address location? 

    I have erased and re write into same address location using erase function from  FlashSM470R1B1M.c file. i am able to erase previous data but  i am not able to write last address.

    for ex: if i write 0x000f0001, 0x000f0002, 0x000f0004 and 0x000f0006 locations then when i erase and re write into same locations then it is not re writing into 0x000f0006 location but remaining three locations it was updating. In th final location it was showing 00 the data.

    first write 05, 06, 07, 08

    After erase and rewrite 01, 02, 03, 04.

    Can anyone suggest me how to rewrite to same location without error? or Do I need to erase to rewrite ?

    Thanks,

    veeru.

  • Veeru,
    Flash technology requires an erase to the sector or segment that is being written to.
    An erased flash is all 1's. Writing to device can only program a 1 to a 0.
    Attempting to program a 0 to a 1 will not work, and should generate an invalid data error.

    I am not sure I follow if you have another issue beyond needing to erase prior to re-writing.
    If you still have an issue please post to a new thread, as it can be easily lost when it is tacked on the end of a closed post.
    Regards,
    Wade