HardFault in Tasks.c when using IAR 6.50

Hello, I’ve noticed an “interesting” issue that I am simply unable to trackdown/resolve. I am working on ST’s example LwIPUDPTCPEchoServerNetconn_RTOS. If I compile it using IAR 7.40 everything works fine YET when I compile the same code using IAR 6.50 I get an HardFault. Using LR (from the stack on HardFault) I’ve been able to track down the problem to a macro in FreeRTOStasks.c (which seems to run from memory, hence the address). Since I can put a breakpoint I added a debug variable to find the problematic line. If I try to debug further (adding more debug code) the location of the hard-fault changes.. Can’t figure out how to track it down, in the vast RTOS/LwIp code.. Any advice? Also worth mentioning, the error occurs when I plug the ethernet cable and LwIP lowlevelinput is constantly being called. [Relevant code] taskSELECTHIGHESTPRIORITYTASK() …
df=5; listGET
OWNEROFNEXT_ENTRY( pxCurrentTCB, &( pxReadyTasksLists[ uxTopReadyPriority ] ) ); df=6; … (Can’t figure out how to insert code! :/ ) [Hard fault handler] R0 = 20008a8a R1 = fffffff1 R2 = 20000000 R3 = 20009f68 R12 = 1b8049 LR = 20009f70 PC = 1400 PSR = 8004337 BFAR = 1b804d CFSR = 8200 HFSR = 40000000 DFSR = b AFSR = 0

HardFault in Tasks.c when using IAR 6.50

We find it extremely difficult to provide free support for lwIP, especially when the integration has been performed by somebody else. That is why we introduced our own TCP/IP stack. In this case the first thing I suggest you do is a complete rebuild – make sure there are absolutely no object or dependency files created by IAR 7.4 left anywhere before clean building with IAR V6.x. If that does not help, look through IAR’s change history to see if that provides any clues. Next try without lwIP being used/called. If you still have a problem, use IAR V7.4. Regards.

HardFault in Tasks.c when using IAR 6.50

Make sure you use the C start up code and linker script from IAR 6 when using IAR 6 and the same from IAR 7 when using IAR 7.

HardFault in Tasks.c when using IAR 6.50

Not sure why my first replay wasn’t posted.. 2nd Try 🙂 Thank you Dave and RTE team for you reply. I tried another clean build with the startup code from IAR 6.50, exact same failure at the same point. I was actually considering rewrite my code to use FreeRTOS+TCP/IP stack and and the new FatFS. I will be happy to port the code for STM32F4* (and their eval board) but someone will need to help me to bridge my current knowledge gap.. (with some guidance and technical support). I need to use 6.50 as that’s the license I own, an upgrade will cost almost as much as a new license which is somethign I cannot afford.. I use size limit license with 7.40 only to test the code provided by ST (removed TCP to squeeze it in :))

HardFault in Tasks.c when using IAR 6.50

No one? :/

HardFault in Tasks.c when using IAR 6.50

It is not easy to support older IAR versions as we cannot run the code. Did you try running without lwIP and looking through the IAR release notes as previously suggested? We have FreeRTOS+TCP and FreeRTOS+FAT running on an STM32F4 already, the project needs updating since the last labs release though – it is in line though and will get released as soon as we get the chance. Regards.

HardFault in Tasks.c when using IAR 6.50

Hi Ariel,
No one?
I’m afraid that’s a very difficult question you’re asking. In the past I have seen crashes in all of the FreeRTOS modules: list, tasks, queue. And that was always my own fault 🙂 In most cases there was some memory corruption, a stack overflow, things like that. Compiler 6.50 shows a problem and 7.40 works OK. Maybe 6.50 needs just a bit more stack space for some operations.
I will be happy to port the code for STM32F4*
There is a NetworkInterface.c for STM32F407 that works fine. Regards, Hein

HardFault in Tasks.c when using IAR 6.50

I did check it and replied to it, on my first iteration 🙂 Without LwIP (/before plugging the Ethernet cable) RTOS is working fine, the Blinky thread, blinks. Can I get the older, unupdated, version? where can I find it?

HardFault in Tasks.c when using IAR 6.50

Hi Hein, As fun as it is to blame the compiler it’s undoubtedly my fault. Yet its based on a very basic sample code.. I did try to increase the Stack and Heap. It wasn’t it.. In the package I downloaded F4 wasn’t implemented. I will look at it again.