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.

Issue compiling legacy code

Other Parts Discussed in Thread: CC2531, CC2530EM, CC2530, Z-STACK

I have inherited a project using the smartRF05EB with a CC2530EM mounted. I also have a cc2531 USB Dongle that should communicate with the smartRF board.

I can compile the demo code in cc2530_development_kit_user_guide and flashed it to the smartrf device. And it worked without issues. I have not tried to get the cc2531 dongle to work yet.

I then tried to open the code that my predecessor in the lab wrote and it will not compile. I know for certain that it works, but it just will not compile on my machine.

The goal of the project is to use the cc2531 Usb dongle to communicate over zigbee to the cc2530 to control a pcb. It was a senior design project last year but was never fully completed.

I presume there is an issue with the compiler and/or linker settings. I have attached a screen shot with the error. I also get an error when trying to open the hal files.

S

  • Hi,

    please make sure you are using the IAR version recommended for this this stack release (since you are using an old 2.5.1a, the IAR version to be used is 8.10.4) and also please make sure the right include path is included in Project otions --> C/C++ compiler --> Preprocessor settings, Additional include directories.

    Your predecessor may have messed with those settings including an absolute path, that is maybe the reason why it is not finding the files on your machine if you installed it in a different directory tree.

    Thanks,

    TheDarkSide

  • I have installed version 8.10.4 and 8.10.3. I have tried the exact code on a computer with version 8.30.2 and it works fine and with the 8.10.* version I get issues about the files being created on a new version. And they were created on version 8.30.2

    I have version 8.30.3 installed at the moment. The current issue is it is not able to find the files even though I know they are there and IAR can open the file!

    I have the precompiler set to search an environmental variable set to C:/Texas Instruments\
    I have no idea why the IAR is searching through C:/Users/. I could not find where that setting was.

    I have the settings set to the following with a ZSTACK environmental variable to C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components

    $PROJ_DIR$
    $PROJ_DIR$\..\Source
    $PROJ_DIR$\..\..\ZMain\TI2530DB
    $_ZSTACK_$
    $_ZSTACK_$\hal\include
    $_ZSTACK_$\hal\target\CC2530EB
    $_ZSTACK_$\mac\include
    $_ZSTACK_$\mac\high_level
    $_ZSTACK_$\mac\low_level\srf04
    $_ZSTACK_$\mac\low_level\srf04\single_chip
    $_ZSTACK_$\mt
    $_ZSTACK_$\osal\include
    $_ZSTACK_$\services\saddr
    $_ZSTACK_$\services\sdata
    $_ZSTACK_$\stack\af
    $_ZSTACK_$\stack\nwk
    $_ZSTACK_$\stack\sapi
    $_ZSTACK_$\stack\sec
    $_ZSTACK_$\stack\sys
    $_ZSTACK_$\stack\zdo
    $_ZSTACK_$\zmac
    $_ZSTACK_$\zmac\f8w

    Building configuration: RoachZStack - EndDeviceEB
    Updating build tree...
     
    73  file(s) deleted.
    Updating build tree...
    AF.c  
    Fatal Error[Pe1696]: cannot open source file "OSAL.h" C:\Users\Texas Instruments\ZStack-CC2530-2.5.1a\Components\stack\af\AF.c 44
                searched: "C:\Users\Texas Instruments\ZStack-CC2530-2.5.1a\Components\stack\af\"
                searched: "C:\Users\Kevin Keller\Dropbox\ibionics\Testing\SmartNeuralInterfaces\RoachZStack\CC2530DB\"
                searched: "C:\Users\Kevin Keller\Dropbox\ibionics\Testing\SmartNeuralInterfaces\RoachZStack\CC2530DB\..\Source\"
                searched: "C:\Users\Kevin Keller\Dropbox\ibionics\Testing\SmartNeuralInterfaces\RoachZStack\CC2530DB\..\..\ZMain\TI2530DB\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\hal\include\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\hal\target\CC2530EB\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\mac\include\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\mac\high_level\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\mac\low_level\srf04\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\mac\low_level\srf04\single_chip\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\mt\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\osal\include\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\services\saddr\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\services\sdata\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\stack\af\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\stack\nwk\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\stack\sapi\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\stack\sec\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\stack\sys\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\stack\zdo\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\zmac\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\zmac\f8w\"
                searched: "C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\8051\inc\"
                searched: "C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\8051\inc\clib\"
    Error while running C/C++ Compiler
    BindingTable.c  
    Fatal Error[Pe1696]: cannot open source file "ZComDef.h" C:\Users\Texas Instruments\ZStack-CC2530-2.5.1a\Components\stack\nwk\BindingTable.c 43

  • Looks like your project paths are messed up. I would like to suggest you to reinstall Z-Stack 2.5.1a to default folder C:\Texas Instruments\ZStack-CC2530-2.5.1a\. Then, copy your own project into this new installation and rebuild the project. It should fix your problem.

  • Thanks for the tip. It did not work though.

    I uninstalled ZSTACK, and reinstalled 2.5.1a and downloaded a new version of the project from the other computer and unzipped it in C:\Texas Instruments\ZStack-CC2530-2.5.1a\Projects\

    And then I tried to compile using IAR. I get a very similar error. It no longer searches through Users but it still can not find files that I know are there. I opened found hals_def.h in a folder it claimed it searched.

    I have attached the full error log as well. 2437.error_compile.txt

    Building configuration: RoachZStack - EndDeviceEB
    Updating build tree...
     
    28  file(s) deleted.
    Updating build tree...
    hal_timer.c  
    hal_key.c  
    Fatal Error[Pe1696]: cannot open source file "hal_defs.h" C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\hal\target\CC2530EB\hal_mcu.h 53
                searched: "C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\hal\target\CC2530EB\"
                searched: "C:\Texas Instruments\ZStack-CC2530-2.5.1a\Projects\Neural\SmartNeuralInterfaces\RoachZStack\CC2530DB\"
                searched: "C:\Texas Instruments\ZStack-CC2530-2.5.1a\Projects\Neural\SmartNeuralInterfaces\RoachZStack\CC2530DB\..\Source\"
                searched: "C:\Texas Instruments\ZStack-CC2530-2.5.1a\Projects\Neural\SmartNeuralInterfaces\RoachZStack\CC2530DB\..\..\ZMain\TI2530DB\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\hal\include\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\hal\target\CC2530EB\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\mac\include\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\mac\high_level\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\mac\low_level\srf04\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\mac\low_level\srf04\single_chip\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\mt\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\osal\include\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\services\saddr\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\services\sdata\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\stack\af\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\stack\nwk\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\stack\sapi\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\stack\sec\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\stack\sys\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\stack\zdo\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\zmac\"
                searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\zmac\f8w\"
                searched: "C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\8051\inc\"
                searched: "C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\8051\inc\clib\"
    Error while running C/C++ Compiler

  • When I get this compiler error, it's because I don't have the necessary include path defined in my IAR project file.

    In your IDE, navigate to the Project->Options->C/C++ Compiler->Preprocessor dialog and make sure the path to the 'missing' file is listed in the box called "Additional include directories..."

  • In this specific case, hal_defs.h is located at: C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\hal\include so the include paths in the IDE should have an entry of: $PROJ_DIR$\..\..\..\..\..\Components\hal\include

  • Ok. We are a bit closer to getting this issue resolved, but I still have unexplained behavior.

    I have two identical projects. One in C:\Texas Instruments\ZStack-CC2530-2.5.1a\Projects and one on my desktop.

    Both have the following includes:
    $PROJ_DIR$
    $PROJ_DIR$\..\Source
    $PROJ_DIR$\..\..\ZMain\TI2530DB
    $_ZSTACK_$\hal\include
    $_ZSTACK_$\hal\target\CC2530EB
    $_ZSTACK_$\mac\include
    $_ZSTACK_$\mac\high_level
    $_ZSTACK_$\mac\low_level\srf04
    $_ZSTACK_$\mac\low_level\srf04\single_chip
    $_ZSTACK_$\mt
    $_ZSTACK_$\osal\include
    $_ZSTACK_$\services\saddr
    $_ZSTACK_$\services\sdata
    $_ZSTACK_$\stack\af
    $_ZSTACK_$\stack\nwk
    $_ZSTACK_$\stack\sapi
    $_ZSTACK_$\stack\sec
    $_ZSTACK_$\stack\sys
    $_ZSTACK_$\stack\zdo
    $_ZSTACK_$\zmac
    $_ZSTACK_$\zmac\f8w

    If I use your suggestion with the $PROJ_DIR$\..\..\..\..\..\Components\hal\include, it works with the one in \Projects but not with the desktop one.
    If I hardcode C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\hal\include it works with both.
    My issue is, I have an environmental variable for my machine. ZSTACK that I have set to  C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components

    I don't see the difference between the hardcoded version and the version using the ZSTACK, yet only one works. And if you look at the error output, it is looking in the proper folder!

    Why am I getting this behavior? Is there any way of making it work with the ZSTACK variable?

  • I wonder if you're having problems with relative paths in the IAR project file. Did you replace all references to $PROJ_DIR$\..\..\..\..\..\Components with your environment variable? What part of the Z-Stack release did you put on the Windows desktop the entire installed release or just the project folder or... ?

  • Here's the thing. It is pulling NOTHING from the ZSTACK variable. But in the error message (see previous post attached file), it says it is looking through the folders for the files.

    I only have the Project folder on the desktop.

    I tried removing all references to the ZSTACK and hardcoding the path into the precompiler, but it gave the exact same error on Dropbox and Desktop. I then tried removing ZSTACK and replacing it with $PROJ_DIR$, and it fails for Dropbox and Desktop.

    If the project is in \Projects it works to hard code it or use $PROJ_DIR$.

    Is there any workaround outside of using \Projects for everything?

    In the working version on the other computer I have the following. And the ZSTACK is the same as previous.

    $PROJ_DIR$
    $PROJ_DIR$\..\Source
    $PROJ_DIR$\..\..\ZMain\TI2530DB
    $_ZSTACK_$
    $_ZSTACK_$\hal\include
    $_ZSTACK_$\hal\target\CC2530EB
    $_ZSTACK_$\mac\include
    $_ZSTACK_$\mac\high_level
    $_ZSTACK_$\mac\low_level\srf04
    $_ZSTACK_$\mac\low_level\srf04\single_chip
    $_ZSTACK_$\mt
    $_ZSTACK_$\osal\include
    $_ZSTACK_$\services\saddr
    $_ZSTACK_$\services\sdata
    $_ZSTACK_$\stack\af
    $_ZSTACK_$\stack\nwk
    $_ZSTACK_$\stack\sapi
    $_ZSTACK_$\stack\sec
    $_ZSTACK_$\stack\sys
    $_ZSTACK_$\stack\zdo
    $_ZSTACK_$\zmac
    $_ZSTACK_$\zmac\f8w

  • Looking back a couple of days, I notice something interesting in error text line: '...searched: " C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\hal\include\"...'

    The first character of the pathname appears to be a space - I suspect that your PC does not have a drive " C:"

    Perhaps your string for the $_ZSTACK_$ environment variable has a leading space?

  • Good spot. That solved that issue. Wish I had spotted that last week, but I learned to another thing to check during troubleshooting.