TI E2E Community
Low Power RF & Wireless Connectivity
Low Power RF ZigBee® Software & IEEE 802.15.4 Forum
Using Eclipse (to drive IAR) to compile & debug Z-Stack CC2530
I try to developp an application on microcontroller CC2530. So I have to use the debug mode but every times I use it, IAR allows me to set 1 or 2 breakpoint and sometimes none. It tells me : "Tue May 15 10:58:23 2012: Failed to set breakpoint: Driver error.". So do you know what is the problem ? Because normally, CC2530 have 4 hardware breakpoint. And I think I use hardware breakpoints with IAR, not software breakpoints no ?
Other problem, IAR tells me : "Tue May 15 15:59:07 2012: The stack 'XdataStack' is filled to 100% (4847 bytes used out of 4847). The warning threshold is set to 90.%", So I decided to increase the XDATA_STACK_SIZE but when I try to increase it, it shows me the folowing message :
Error[e16]: Segment XDATA_I (size: 0x1db align: 0) is too long for segment definition. At least 0x100 more bytes needed. The problem occurred while processing the segment placement command "-Z(XDATA)XDATA_Z,XDATA_I=_XDATA0_START-_XDATA0_END", where at the moment of placement the available memory ranges were "XDATA:1e25-1eff"qsd
Just for information, I develop my application on Eclispe and compile with the IAR compiler via Eclipse, next I download the program on the board and use IAR interface just for the debug step.
If someone can answer to one of my questions, it will be great ;)
Thanks for the answers,
I would recommend you to divide your problem in half and perhaps the solution on one half with give a head start to the other. I have not experience running IAR via Eclipse, so take Eclipse out of the problem and think about the solution to that one later. Now, compiling, downloading, and running directly from IAR, I have never seen your first error of breakpoint - please re-verifying in this IAR-only setup. The second breakpoint error is due to enter/exit PM2 or PM3. It is very difficult to debug with POWER_SAVING enabled and the idatastack full is a false warning and/or debugging out of sync due to power saving mode - turn off power saving for debugging (unless you think that your bug is only during power savings, in which case, it will be more tedious but not impossibe to debug). Finally, no more XDATA means you have declared too many/too big of RAM variables or call stack or heap, so reduce your use - there is only 8K-256 bytes available on this tiny, embedded SOC.
I can't test my code directly in IAR, because my application is a Component-based software, and I use a plugin of Eclipse as framework. This framework interpret my codes files, create the real code and use the IAR compiler to generate a file .d51.
Otherwise, I don't use the low power mode (PM2, PM3) at all !!! So I don't understand why all my data are saved in the XDATASTACK... Is there a way to force the compiler to put all the data or one part in another memory space (like idata) ?
Currently, I use not the banked mode for memory management. So when I need to increase my xdatastack, I have to modify my makefile in Eclipse to change the memory parameters, see below (it's an argument of the makefile command that launch the compilation) :
LD_ARGS_3="-D_IDATA_STACK_SIZE=0x40 -D_EXTENDED_STACK_START=0x00 -D_EXTENDED_STACK_SIZE=0x00 -D_PDATA_STACK_SIZE=0x80 -D_XDATA_STACK_SIZE=0x1800 -D_XDATA_HEAP_SIZE=0xFF -D_FAR_HEAP_SIZE=0xFFF -D_HUGE_HEAP_SIZE=0xFFF -D_FAR22_HEAP_SIZE=0xFFF"
And sometimes, when my codes files are modified, I have the folowing message in Eclipse :
Error[e16]: Segment XDATA_I (size: 0x1db align: 0) is too long for segment definition. At least 0x100 more bytes needed. The problem occurred while processing the segment placement command "-Z(XDATA)XDATA_Z,XDATA_I=_XDATA0_START-_XDATA0_END", where at the moment of placement the available memory ranges were "XDATA:1e25-1eff"
So it tells me that XdataStack is too big because there is no space enough for the other memory space. So I reduce the space associated to the _XDATA_STACK_SIZE parameter and it's ok. But in debug mode in IAR, I get the message below :
"Tue May 15 15:59:07 2012: The stack 'XdataStack' is filled to 100% (4847 bytes used out of 4847). The warning threshold is set to 90.%"
This message tells me that there is no space enough to store all the data. And when I click on ' View > Stack ', the XdataStack is red and completely full.
And I think, it could modify the execution of my program and change the result of my test, don't you think ?
Yes - you are playing with fire changing the parameters that you are changing and definetly could endanger the proper execution of the code. You have to be extremely careful and diligent when you are reducing the C-call stack space and I would simply not recommend it at all. Perhaps some of the 'huge' (relative to the tiny embedded processor RAM of 8KB) variables that you are adding to the RAM (aka XDATA) could just be temporary, dynamic variables created and freed with the osal_mem_alloc/osal_mem_free().
I strongly recommend you to stop and backup to an original sample application included with the Z-Stack installer. Get that up and running in your Eclipse framework/environment and get used to working with it and to see success. Then slowly, start to add your modifications and you will see what is causing you to exceed the available XDATA on the CC2530.
Unfortunately it's impossible for me to work only on IAR, so I tried to compile a Zstack project in banked mode on IAR and see all the command line used by IAR. I get all the parameters and use the same for my project in Eclipse. So I tried again the compilation via Eclipse and it works well, so I downloaded the code on the board and I start the debug phase. And when I run the debug, nothing appends, and when I stop the execution, the instruction pointer is on the first instruction of the disassembly view. The first time I tried the debug, I put a breakpoint on a function call and it goes on it but it didn't succeed to enter into, it goes to the next instruction. Finally, on a lot of part of the code, it is impossible to set breakpoint. I need help on this.
Thank's in advance,
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.