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.

TM4C1294NCPDT: Particular differences between ROM_function(.....) vs MAP_function(.....) vs function(.....) calls

Part Number: TM4C1294NCPDT


Hello. Maybe this is a naive question and maybe has been already answered in the past, but I can't locate any info on that. What is the main difference, if any, when my code calls for example the SysCtlClockFreqSet(SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480, 120000000) function just like it is written and as ROM_SysCtlClockFreqSet(...... ) and as MAP_SysCtlClockFreqSet(.....) ?  All three versions seem to behave the same. Do these different calls signal to the compiler some certain directions of what lib's to use? Thank you. John

  • Hi,
    Suppose your code is intended to be shared between projects, and some of the projects run on devices with a ROM and some run on devices without a ROM, it is convenient to have the code automatically call the ROM or the flash version of the API without having #ifdef-s in the code. It is also possible that there might be bugs with the ROM version of the functions and the way to workaround problem is to use the rebuild the library for flash execution instead of the ROM.
    The rom_map.h provides an automatic mapping feature for accessing the ROM. Similar to the ROM_Function()
    APIs provided by rom.h, a set of MAP_Function() APIs are provided. If the function is available in ROM, MAP_Function() simply calls ROM_Function(); otherwise it calls Function(). If the version in ROM has bugs then the flash version in the newest TivaWare driverlib library will be called instead.
  • Hello Charles and thank you. So, if I get it right, when my code calls just Function() then the compiler embeds into the final bin the Function()'s source from the TIVA libraries that are installed under my production environment CCS7. If my code calls the ROM_Function(), then compiler directly embeds to the final bin a pointer that points/calls my Cortex-M4 processor's ROM address of that function. And if my code uses the MAP_Function() then compiler checks if there is a ROM on the microcontroller and if there is one then points to the function in ROM, otherwise embeds the code directly from the TIVA libraries. I assume ROM_function_call_method(), if ROM is present, results to smaller sized bins. Correct? But isn't it true that running code from ROM is a bit slower than having it and running it from inside the bin on the flash memory? Unless the two memories, flash & ROM are of equal speed. Is this the case on the TM4C1294 IC? Again, thank you very much. John
  • Hi John,
    On the contrary, you are likely to see some performance benefit when executing the functions out of ROM, especially when running at high system clock speeds because ROM always runs at the system clock rate without any wait states whereas flash can't run as quickly and you may stall in some cases.
  • O.K. Charles, now it's clear and thank you very much.
    So:
    1)
    a) ROM_Function() -> run it from ROM & compiler just inserts into the final bin a pointer to the Function()'s address in ROM.
    b) MAP_Function() -> run it from ROM, if ROM is present and Function() exist in ROM, OTHERWISE, embed Function()'s code from TIVA libs
    c) Function() -> embed Function()'s code from TIVA libs

    2) Running a Function() from ROM, as ROM_Function() is both size and speed efficient.

    All above correct?
    Thank you,
    John
  • Hi John,
    Your understanding is correct.
  • Thank you very much Charles,
    John