cancel
Showing results for 
Search instead for 
Did you mean: 

Thread suspended after sleep...

ruben23
Associate II
Posted on April 29, 2011 at 17:30

Thread suspended after sleep...

12 REPLIES 12
Posted on May 17, 2011 at 14:33

It really shouldn't be at address zero, the code's typically not compiled for that address. Make sure the NVIC vectors have been changed to point to FLASH. Try it with a more professional JTAG like a Segger J-Link in case it is an issue with the ST-LINK or it's drivers. Check you have current firmware/drivers for the ST-LINK.

Contact Atollic's technical support.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ruben23
Associate II
Posted on May 17, 2011 at 14:33

Thank you very much for your time and your answer.

I asked to atollic and I suppose (and hope) I'll get a response. I'm pretty sure it's related with wfi instruction, and looking for a bug, any configuration consideration I missed, or anything else...

The JTAG works fine for us til now, then I want to discard (by the moment) this problem, and hope to be successful.

I'll post the solution when I'll find it, maybe is useful for somebody because I can't find anything in forums related.

Greetings,

Rubén.

 

ruben23
Associate II
Posted on May 17, 2011 at 14:33

Has anyone had a problem related with Reset_Handler()?

I see that when return from sleep calls Reset_Handler() and console makes reference to first line of assembler code in startup_stm32f10x_md.s file.

In fact, if I make software reset, same thing happens...

Searching by forums I found a post where somebod coments (I think clive) a problem with StandBy wake up. Do you think it could be related?

Posted on May 17, 2011 at 14:33

Well, if you have indeed put the device into STANDBY, the exit from that will reset the processor, as will a watchdog reset. You can identify the type of reset by checking the flags, ie PWR_GetFlagStatus(PWR_FLAG_SB)

I have assumed to this point you are just sleeping (halting in classical terms) in an idle task looping on __WFI

The other possibility is that you haven't set up the debug unit so it doesn't dump the debugger connection on SLEEP, STOP, STANDBY, WATCHDOG, etc.

    /* Keep debugger connection during SLEEP (debugging) */

   DBGMCU_Config(DBGMCU_SLEEP, ENABLE);

    /* IWDG stopped when core is halted (debugging) */

    DBGMCU_Config(DBGMCU_IWDG_STOP, ENABLE);

/**

  * @brief  Configures the specified peripheral and low power mode behavior

  *   when the MCU under Debug mode.

  * @param  DBGMCU_Periph: specifies the peripheral and low power mode.

  *   This parameter can be any combination of the following values:

  *     @arg DBGMCU_SLEEP: Keep debugger connection during SLEEP mode

  *     @arg DBGMCU_STOP: Keep debugger connection during STOP mode

  *     @arg DBGMCU_STANDBY: Keep debugger connection during STANDBY mode

  *     @arg DBGMCU_IWDG_STOP: Debug IWDG stopped when Core is halted

  *     @arg DBGMCU_WWDG_STOP: Debug WWDG stopped when Core is halted

  *     @arg DBGMCU_TIM1_STOP: TIM1 counter stopped when Core is halted

  *     @arg DBGMCU_TIM2_STOP: TIM2 counter stopped when Core is halted

  *     @arg DBGMCU_TIM3_STOP: TIM3 counter stopped when Core is halted

  *     @arg DBGMCU_TIM4_STOP: TIM4 counter stopped when Core is halted

  *     @arg DBGMCU_CAN1_STOP: Debug CAN2 stopped when Core is halted

  *     @arg DBGMCU_I2C1_SMBUS_TIMEOUT: I2C1 SMBUS timeout mode stopped when Core is halted

  *     @arg DBGMCU_I2C2_SMBUS_TIMEOUT: I2C2 SMBUS timeout mode stopped when Core is halted

  *     @arg DBGMCU_TIM5_STOP: TIM5 counter stopped when Core is halted

  *     @arg DBGMCU_TIM6_STOP: TIM6 counter stopped when Core is halted

  *     @arg DBGMCU_TIM7_STOP: TIM7 counter stopped when Core is halted

  *     @arg DBGMCU_TIM8_STOP: TIM8 counter stopped when Core is halted

  *     @arg DBGMCU_CAN2_STOP: Debug CAN2 stopped when Core is halted

  *     @arg DBGMCU_TIM15_STOP: TIM15 counter stopped when Core is halted

  *     @arg DBGMCU_TIM16_STOP: TIM16 counter stopped when Core is halted

  *     @arg DBGMCU_TIM17_STOP: TIM17 counter stopped when Core is halted

  *     @arg DBGMCU_TIM9_STOP: TIM9 counter stopped when Core is halted

  *     @arg DBGMCU_TIM10_STOP: TIM10 counter stopped when Core is halted

  *     @arg DBGMCU_TIM11_STOP: TIM11 counter stopped when Core is halted

  *     @arg DBGMCU_TIM12_STOP: TIM12 counter stopped when Core is halted

  *     @arg DBGMCU_TIM13_STOP: TIM13 counter stopped when Core is halted

  *     @arg DBGMCU_TIM14_STOP: TIM14 counter stopped when Core is halted

  * @param  NewState: new state of the specified peripheral in Debug mode.

  *   This parameter can be: ENABLE or DISABLE.

  * @retval None

  */

