The demo app is not working for me

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • The demo app is not working for me

    I'm trying to run the Segger demo application for the Renesas M32C (Start_M32C) with the IAR tools and I'm having some problems.

    Since our eval board isn't here yet, I'm using the PC simulator as a target (Cspy-Sim build).

    The basic problem is that the tasks never run again after calling the OS_Delay function (i.e. it successfully runs through main, calls each of the two tasks once, and falls into the idle loop - and then stays there forever). I looked at the OS_Time variable with the watch window and it is incrementing as it should be.

    A few extra bits of information that could be a part of the problem:

    1) When I open the Start_M32C.ewp workspace, it tells me that this file is in an old format and must be converted to work with the current version fo IAR.

    2) The code builds fine, but when I hit the debug button I get a message that says "Warning: Marco __orderInterrupt not possible to execute due to the following reason: No device description file selected. Interrupt simulation is unavailable". I can hit OK on this popup and run the code - and I get the behavior I described above.

    3) I can get rid of the error from #2 above if I go into the project options and select the specific device I'm intending to use (M30873FH) instead of the 'Generic M32C' that it starts out with - but the behavior of only calling the tasks once each is the same. I do get a new error in the debug log, though: Thu Oct 02 16:45:37 2008: The stack pointer for stack 'CSTACK' (currently Memory:0x816) is outside the stack range (Memory:0x400 to Memory:0x500)


    Any advice? It's troubling that I can't even get the basic demo to work! ;(
  • Hello Kaiser,

    I guess the problem is that the C Spy macro does not work. Without the correct C Spy macro no interrupts will be simulated and w/o the timer interrupt
    the OS can not work (that is why OS_Time is always 0). There are often changes in newer IAR versions, so the macro seems not to work with your IAR version, perhaps the syntax is now different.
    Regarding your questions #3:
    IAR has a stack check plugin, but it does not work correctly with embOS because it checks only if the stack pointer is in the range of the CSTACK (0x400 -0x500 in your case). If a task is running, the stack pointer points outside the CSTACK into the task stack. You can disable the plugin in the project settings.

    You should post here some additional information, the Segger staff will then help you.
    1. Which IAR Version do you use?
    2. Which embOS version do you use?

    Regards,
    Daniel
  • Segger embOS version: 3.50

    Here is the version info for IAR (They've got many pages of version info - this is just the first few that seem the most relevant):
    IAR CSpyBat
    5.0.3.300.7006 (5.0.3.300)

    IAR Build Utility
    5.0.3.300.7006 (5.0.3.300)

    IAR Embedded Workbench IDE
    5.0.3.300.7006 (5.0.3.300)

    IAR Assembler for M32C
    3.21A/W32 (3.21.1.4)

    IAR C/C++ Compiler for M32C
    3.21A/W32 (3.21.1.4)
  • Hi,
    I looked into the problem and tried to reproduce it.
    There are two problems.
    1. By converting the project, the target CPU specific setting got lost and an "M32C generic" is selected as device.
    This causes the error meesage, that the "__orderinterrupt()" could not be executed, because there is no device deescription file selected for a generic device.
    2. The CSPY simulation macro does not work, because the simulated interrupt is held pending indefinitly.
    From time to time, the definition of parameter for simulated interrupts change in the IAR interrupt simulation.
    Here comes the solution:
    1.
    In the project settings select the real device which should be simulated.
    "Project -> Options -> General options -> Target -> Device"
    2.
    Modify the macro file "CSpy.mac" which is used for simulation as follows:
    execUserSetup()
    {
    __message "\nCSpy.mac: embOS M32C Simulator macros\n";
    __disableInterrupts();
    __cancelAllInterrupts();
    __orderInterrupt ("TIMER_A0", 500000, 5000, 0, 0, 0, 100);
    __message "\nCSpy.mac: Generating interrupts TA0 for embOS every 5000 cycles\n";
    __enableInterrupts();
    }

    About the CSTACK:

    Daniel is right, the stack check plugin normally looks whether the stack pointer points into the CSTACK area, which is not the case when a task it running.
    The stack check plugin could be configured, but this is difficult, because all stack areas have to be passed via special parameter.
    As the location of the task stacks may change after every build, the required setup has to be modified after every build.
    As embOS comes with its own stack check, there is no need to use the IAR stack check plugin, it should be disabled.
    Regards,
    Armin