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.

Problem with Stellaris Launchpad an CCS



Hello, I'm trying to compile a project and I get this error: "unresolved symbol __error__, first referenced in ./Drivers/ustdlib.obj"

How can I fix it?

Thank you!

  • If you define the DEBUG label in your build environment, the ASSERT macro used in a lot of the StellarisWare modules changes its definition to call a function called __error__() if an error is detected. You need to include this function in your main application somewhere. Typically, we'll make this function dump out the parameters passed (the filename and line number of the detected error) then spin in a while(1) loop. Take a look in some of the board examples under C:\StellarisWare\boards and you should find code you can cut and paste into your own application.

  • So, I can delete the debug label or create an __error__ function?

  • Those are two options. A better one is to include the __error__ function and enclose it in #ifdef DEBUG/#endif tags. Building and running with DEBUG defined is a good idea since it will help you catch some errors that you may overlook when DEBUG isn't defined (and none of the runtime parameter checking code is present).

  • Now I'm trying to debug the application (I added the error function) and I get this error that I don't understand:


    No source available for "0x90036800"

  • My first guess would be that the application has crashed. Something caused the code to jump off in the weeds (0x90036800 isn't a valid address for code). The debugger stopped and is trying to disassemble code at the current PC but can't find any code that matches the bogus address, hence the error.

    The first thing I would look for here is stack corruption.

  • This is my code:

    #include "inc/hw_memmap.h"
    #include "inc/hw_types.h"
    #include "driverlib/debug.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/systick.h"
    #include "driverlib/adc.h"
    #include "driverlib/rom.h"
    #include "driverlib/gpio.h"
    #include "driverlib/pin_map.h"
    #include "driverlib/i2c.h"
    #include "MisDrivers/ustdlib.h"
    #include "MisDrivers/uartstdio.h"

    #ifdef DEBUG
    void
    __error__(char *pcFilename, unsigned long ulLine)
    {
    }
    #endif


    int main(void) {

    SysCtlClockSet(SYSCTL_SYSDIV_5 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN);

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    GPIOPinConfigure(GPIO_PA0_U0RX);
    GPIOPinConfigure(GPIO_PA1_U0TX);
    GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);


    UARTStdioInit(0);

    UARTprintf("Starting I2C \n");
    SysCtlDelay(2000000);


    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);


    GPIOPinTypeI2CSCL(GPIO_PORTB_BASE, GPIO_PIN_2);
    GPIOPinTypeI2C(GPIO_PORTB_BASE, GPIO_PIN_3);

    GPIOPinConfigure(GPIO_PB2_I2C0SCL);
    GPIOPinConfigure(GPIO_PB3_I2C0SDA);


    SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C0);


    I2CMasterInitExpClk(I2C0_MASTER_BASE, SysCtlClockGet(), true);


    UARTprintf("I2C is OK\n");
    SysCtlDelay(2000000);

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
    GPIOPinTypeGPIOOutput (GPIO_PORTF_BASE, GPIO_PIN_1);
    while (1){
    GPIOPinWrite (GPIO_PORTF_BASE, GPIO_PIN_1,0xFF);
    SysCtlDelay (2000000);
    GPIOPinWrite (GPIO_PORTF_BASE, GPIO_PIN_1,0x00);
    SysCtlDelay (2000000);

    }
    }

    It's quite simple. The only thing I do is to initialize the I2C and send something using the uart and make a led blink to check all is correct

  • Thanks for your code. Maybe it would be more helpful if you described where the crash occurs and what debugging steps you've taken to try to determine the cause? You can find a really helpful appnote on diagnosing faults which may be helpful here.

  • I really don't know where the crash occurs because It happens anywhere, sometimes before, sometimes after. I click the debug button and analize it step by step, most of the time the crash occurs after the "UARTStdioInit(0);"



    The color it's different in this function, why?


    Thank you!

  • When the crash occurs, what do the registers tell you about the state of the processor? Have you taken an exception (LR will contain a value like 0xFFFFFFF9 or some other negative value in this case). Where is the PC? If you've taken an exception, what's on the exception stack (see the appnote I referenced earlier for information on this). Is the stack pointer (R13) valid or is it corrupt (it should be an address somewhere between 0x20000000 and the top of RAM)? Has the stack overflowed (check your MAP file to see what range of memory is set aside for the stack and make sure R13 is still within this range).

  • The problem is that the debugger can't read the registers

    The step before crash

  • That definitely makes life more difficult! It looks as if the JTAG connection is dropping or something equally unpleasant is causing the debugger to lose the connection to the board. If you step through the assember from a point before which you've never seen a crash, can you get some idea of where the crash occurs and exactly what is going on just before it or does the position of the crash change from run to run?

    The first thing I would try here would be to reduce the JTAG clock rate and see if that improves the connection reliability. I have to admit that I don't use CCS so I can't tell you right now how to do this. I'll see if I can set the tool up and have a play with it later so that I can offer some more useful help. It may also be helpful if you could ZIP up your project and attach it to a post so that I can try to reproduce the problem here.

  • The crash change from run to tun, but it always happens between "UARTStdioInit(0);" and "UARTprintf("UART: OK... \n");" and always after UARTprintf

    Here is my project 8182.Definitivo.rar

  • Thanks for your project files. I've imported them into CCS5.3 and, after a few tweaks, the code is running for me without any problems. I had to add a couple of preprocessor labels ("ccs", "TARGET_IS_BLIZZARD_RA1" and "PART_LM4F120H5QR" in the "Predefined Symbols" compiler properties dialog) and I had to fix up the include path for my system and link a locally built version of the driverlib library. I also had to create a target configuration file to allow me to debug on the LaunchPad board but this involved merely telling CCS that I was using a "Stellaris In-Circuit Debug Interface" and that the target device is a Stellaris LM4F120H5QR. All other settings were left at the defaults or the values you had in your original project.

    I built the image with all optimizations disabled and debug information included (which I presume you were also doing). I'm not sure what to suggest at this point. Perhaps you could post very detailed information on exactly what you are doing when you see the problem and included information on your debug target configuration, CCS and driver versions?