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.

Flash API in dual use!

Other Parts Discussed in Thread: TMS320F2812

I use TMS320F2812  !

Software is made in two parts:

Project 1 is Bootloader in Flash A

Project 2 is main program in remaining Flash B,C.....

All two projects need Flash API.

To save more space in main project I want to call Flash API in Bootloader from main project!

I can compile both projects that Flash API is always at same position in flash.

But it crashes! I think it is because ram position of variables is not same and I don't know how to solve this problem.

May be I can recompile Flash API and reserve same ram position in both projects.

How to get Flash API source code or is there a other solution to solve this problem?

  • You cannot execute Flash API from Flash - it must be executing from RAM.

    The API itself is not that big. You may be able to save 1...1.5k of flash, but it will be tricky to get it to work.

    First you need to instruct your linker in the main program to place flash API in exactly the same locations as in the bootloader project (including .econst and .cinit) - that is, in Flash A.

    Then, in your main program, you need to load Flash API from Flash A to RAM (via Flash28_API_LoadStart, Flash28_API_RunStart, etc...) when you need it - and only after it's loaded you can call it.
  • Stephan,

    In F2812, Flash API isn't available in BOOTROM. If you wish to use Flash API, you should have it programmed in Flash and execute Flash API algorithm from RAM.


    What do you mean your program crashes? Did you check whether it is stack corruption?

    Regards,

    Manoj

  • Manjo,
    thanks for your answer, I realised my problem and solved it.
    After finishing my own Bootloader all RAM is free for Mainprogram. If I call now a function in Bootloader from Mainprogram it crashes!
    If I separate RAM for Bootloader and Mainprogram it works, but it cost to much RAM.
    Now I link Flash API to both to Bootloader and Mainprogram but,
    I reduced my Flash API calls in Mainprogram to call only "Flash_Program(..)" this reduce code for API to 0x200 Words in flash!

    Regards,
    Stephan