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.

Calling APIs from ROM and .text

Hello,

I am using CCS V 5.4 and 123GH6PGE DK

i  tried  to run a sample of ADC using Tivaware 2.1 APIS and get the .text length then i when tried to run the sample but with using ROM APIS by adding     

#define TARGET_IS_BLIZZARD_RB1
#include "driverlib/rom.h"

and the keyword of ROM_    before all TIVAWARE APIs and the sample also run well but by notifying .text length i found it the same with no reduction

  • Hello Ahmed,

    I created a simple test case and used both ROM_api and api function and it gives me different .text length

    Are you sure that you are not using MAP_ before the replacement to ROM_?

    Regards

    Amit

  • Hello  Amit,

     First,Thank You for your reply then i' sure that i'm not using the MAP_ keyword and that is the main code 

    #define TARGET_IS_BLIZZARD_RB1
    #include "driverlib/rom.h"
    #include <stdint.h>
    #include <stdbool.h>
    #include "inc/hw_memmap.h"
    #include "inc/hw_types.h"
    #include "driverlib/debug.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/adc.h"

    void main(void)
    {

    uint32_t ui32ADC0Value[4]; /*Buffer for Storing the data read from the ADC FIFO */
    /*Depth 4 equal to the sequencer FIFO*/


    volatile uint32_t ui32TempAvg; /*Storing The average of temperature*/
    volatile uint32_t ui32TempValueC; /*store the temperature values for Celsius*/
    volatile uint32_t ui32TempValueF; /*store the temperature values for Fahrenheit*/

    /*Set up the system clock again to run at 40MHz*/
    ROM_SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_OSC_MAIN|SYSCTL_XTAL_16MHZ);

    /*enable the ADC0 peripheral Clock */

    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);

    /*Hardware averaging*/
    ROM_ADCHardwareOversampleConfigure(ADC0_BASE, 64);
    /*Configure Sample Sequencer 0
    use ADC0, sample sequencer 1
    the processor to trigger the sequence
    use the highest priority */

    ROM_ADCSequenceConfigure(ADC0_BASE, 1, ADC_TRIGGER_PROCESSOR, 0);

    /*Configure steps 0 - 2 on sequencer 1 to

    sample the temperature sensor (ADC_CTL_TS)*/

    ROM_ADCSequenceStepConfigure(ADC0_BASE, 1, 0, ADC_CTL_TS);
    ROM_ADCSequenceStepConfigure(ADC0_BASE, 1, 1, ADC_CTL_TS);
    ROM_ADCSequenceStepConfigure(ADC0_BASE, 1, 2, ADC_CTL_TS);

    /*
    *********************************************************
    *The final sequencer step :
    *1- Sample the temperature sensor (ADC_CTL_TS)
    *2- and configure the interrupt flag (ADC_CTL_IE)
    * to be set when the sample is done to be
    * as indication that that the ADC Conversion complete
    *3-Tell the ADC logic that this is the
    *last conversion on sequencer (ADC_CTL_END)
    *************************************************************
    */
    ROM_ADCSequenceStepConfigure(ADC0_BASE,1,3,ADC_CTL_TS|ADC_CTL_IE|ADC_CTL_END);

    /*Now Enable The Sequencer(as preferred after config)*/
    ROM_ADCSequenceEnable(ADC0_BASE, 1);


    ROM_ADCHardwareOversampleConfigure(ADC0_BASE, 64);

    /*we’re going to read the value of the temperature
    sensor and calculate the temperature endlessly */

    while(1)
    {

    /* Clear sample sequence interrupt source */

    ROM_ADCIntClear(ADC0_BASE, 1);

    /*trigger the ADC conversion with software */

    ROM_ADCProcessorTrigger(ADC0_BASE, 1);

    /*wait for the conversion to complete(Polling) */

    while(!ROM_ADCIntStatus(ADC0_BASE, 1, false))
    {
    }
    /*The conversion has complete so we can read from FIFO
    * of the Sequencer1(copies data to a buffer in memory)
    * This will only return the samples that are presently
    * available
    */
    ROM_ADCSequenceDataGet(ADC0_BASE, 1, ui32ADC0Value);


    /*Calculate the average of the temperature sensor data
    ************************************************************************
    * The addition of 2 is for rounding. Since 2/4 = 1/2 = 0.5,
    * 1.5 will be rounded to 2.0 with the addition of 0.5.
    * In the case of 1.0, when 0.5 is added to yield 1.5,
    *this will be rounded back down to 1.0 due to the rules of integer math
    ************************************************************************
    */
    ui32TempAvg = (ui32ADC0Value[0] + ui32ADC0Value[1] + ui32ADC0Value[2] + ui32ADC0Value[3] + 2)/4;
    /*calculate the Celsius value of the temperature
    * according to data sheet equation
    */
    ui32TempValueC = (1475 - ((2475 * ui32TempAvg)) / 4096)/10;

    /*calculate the Fahrenheit value of the temperature */
    ui32TempValueF = ((ui32TempValueC * 9) + 160) / 5;

    }

    }

  • Hello Ahmed,

    I took your code and ran the same with all ROM_ removed and with ROM_ for API's. I checked the map file for both. The first one is for ROM_

    SEGMENT ALLOCATION MAP

    run origin  load origin   length   init length attrs members
    ----------  ----------- ---------- ----------- ----- -------
    00000000    00000000    00000658   00000658    r-x
      00000000    00000000    0000026c   0000026c    r-- .intvecs
      0000026c    0000026c    000003ca   000003ca    r-x .text
      00000638    00000638    00000020   00000020    r-- .cinit
    20000000    20000000    00000214   00000000    rw-
      20000000    20000000    00000200   00000000    rw- .stack
      20000200    20000200    00000014   00000000    rw- .data

    The second one is for ROM_ removed and the define commented out

    SEGMENT ALLOCATION MAP

    run origin  load origin   length   init length attrs members
    ----------  ----------- ---------- ----------- ----- -------
    00000000    00000000    00000890   00000890    r-x
      00000000    00000000    0000026c   0000026c    r-- .intvecs
      0000026c    0000026c    000005fe   000005fe    r-x .text
      00000870    00000870    00000020   00000020    r-- .cinit
    20000000    20000000    00000214   00000000    rw-
      20000000    20000000    00000200   00000000    rw- .stack
      20000200    20000200    00000014   00000000    rw- .data

    I am using CCSv5.5 and have the PART_IS_BLIZZARD_RB1 as part of my predefined. I tried it by removing the PART_IS_BLIZZARD_RB1 but no difference in .text length

    Regards

    Amit