STM32-E407 + ARM-USB-TINY + OpenOCD Stack problem

Started by mi41514, February 04, 2013, 10:00:27 AM

Previous topic - Next topic

mi41514

Hi,

I have successfully programed and debugged my chip many times with toolchain from subject (IAR 6.30.6 + OpenOCD 0.6.1) and everything worked just fine.

Then something went wrong. After download IAR threw a warning:  "Warning: Stack pointer is setup to incorrect alignment. Stack addr = 0xFFFFFFFF".

I couldn't debug normally my code and breakpoints didn't work also. OpenOCD started setting xPSR to incorrect address when I tried to download a program to flash.

As I sad, I haven't change anything in toolchain or in project options.

I really appreciate any help you can provide.
Marko 

LubOlimex

Hey Marko,

To identify whether the problem is hardware or software (project options, etc) it is a good idea to try uploading the example available at our web site: https://www.olimex.com/Products/ARM/ST/STM32-E407/resources/STM32-E_revB1_demo.zip

Another thing you might try is to use the ODS IDE distributed for free by us: https://www.olimex.com/Products/ARM/JTAG/_resources/OpenOCD/. It has a simple blinking LED example for STM32-E407 inside. Here is a picture of my test with a similar board (STM32-H407): http://i.imgur.com/NWaSrXy.png. I actually had better results with the ODS than with the IAR GDB server (when stopping the debug session it didn't perform software reset of the board which caused the connection to drop).

I've also deleted your other thread in JTAG sub-forum. Please respond here how it goes.

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex

mi41514

Quote from: LubOlimex on February 05, 2013, 11:40:48 AM
To identify whether the problem is hardware or software (project options, etc) it is a good idea to try uploading the example available at our web site: https://www.olimex.com/Products/ARM/ST/STM32-E407/resources/STM32-E_revB1_demo.zip

I've already tried that but I didn't manage to download image correctly from IAR. Before that strange problem I didn't have any difficulties with downloading and debugging from IAR (STM32-E_revB1_demo.zip and my code).

Quote from: LubOlimex on February 05, 2013, 11:40:48 AM
Another thing you might try is to use the ODS IDE

I would like to use IAR because I use it at work and I'm used to it. Also, everything worked fine so I would like to find solution for my problem.

As a matter a fact, I have already found a workaround for my problem. While I was searching for solution I came across on link https://forum.sparkfun.com/viewtopic.php?p=67685

I'll try to explain procedure that works for me...

I took the STM32-E_revB1_demo.zip and erased all files except ST library, board specific files, startup file and main. I also deleted all code from main.c and left only SysInit and empty while(1) loop. The idea was mainly to initialize interrupt vectors.

After that I programed my Project.bin image to flash via telnet. Then I tried download it trough IAR couple of times and everything worked fine. Info window looked like on http://i.imgur.com/0lKDKBs.jpg.

Then I downloaded successfully my CODE from IAR and finally I was able to debug it! But...after that I tried once more and error popped up again! You can see that on http://i.imgur.com/FW5n3d7.jpg http://i.imgur.com/Aet57AD.jpg

Then I tried to download from IAR my "empty" code and got the same error. Then I tried once again and I managed to download it without errors. After that I was able to program my code.

Conclusion:

To debug my code (let we say that I have my "empty code" downloaded to flash) trough IAR I have to do next steps:

Program my code and debug it. If I want to change something and download it again I have to do next:

1. Download my "empty code" for the first time. (Stack warning)
2. Download my "empty code" for second time. (No warnings no errors and debugging works fine)
3. Download my code. (No warnings no errors and debugging works fine)
4. If I have to change something and then debug it--> jump to step 1

I would also like to ask how can I set CSTACK starting address to top of the RAM 0x20020000 in startup.s file

because as I can see it is not set to that address by default.

Thank you!

Best regards,
Marko