Kevin Curtis

M5474 Seg Fault Issues

Discussion created by Kevin Curtis on Aug 22, 2011
Latest reply on Sep 3, 2011 by Angelo Dureghello


    we have a M5474 Coldfire based system with a synchronous serial port connected via the Flex Bus.  We are using the Ltib toolset from ltib-cflinux-2010019 to build our rootfs.  We have a number of custom processes running on the board.  Some of them make system() calls to execute commands, for example


    system("ps -eaf > /tmp/process_list.log");


This system command is executed on a regular basis.  We started noticing stability problems where processes that made these calls would terminate with a segfault.


After a lot of debugging time we are sure that the problem is related to the interrupts to the coldfire processor generated by the synch serial port that we are using.  The system will run fine while while there are no sync serial interrupts.


We have narrowed this down further by writing a simple program that repeatedly calls the above system command every second or so, and a very simple driver that claims the interrupt.  The interrupt is now being driven from an external clock source at a rate of about 1 every 16ms.  The ISR makes a access to one of the sync serial port registers and then clears the interrupt at the coldfire level.


This very simple test setup is enough to cause a segfault in the test application, or one of the child processes forked to execute the ps command.


We have also noted that if we don't make any access in the ISR to the sync port registers then there isn't an issue.


We have seen references in the forum about calls to vfork() being an issue, but we believe that in this case the Kernel is using fork().


We think it is an issue with register access from within the ISR.  But at the interrupt rates that we need to support, we don't think that deferring the interrupt processing to a bottom half is a viable solution.



Has anyone else had this issue?

Is there a know resolution that I have missed?


Thanks and Regards