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.

Need help on finding flash api source code for F28069 (i.e. Flash2806x_API_V100.lib)

Other Parts Discussed in Thread: CONTROLSUITE

I am turning on the CSM for a project using the F28069 Piccolo and I need to put the flash API into secure SARAM to run. The problem is I could not find the source code (i.e. Flash2806x_API_V100.lib) to use. I had done this before successfully with the F28027 using the file Flash2802x_API_V201.lib available in controlSUITE, but for some reason this file is missing for the F28069.

Without turning on the CSM I was using 2806x_BootROM_API_TABLE_Symbols_fpu32.lib with no problem.

My CCS version is 5.4.

Thanks in advance,

Erik

  • Erik,

    The API libraries are in ControlSuite.  I don't know why you don't see the F2806x stuff there.  Maybe try uninstalling ControlSuite and re-installing.

     

    Or are you saying you want the actual source files for the library?  Those are not available in ControlSuite, and have never been for any C28x device.  They are not generally provided to users.  You do not need the source code in order to copy the flash APIs from flash and run them in RAM.

    Regards,

    David

  • Thanks David,

    I can see all the files you show here, but if I understand if correctly they are only "symbol" maps and not the ones I am looking for. If you read the reply from Trey in this link you'll know what I am talking about, unless I am confused it with something else.

    http://e2e.ti.com/support/microcontrollers/c2000/f/171/t/170158.aspx

    Regards,

    Erik

  • Erik,

    I read the thread you cited, and see what is happening.  Your understanding is correct, and it isn't making sense to me why the .lib for F2806x is not available.  I will ping the factory team about this and try to find out what the problem is.

    - David

  • Thanks again David! We need it pretty soon to incorporate it into the code for testing, so please let me know what you find.

    You might also want to ask them to update the F28069 pdf doc file in the section "Step 3: Include the proper Flash API libraries" if they decide to include this file in the next release, just to be consistent with other F28x devices.

    Erik

  • Erik,

    It was an oversight that the API .lib file was not included in ControlSuite for F2806x.  It should have been.  Instead the compiler RTS libraries were put in that folder.  This will get corrected in ControlSuite moving forward.  We've always made the .lib available for C2000 devices.  It is the API source code itself that is not readily distributed (really for support reasons, not because of anything proprietary).

    I will be able to get you a patch that puts the .lib file into the ControlSuite F2806x folder.  I should have the patch tomorrow.  I will post to this forum thread.

    Regards,

    David

  • Erik,

    Attached to this post is an installer that will stick the F2806x flash API v100 .lib file on your PC.  By default, the .lib file will be put into the C:\TI\controlSUITE\libs\utilities\flash_api\2806x\v100\lib folder.

    ControlSuite will get updated eventually to provide this file.  As I mentioned before, it was an oversight that this file is missing from ControlSuite.

    Regards and Good Luck,

    David

    Flash2806x_API_fpu32_V100_Installer.zip
  • Hi David,

    This works like a charm!

    I have a couple related questions. I am trying to use one sector of flash for system configuration and only need the erase and save to flash features. Do I need to put all the APIs in RAM (entire lib file is about 1.3k in size)? If I can pick and choose only what is needed to put in RAM I can save some RAM space, correct?.

    Also just to confirm the smallest flash size I need to this is a SECTOR (0x004000 in size?), right? Again I am using the F28069 part.

    Thanks for your help,

    Erik

  • Erik,

    Only the functions you need should be pulled in from the library in the first place (that is what makes a library a library, as opposed to a collection of source files that will always get put into the .out file whether you used the source or not).  So, whatever is pulled in you are using and you need to copy.  I'm not sure what you mean by "erase and save to flash features".  The APIs you should be using are ERASE, PROGRAM, and probably VERIFY.

    A flash sector is the smallest block that you can erase.  On the F28069, the sectors are all 16Kx16 (or 32KB if you prefer to look at it in bytes).  Yes, you are correct that is 0x4000 words in size, as you indicated in your post.  You should put the APIs in sector A, along with your secondary bootloader (i.e., the driver kernel for the APIs).  That way if something goes wrong during re-flashing (e.g., power loss), you can reboot and try again.

    Regards,

    David

  • It is simple to put the entire .lib file to FLASH/RAM, but I've been looking for an example to put just a few APIs of a .lib file (i.e. ERASE, PROGRAM, VERIFY) to FLASH/RAM. Do you have a template that I can use as an example? Or point me to a relevant thread?

    Btw, by "ERASE, PROGRAM, VERIFY", you meant these below functions within the Flash2806x_API_fpu32_V100.lib file, right?

    Fl2806x_EraseSector

    Fl28x_EraseVerify

    Flash2806x_Program

    Fl28x_ProgVerify

    Just for reference, these are all the functions in the lib file:

    Flash2806x_Program     
    Flash28_API_RunStart   
    Flash2806x_Erase       
    Fl28x_EraseVerify      
    Fl28x_ErasePulse       
    Fl28x_LeaveCmdMode     
    Fl28x_EnterCmdMode     
    Fl28x_FlashRegSleep    
    Fl28x_OpenPulse        
    Fl28x_ClosePulse       
    Fl28x_MaskAll          
    Fl28x_ProgVerify       
    Fl28x_ProgPulse        
    Fl28x_CompactVerify    
    Fl28x_CompactPulse     
    Fl2806x_EraseSector    
    Fl2806x_CompactSector  
    Fl28x_ClearLoop        
    Fl2806x_ClearSector    
    Fl2806x_Init           
    Fl28x_WatchDogDisable  
    Fl28x_DisableNMI       
    Fl28x_Delay            
    Fl28x_DisableInt       
    Fl28x_RestoreInt       

  • Erik,

    I don't think you're following what I said about libraries.  Libraries are a collection of .obj files.  Let's call the .obj file an object module.  When you call a function in the library, the entire object module from the library is brought into the code build.  An object module may have one or more actual functions in it.  For a library, you typically want each object module to contain only one function.  That way, when you call that function you get ONLY that function (and not other functions in the object that you're not using).  One way to get one function per object module is to put each function in its own source file.

    Assuming the flash API library was built correctly (and I think that it was), when you call an API function you are only getting the code needed for that API (i.e., the top-level API function you call, and any lower-level functions that the function calls from the library).

    This graphic shows the object modules contained in the F2806x flash API library V100:

    And here is a list of the top-level APIs functions that the user can call, from the F2806x flash API documentation:

    You can see there are only 6 functions you can call (either the portable generic version name, or the device specific version name - it doesn't matter).  The functions a user typically calls are Flash_Erase, Flash_Program, and Flash_Verify (or the device specific versions of these, again they're the same thing).  Calling the erase or program API will pull in a bunch of lower level functions that the API needs and call.  You cannot do anything about this.

    So, if you copy to RAM all the sections from the library that are included in your .out file, that's the best you can do.  There are no extra functions you don't need.  You must copy it all.

    Regards,

    David

  • Thanks for the clear explanation. I certainly did not get it from your previous message, and my inclination was towards your latest comment. It is a bit disappointing though that it would take 1.3k of flash and especially ram space to do the flash programing alone. This means that we might have a hard time moving to a cheaper part later on, if we decide to do so.

    Regards,

    Erik

  • Your patch installs the FPU version of the library.....do you have the same available to install a non-FPU version of the library?

    I note that a year after your original post, ControlSuite still hasn't been updated to include these files.

  • One other question: I'm trying to use the Flash API to update the firmware in a Secured chip...while this cannot be done while executing from ROM, can I copy the code in ROM into a secure area of SRAM and execute it there? Does a version of the BootROM Symbols library exist that provides those same symbols for a copy in SRAM?

    Thanks.
  • Tom Goltz said:
    I note that a year after your original post, ControlSuite still hasn't been updated to include these files.

    Tom,

    I'd like to apologize for this.  Unfortunately we dropped the ball once again.  I will personally make sure this doesn't happen again and the files are included in an upcoming release.

    Tom Goltz said:
    Your patch installs the FPU version of the library.....do you have the same available to install a non-FPU version of the library?

    I'd like to understand the need for the non-FPU version.  Our original plan had been to only release the FPU version for this device since all part numbers have the FPU on them.   

    I will need a day or so to retrieve the non-FPU version from archives.

    Thank you

    Lori

  • Unfortunately no. The API in the ROM is not relocatable.
  • I'm looking for a non-FPU library because I need to shoehorn the flash code into a bootloader and I don't really have space for the FPU code. At the same time, I can't use the Flash API code in ROM because I have the CSM active, and the ROM isn't secure memory.
  • Tom,

    The API code is the same whether you have the compiler support setup for fpu32 or not. The API code does NOT use floating pt. The only reason you'd need the non-FPU32 built API library is if your CCS project was, for some reason, being built without the -fpu32 compiler option (compiled code built with the -fpu32 option will not link with non-fpu32 built code as the function parameter passing conventions are different for floating point arguments). Frankly, there really isn't a reason to be building code without the -fpu32 option on F2806x devices. All of them have the FPU. If you don't use any floating pt. values, the code will be the same as without the -fpu32 option.

    It is sounding like you can use the floating pt. API library, yes?

    - David
  • On this part, I could.  However, this bootloader code is shared between two projects, one running a fixed-point processor, the other the F28069.  If I don't use the FPU, I can run the same code on both.  Trying to rebuild the project with FPU32 enabled is causing breakage which I haven't been able to track down yet.

    It would definitely be helpful to have a copy of the flash API library built without the FPU support enabled.

  • Tom Goltz said:
    It would definitely be helpful to have a copy of the flash API library built without the FPU support enabled.

    Tom,

    My team is working on this and will report back on progress within the week.   Yours the first request that I know of for the non-fpu version.

    Lori 

  • Edited - We forgot to add the license agreement.  Will repost.

  • I got the library today, and it's working well.  I did see the following warnings when I linked against it:

    "../2806x_v136/Flash2806x_API_V100.lib<Flash28_Erase.obj>": compatibility
    cannot be determined
    warning #16002-D: build attribute vendor section TI missing in
    "../2806x_v136/Flash2806x_API_V100.lib<Flash28_ClearSector.obj>":
    compatibility cannot be determined
    warning #16002-D: build attribute vendor section TI missing in
    "../2806x_v136/Flash2806x_API_V100.lib<Flash28_CompactSector.obj>":
    compatibility cannot be determined
    warning #16002-D: build attribute vendor section TI missing in
    "../2806x_v136/Flash2806x_API_V100.lib<Flash28_EraseSector.obj>":
    compatibility cannot be determined
    warning #16002-D: build attribute vendor section TI missing in
    "../2806x_v136/Flash2806x_API_V100.lib<Flash28_Init.obj>": compatibility
    cannot be determined
    warning #16002-D: build attribute vendor section TI missing in
    "../2806x_v136/Flash2806x_API_V100.lib<Flash28_ClearLoop.obj>":
    compatibility cannot be determined
    warning #16002-D: build attribute vendor section TI missing in
    "../2806x_v136/Flash2806x_API_V100.lib<Flash28_Internals.obj>":
    compatibility cannot be determined
    warning #16002-D: build attribute vendor section TI missing in
    "../2806x_v136/Flash2806x_API_V100.lib<Flash28_Compact_Pulse.obj>":
    compatibility cannot be determined
    warning #16002-D: build attribute vendor section TI missing in
    "../2806x_v136/Flash2806x_API_V100.lib<Flash28_Delay.obj>": compatibility
    cannot be determined
    warning #16002-D: build attribute vendor section TI missing in
    "../2806x_v136/Flash2806x_API_V100.lib<Flash28_DisInt.obj>": compatibility
    cannot be determined
    warning #16002-D: build attribute vendor section TI missing in
    "../2806x_v136/Flash2806x_API_V100.lib<Flash28_Utils.obj>": compatibility
    cannot be determined
    warning #16002-D: build attribute vendor section TI missing in
    "../2806x_v136/Flash2806x_API_V100.lib<Flash28_Erase_Pulse.obj>":
    compatibility cannot be determined
    warning #16002-D: build attribute vendor section TI missing in
    "../2806x_v136/Flash2806x_API_V100.lib<Flash28_Prog_Pulse.obj>":
    compatibility cannot be determined
    warning #16002-D: build attribute vendor section TI missing in
    "../2806x_v136/Flash2806x_API_V100.lib<Flash28_Prog.obj>": compatibility
    cannot be determined

    It still works - the linker is just a little unhappy with it.

    Thank you for your help!

  • Here is an installer to include Flash2806x_API_V100.lib in controlSUITE.

    controlSUITE_FlashAPI_Lib_v100_setup.zip

    Best Regards,

    sal

  • Ignore these warning!

    The Flash API library was build using older code gen tools than the ones you are using as of now.

    Regards,
    Manoj

  • UPDATE: Message edited because I hadn't seen all the replies!

    Hi,

    I got a bit confused regarding the best way to include all the required FlashAPI functions in Flash and then copy them to RAM. Is there a better / more space-efficient way than including all the .lib file via the linker command file? If yes, can you please provide more information on how to do this? i.e. how can we make sure that all FlashAPI functions used by our code (either by direct calls of the 6 functions you list or indirectly by lower-level calls inside FlashAPI)?

    If I put the 6 user-callable FlashAPI functions in the .ramfuncs section will this be enough? I suspect that this may leave lower-level / internal FlashAPI functions in Flash.

    Also, I am using the 2806xRevB_BootROM_API_TABLE_Symbols.lib symbol library in my project which already includes ROM symbols for the 6 user-callable FlashAPI functions. I suppose that I will have to set the F2806x flash API v100 .lib higher in the link order to give it priority over the ROM functions, right?

    Thank you in advance,

    Giannis

  • When you include the .lib and compile and link, the linker will only include functions, code or data that is being used in theexecutable. It will not retain all symbols. So it will optimize the memory usage.

    You should put the Flash API functions you are calling in RAM and you should also make sure to call those functions from a RAM location.

    Yes. those need to be higher in the link order.

    sal
  • Still confused, since, as you say, that the linker will automatically include only the required functions, how will I know which functions to put in RAM?
    e.g. I can put Flash_Erase() in .ramfuncs, but this probably calls other Flash_xxx() functions which also need to be put in RAM.
    If I instruct the linker to put the Flash API .lib file in Flash and run it from RAM as in the ControlSuite example will this cause the complete Flash API .lib to be included in Flash or just the functions that are directly or indirectly called?
  • Why are you trying to include both 2806x_BootROM_API_TABLE_Symbols.lib and Flash2806x_API_V100.lib?


    You need to be including either bootrom library (or) Flash API software library. Including both the library files will be redundant.

  • When using BOOTROM symbols, you need to include functions which calls flash api functions into ramfuncs. You don't need to copy of other flash api internal functions

    For example, Flash_Erase() function cannot be called from Flash. So, you need to call Flash_Erase() function from RAM. Once called, Flash_Erase algorithm stored in ROM will start executing. It isn't run from RAM.
  • You are correct, 2806x_BootROM_API_TABLE_Symbols.lib i not needed, my mistake.

    However, when I was still using the ROM FlashAPI functions I was calling them from functions in Flash and did not have any problems.

    Anyway, is there a way to include only the required FlashAPI functions/objects from Flash2806x_API_V100.lib in the flash sections that is then copied to RAM during runtime?

  • Is this resolved? Can I close ticket?
  • Giannis,

    Yes, it is very much possible to include only Flash API functions / objects from flash api library file.

    In your application program, if you decide to use Flash_Erase function. Then the functions relevant to Flash_Erase function will be included in COFF file.

    Regards,
    Manoj