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.

ROM.h question

Other Parts Discussed in Thread: TM4C1230C3PM

here is the code I see from rom.h, ROM_APITABLE is a pointer of uint32_t start from 0x01000010, but what ROM_APITABLE[1] this mean? 

#define ROM_APITABLE            ((uint32_t *)0x01000010)

#define ROM_VERSION             (ROM_APITABLE[0])

#define ROM_UARTTABLE           ((uint32_t *)(ROM_APITABLE[1]))

#define ROM_SSITABLE            ((uint32_t *)(ROM_APITABLE[2]))
#define ROM_I2CTABLE            ((uint32_t *)(ROM_APITABLE[3]))
#define ROM_GPIOTABLE           ((uint32_t *)(ROM_APITABLE[4]))
#define ROM_ADCTABLE            ((uint32_t *)(ROM_APITABLE[5]))
#define ROM_COMPARATORTABLE     ((uint32_t *)(ROM_APITABLE[6]))
#define ROM_FLASHTABLE          ((uint32_t *)(ROM_APITABLE[7]))
#define ROM_PWMTABLE            ((uint32_t *)(ROM_APITABLE[8]))






  • Hello Shan,

    This is a basic C construct. ROM_APITABLE is an array of pointers where ROM_APITABLE[0] contains the ROM_VERSION, ROM_APITABLE[1] has a pointer to ROM_UARTTABLE, ROM_APITABLE[2] = pointer to ROM_SSITABLE, etc.

    To get the specific definition of ROM_xxxTABLE I would recommend you have a look at the TM4C documentation of the ROM API functions. The ROM user guide is generally available on the part specific product page by clicking on the technical documents tab.

    For example, here is a link to a ROM userguide for TM4C1230C3PM which is a random pick since you didn't provide which part you are using.

    www.ti.com/.../spmu367. If you have a look at Section 1 Introduction, it provides a detailed explanation that will answer your question as long as you have an understanding of what an array of pointers is and, specifically, what function pointers are.

    For more information on arrays of pointers, I would suggest you have a look at your C text book or do a search on the web. Arrays of pointers can be used to index any type of variable allowed in C such as other arrays, structures, integers, words, unions, and even functions. (note that this is not a complete list)
  • Thanks, Chuck, I am a new bee, but thanks for your answer.


    Shan
  • Hi, Chuck, sorry to bother you again, I check the manual you told me, I found that the rom.h only has the head file, can you tell me where the rom.c is? I check the ROM user guide, I found the table itself are all pointers, so is that means the functionality has been part of the TM4C itself? such like ROM_GPIODirModeSet() this is a function that been firmwared inside the rom? and the program just call the Address itself will invoke the ROM_GPIODirModeSet() code itself?
  • Hello Shan,

    This is really a question where you need to understand some basics about memory types. There are three different memory types used in the TM4C devices - Flash, ROM, and SRAM. Flash and ROM are nonvolatile memories meaning the content is not disturbed through a power cycle and SRAM is volatile memory used for temporary storage of data during run time (this memory is lost when power is removed). Flash memory is programmable/erasable by the customer and ROM is programmed at the factory (think of this as hard coded data/instructions burned into the silicon). SRAM is, as mentioned, readable/writable during that application. I would urge you to do some research on these different types of memory to become familiar with the details of them and how they work.

    For you specific question, there is no rom.c file. The rom.h file is provided as an "API" or application interface to the ROM functions that are stored in ROM memory. The function pointers in the tables point to the ROM memory locations where the binary of these functions are stored. When you want to use one of the ROM functions you call it as you would any other function in your program noting that all of the ROM functions are preceded with 'ROM_' {i.e. to call a ROM function include rom.h and reference the function ROM_function(param1, param2,...}

    The distinct advantage of using ROM based functions is that you don't have to use valuable flash program space to store driver library functions. This adds value to the device.

    A distinct disadvantage of the ROM based functions is they are not upgradable/reprogrammable. This means if a function doesn't do exactly what you want or has a bug, you can't use the ROM based function and will have to switch to the flash based TivaWare driver function. In fact, in some cases, ROM based functions are removed from the documentation when bugs are found and TI makes recommendations to use the Flash based drivers.

    In regard to where ROM is located, I would urge you to review the datasheet/userguide for the device you are using. The userguides and datasheets are all available on TI.com. Specifically, review chapter 8 which discusses device internal memory.

    I certainly understand that you are a newbee and that embedded systems can be quite overwhelming at first. However, the most important thing for you to learn is to the ability to search for and review all relevant technical documentation including the user guides, datasheets, and errata documents since they will tell you how the device is put together, how to use the device, what constraints there are to device use, and important deviations from the intended operation of the device.