void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState)

{

  /* Check the parameters */

  assert_param(IS_DBGMCU_PERIPH(DBGMCU_Periph));

  assert_param(IS_FUNCTIONAL_STATE(NewState));

  if (NewState != DISABLE)

  {

    DBGMCU->CR |= DBGMCU_Periph;

  }

  else

  {

    DBGMCU->CR &= ~DBGMCU_Periph;

  }

}

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ruben23
Associate II
Posted on May 17, 2011 at 14:33

Yes to both, debug bits were set, and I halt the processor using just WFI in a idle loop.

I tried to delete the WFI to debug (I must say that micro don't works also in 'run' mode, flashing it and running alone), and same problem occurs (?!). I thouth then there was a problem with interrupts...But if I put a breakpoint in the line that crashes program runs right (except by the thing that I have to stop in this line 'yes or yes'...).

Till now, Atollic support just told me that be sure that ST_Link is upgraded and GDB_server is the right version.

I tried a simplier program, and works fine, as soon Iadd WFI and program crashes with APPCRASH...

Posted on May 17, 2011 at 14:33

I've used Keil/Realview, IAR and Rowley over the years, I found Atollic (Lite) to be a painful experience. Suggest you try a Keil or IAR demo.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ruben23
Associate II
Posted on May 17, 2011 at 14:33

Yes, I've been trying to configure eclipse and Keil in parallel.

With eclipse I have problems too, and have to use optimize flags and get some strange behaviours and finally I got same results...If I don't optimize size code doesn't fit. Should I suppose that Atollic use a very good algorithm to remove death code? Because is too large the code that doesn't fit! Maybe I missed some in configuration in eclipse, but I'll have same problems than with Atollic (in the end, is the same thing with a little 'make-up'...).

I installed the Keil, but I have to modify too many things, that are not warning or error in atollic, and Keil don't allow to do...I also installed CrossWorks (Rowley) and likes more than Keil, but has the same problem, program doesn't fit in FLASH.

The program that fits with Atollic, doesn't fits with Rowley:

''.text is too large  to fit in FLASH memory segment''

''.dtors is too large  to fit in FLASH memory segment''

''.ctors is too large  to fit in FLASH memory segment''

''.data is too large  to fit in FLASH memory segment''

etc...  :?

ruben23
Associate II
Posted on May 17, 2011 at 14:33

Now I'm trying to use Rowley, it seems that works (veeery slowly when debugs, don't know why yet), and I'm trying to get eclipse environment compiles removing unused code, because seems that works better than atollic (?????!!!!!). At least, till now don't crashes with small apps, I'll see... Maybe is a greater solution, and for free...

Well, I just write to thanks for your help and the time you shared!

Rubén.
Posted on May 17, 2011 at 14:33

I installed the Keil, but I have to modify too many things, that are not warning or error in atollic, and Keil don't allow to do...

 

I've only seen it do this with particularly sloppy or unportable code. For example defining variables in the middle of a compound statement, or using un-named unions/structs. Resolving them, Lint, or GNU/GCC -Wall type warnings/alerts generally results in much more solid and portable code.

As to code size and optimization, Keil has a compiler tab to control the optimization levels and optimize for time. The ''one ELF section per function'' may also help the linker with dead function elimination. I've always found Keil to do a significantly better job than GNU/GCC in generating compact executable code.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..