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.

CCS/TM4C123GH6PM: GPIOPinConfigure vs ROM_GPIOPinConfigure

Part Number: TM4C123GH6PM

Tool/software: Code Composer Studio

Hello,

I'm working with the TM4C123G Launchpad.

In online examples sometimes I see the GPIOPinConfigure function is being used while other time I see ROM_GPIOPinConfigure.

What is the difference between both ? When should one be used instead of the other ?

  • Hello,
    I will move this thread to the device forum. The experts there can assist you best.

    Thanks
    ki
  • Usually, the functions do the same thing. When you call "GPIOPinConfigure()" the code for this function gets included in your program and resides in the flash memory. When you call "ROM_GPIOPinConfigure()" the program jumps to a routine in the ROM memory, so it does not take up flash space. The disadvantage of using ROM based functions is that if there is a bug in the ROM based function, it cannot be fixed with a new version of the library. So instead, you can include the header files "rom.h" and "rom_map.h" and use the prefix "MAP_". The header files from the latest version of TivaWare will translate to the ROM_ based function if it matches the latest version, otherwise it will translate to the flash based function in that library.
  • Thanks,
    So the general recommendation if to use ROM_ suffixed functions unless there's a bug ?
    Also - you say: "Usually, the functions do the same thing". Is there an exception when they don't ?
  • If flash space is a concern, the recommendation is to use the "MAP_" prefix. This will invoke the ROM version unless a bug was found in that version and a newer version of the function is provided in the TivaWare library. This is the case where the ROM and library versions differ.

    It really is not an issue when you start developing your code because the ROM_ version of a function will not be defined in the latest version of the TivaWare library if the code in the ROM was discovered to contain a bug. The difference is when we release an updated library and you rebuild your code with the new library. If you use the ROM_ prefix and the ROM version of that function was deprecated, you will get a link error. If you used the MAP_ prefix, the header file will automatically cause the linker to pull in the library version. That being said, using either "ROM_" or "MAP_" prefix will minimize the amount of flash memory needed for your program. It is your choice if you want to be notified with an error when linking with an updated library version and a function has changed, or not.