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.

LAUNCHXL-F28069M: Question about flash programming

Part Number: LAUNCHXL-F28069M
Other Parts Discussed in Thread: MOTORWARE

Dear TI experts:I am flashing the FOC routine. The program runs well in RAM. Replace the F28069F.cmd file under MotorWare with F28069F_RAM_lnk.cmd. There is no problem after compiling. There is no error during the programming process. GPIO34/GPIO37 are High level, after the download program is completed, power off and restart, the flash program does not run, why is this?how do i check?

Hope that helps,Thanks!

  • explain:it should be exclude  F28069F_RAM_lnk.cmd. ,use  F28069F.cmd.

  • Added:

    1  "connect target" with emulator,warn"Break at address "0x3ff75b" with no debug information available, or outside of program code."

    2  disconnect emulator,Power on again after power off,The CPU is in reset state, the program does not run, and does not enter main()

    3 MotorWare Lab10e,F28069F,no modification of memory allocation.

  • Have you set the boot mode switches on your board to the correct settings for boot from flash?

    Did you switch the build configuration of your project to Flash or did you manually just switch the cmd files?

    Please make sure that the memCopy() at the start of main() is present in the compiled code and that the CodeStartBranch.asm file isn't missing from the project.

    Whitney

  • Dear Whitney:Hi,Thank you very much for your reply!

    1 Have you set the boot mode switches on your board to the correct settings for boot from flash?

       yes,This has already been stated,GPIO34/GPIO37 are High level(1.8V)

    2  Did you switch the build configuration of your project to Flash or did you manually just switch the cmd files?

      This has also been explained,manual replace F28069F_RAM_lnk.cmd with F28069F.cmd. I think it's  no necessary"build configurations" to active

    3 Please make sure that the memCopy() at the start of main() is present in the compiled code and that the CodeStartBranch.asm file isn't missing from the project.

      That's exactly what I'm paying attention to,Because it is a routine, I did not modify it. I looked at the code and it seems to comment out the #pragma DATA_SECTION before main() and also the memcopy() at the beginning of main(),It doesn't seem to need to copy the function to RAM.yes, the program includes CodeStartBranch.asm.

    Hope for further help

    Thanks!

    Quan.

  • add:ed:I just added my code to the routine and didn't modify settings like memory.

  • added:I checked the routine code again, and there is something I don't understand. In the F28069F.cmd file, define

    ramfuncs: LOAD = FLASHD,
    RUN = RAML0_1,
    LOAD_START(_RamfuncsLoadStart),

    LOAD_END(_RamfuncsLoadEnd),
    RUN_START(_RamfuncsRunStart),
    PAGE = 0
    In usDelay.asm, .sect "ramfuncs", but before main()
    #ifdef FLASH
    extern uint16_t *RamfuncsLoadStart, *RamfuncsLoadEnd, *RamfuncsRunStart; (no #define FLASH, so commented out),In the map file:
    ramfuncs 0 003e8000 0000006e RUN ADDR = 00008000
    003e8000 0000006a flash.obj (ramfuncs)
    003e806a 00000004 usDelay.obj (ramfuncs)
    When single-stepping, it feels that the program is stuck in a segment after 0x8000.

  • Can you try the Flash build configuration? It should set up everything for booting from flash. It will swap the cmd files, add the memCopy.c file, and "FLASH" to the predefined symbols in the compiler settings.

    To explain what is going on with that ramfuncs section--since Flash has wait states, we often will take functions that we want to run with the best performance (like mainISR or usDelay) and have them execute from RAM instead of Flash. However since RAM is volatile, we need to still load the code to Flash at first and then copy it to RAM at start up.

    So in F28069F.cmd we're telling the linker to load ramfuncs to Flash, but make sure that the actual address it tries to execute it from is in RAM. Then in the application code we run "memCopy((uint16_t *)&RamfuncsLoadStart....)" to actually copy the code from Flash to RAM to populate the functions in RAM and then we can safely call those functions. If we don't do the memCopy, you'll just get an ITRAP error because the CPU will be trying to fetch an instruction from unprogrammed memory.

    You'll know if the memCopy worked if you look at address 0x8000 in the Disassembly view in CCS and see if it contains valid code.

    Whitney

  • Dear Whitney:Hi,Thank you for your reply! Yes, your idea is the same as mine, I am also thinking of using memCopy(), this may need to check the memory occupied by the function from the map file, I haven't used CCS for long, and I want to call multiple functions to RAM. If the functions takes up a small space, it should be possible to share a defined segment for multiple functions, right? For example" ramfuncs". I will experiment first, and I will communicate with you if I have any questions.
    Thanks again!
    best regard!

    Quan

  • I want to call multiple functions to RAM. If the functions takes up a small space, it should be possible to share a defined segment for multiple functions, right?

    Yes, definitely. As long as you don't run out of RAM you can keep adding things to ramfuncs using "#pragma CODE_SECTION(...)"

    Whitney

  • Dear Whitney:Hi,Thank you for your reply!After calling memCopy(), recompile, download, with and without emulator everything works fine! Of course, I just copied usDelay into RAM. There is a related question that needs help:
    1 In the map file, I can't see how much space each function occupies. Do you have a solution?
    2 In the cmd file, the definition of RAML0_1 is only 3k. It is estimated that there is not enough space to transfer multiple functions into RAM. It needs to be expanded. How to do it?
    3 I checked the map file and found that RAM4-RAM8 are not used, can I connect them together and name them "ramfuncs", then I can modify the cmd file and modify RAML4: origin = 0x00A000, length = 0x002000 to RAML4_8: origin = 0x00A000, length = 0x009800, delete the definition of RAM5-RAM8, and then define ramfuncs: LOAD = FLASHD,
    RUN = RAML4_8, (RAML0_1 before modification)
    LOAD_START(_RamfuncsLoadStart),
    LOAD_END(_RamfuncsLoadEnd),
    RUN_START(_RamfuncsRunStart),
    PAGE = 1 (0 before modification)
    I only need to define #pragma CODE_SECTION(...) before main(), and use memCopy() in mani(). In this case, there is more than 30k RAM space, which is enough to call the function you want to call. Can you do it?

    Quan

  • added:The end of the 3rd should be can I do this?

    sorry!

  • 1 In the map file, I can't see how much space each function occupies. Do you have a solution?

    In your compiler options you can turn on --gen_func_subsections (under Advanced Options -> Runtime Model Options). Having separate subsections for each of your functions should make their size more visible in the cmd file.

    2 In the cmd file, the definition of RAML0_1 is only 3k. It is estimated that there is not enough space to transfer multiple functions into RAM. It needs to be expanded. How to do it?

    As long as the RAM blocks an contiguous, you should be able to combine them into whatever size you need. See the FAQ on the page below about combining continuous flash blocks. Same thing can be done for RAMs.

    https://software-dl.ti.com/ccs/esd/documents/c2000_c28x-compiler-understanding-linking.html

    In this case, there is more than 30k RAM space, which is enough to call the function you want to call. Can you do it?

    As long as you have enough room in the remaining RAM to hold your .stack, .ebss, etc...that should be fine. Another thing to consider if whether or not you have any CLA or security requirements for certain sections of your code or data, as that may influence which blocks you choose to use for them--for example, only L3 can be used as CLA program RAM, so if you need to use CLA, you'll want to reserve space in there for your CLA code.

    Whitney

  • Dear Whitney:Hi,Thank you for your reply! I will do further understanding.

    Thanks again!
    best regard!

    Quan