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.

TMS320F28069M: using same flash as program is running in

Part Number: TMS320F28069M
Other Parts Discussed in Thread: C2000WARE

Hi folks,

I'm working on a project with the LaunchPadXL (Ver:1.2)

My goal is to run the program from flash but use one sector of the flash to store user settings in it.

If i run the program in debug mode on the ram, it works perfectly. Every time i tried to run it from flash memory, as soon as i call one of the flash api function (erase and write)  the program jumps to a location outside of program code (0x3ff4fa).

What i'm doing so far:

added

Flash28_API:
		{
			-lFlash2806x_API_wFPU_Library.lib(.econst)
			-lFlash2806x_API_wFPU_Library.lib(.text)
		} LOAD = FLASHD,
		RUN = RAML0,
		LOAD_START(_Flash28_API_LoadStart),
		LOAD_SIZE(_Flash28_API_LoadSize),
		RUN_START(_Flash28_API_RunStart),
		PAGE = 0

to command file

used 

#pragma CODE_SECTION(init_flash, "ramfuncs");

to run this functions from ram (init_flash for delay_us, which works fine)

I did NOT lock the csm, the passwords are all "FFFF".

In my understanding, i have to copy the flash api into ram (what i'm trying to do with the command file entry).

But i don't know if i have the actual library or only the symbol map. If my library is just the symbol map, were do i get the real library?

The library is copied from C2000Ware v3.01.00.00.

Is there more i can try? Do i have to install a extern flash memory to save user defined variables?

  • Hi Marcel,

    You can find documentation on using the Flash API within the C2000ware directory:

    C:\ti\c2000\C2000Ware_3_01_00_00\libraries\flash_api\f2806x\docs

    I'd recommend looking at the available Flash API example within c2000ware as well. There is a BOOT ROM build config, for using the Flash API functions stored in ROM, and Software build config, for copying the Flash API to RAM.

    C:\ti\c2000\C2000Ware_3_01_00_00\libraries\flash_api\f2806x\Example_Flash2806x_API

    Note the section of code below for the SW config, which you may be missing:

    // Copy the Flash API functions to SARAM
    #ifdef SW_API
       Example_MemCopy(&Flash28_API_LoadStart, &Flash28_API_LoadEnd, &Flash28_API_RunStart);
    #endif

    Best,

    Kevin

  • Hi Kevin

    Thank you for the fast response and sorry for the incomplete post.

    I used memcpy to copy ramfuncs and the api to ram.

    memcpy(&RamfuncsRunStart,&RamfuncsLoadStart, RamfuncsLoadSize);
    memcpy(&Flash28_API_RunStart, &Flash28_API_LoadStart, Flash28_API_LoadSize);

    I did rename LoadEnd variables to LoadSize as you can see in the command file section of my post.

    I already used the docs and the example projects from c2000ware. The command file i use is originally copied from c2000ware as well (the F28069M.cmd).

    Greetings,

    Marcel

  • Hi Marcel,

    Take a look at the 'Example_Flash2806x_SW_API.cmd' linker command file instead of the 'F28069M.cmd' one. It's located below:

    C:\ti\c2000\C2000Ware_3_01_00_00\libraries\flash_api\f2806x\Example_Flash2806x_API

    Also the 'Example_Flash2806x_ROM_API.cmd' one is for using the Flash API saved in ROM.

    Best,

    Kevin

  • The only difference i could figure between these files and mine (apart of the flash_api definition): there is a flash sector defined in page 1, which i didn't define as data memory before.

    if i use the BootROM_API_TABLE_Symbols library in combinition to the _ROM_API.cmd file, i jump to the 0x3ff4fa ROM address. Which generates a failure on my device. So i changed to the _Library.lib file.

    If i use the _Library.lib in combination with the _SW_API.cmd file but forget to use memcpy, i get a illegal operation interrupt.

    If i doesnt forget to use memcpy: i get the return code 24 from the erase function. Seems like this fixed my (first) problem.

  • Hi Marcel,

    That's good that you got the SW copy method, somewhat, working at least.

    Marcel Estermann said:
    if i use the BootROM_API_TABLE_Symbols library in combinition to the _ROM_API.cmd file, i jump to the 0x3ff4fa ROM address. Which generates a failure on my device. So i changed to the _Library.lib file.

    This sounds correct. There may still be other functions in your program that need to be copied to RAM. Please see page 13 in the Flash2806x_API_Quickstart.pdf for proper linking steps, I think that may be the culprit.

    Marcel Estermann said:
    If i doesnt forget to use memcpy: i get the return code 24 from the erase function. Seems like this fixed my (first) problem.

    Flash API function error codes are documented in the API guide, #24 is STATUS_FAIL_PRECOMPACT. Can you try using the On Chip Flash tool within CCS to erase the entire flash, i.e. not using the Flash API in your code. If that fails, please try the depletion recovery algorithm several times.

    Best,

    Kevin