System hangs if I work without debugging tool

pdeflandre wrote on Thursday, May 22, 2008:

Hello,

I works for quite a while now with FreeRTOS, and I have made a design with an Atmel AT91SAM7X256. I had used for a starting point the lwIP_Demo_Rowley_ARM7 port, as I work with gcc on a Linux desktop.

I use several interrupts which interact with the OS by using the XX_from_ISR functions.
I use the following at91sam7x device : aic, emac, pwm, spi, timer, serial, dbgu, twi.

All was very friendly until I tried to use my new design without any developping device. I found then with some fears that if I disconnect my JTAG Olimex Arm-usb-ocd from my developping board, the system become very unstable. Sometimes it works for few seconds, sometimes it crash immediately.

Firstly, I check my task’s stack size, but it doesn’t seem to be undersized.

Secondly, I thought about some noise problem, or interrupt problems. I found there could be spurious interrupts and add a new interrupt handler to manage them. As I put a counter in it and as it has not solve my problem, I know now it must be something else.

As it is very difficult to analyse a problem which arise only when you haven’t debugging tools on the board, I am a little bit confuse.

Does anybody have some ideas on what I can check in my application. Any remarks or suggestions will be very useful for me.

Patrick

davedoors wrote on Thursday, May 22, 2008:

See - http://ccgi.rowley.co.uk/support/faq.php?do=article&articleid=52

pdeflandre wrote on Friday, May 23, 2008:

Hello davedoors,

I thank you for the link.

I try to attach to the target without reset it. It is a little bit different as Rowley tells to do it because I use Eclipse CDT IDE with Zylin CDT plugin.

My problem shouldn’t be a problem of target startup reset, as the target works sometime for a while before crashes. And the bank start is select by a non volatil bit which select a boot from flash. I manage to attach the openocd server to the target, and I check that this bit is correctly set when the “crash” appears.

In the same way, I haven’t any boot loader on my design, so it can’t be the problem’s reason.

When I use a telnet session for debugging with openocd, I can check that my target is block on a data abort or a fetch abort.

But I don’t manage to attach the target from a gdb session with Eclipse. There is no problem if I reset the target on connection, but if I only attach to the target, I can’t stop, step, resume the target. I think my Eclipse configuration isn’t as good as it should… So it is difficult to know from where my application crash.

I will try some new tests on Monday, as I could’nt work on it this afternoon.

Thanks for your help.

Patrick.

pdeflandre wrote on Monday, May 26, 2008:

So, I find my mistake.

I had inadvertently remove the AT91C_BASE_MC->MC_FMR register initialisation.

When I used my flash script loader, his value was set with an openocd command, and all seem’s to go well.

But if I make an hard reboot or a power on, the MC_FMR was cleared by default to 0x0000 0000, so the micro controller tried to run without any wait state on a 48 MHz master clock, which lead rapidly to a program or data abort.

Shame on me !