- MFC 52259 Demo Board
- MQX 3.5
- Code Warrior 7.2
Application: A TCP server application that initialises RTCS, binds the interface to an IP address and listens for connections requests on a specific TCP port and makes a blocking accept call waiting for connections.
Problem description: When a client application sends a connection request, the "accept" call returns and a successful connection is established on which further communication is also successful. However, if application logic is built into the project causing its ELF file size to increase beyond 1499 kBytes, "accept" stops responding to connection requests and never returns. After doing some tests I have confirmed that:
- the application logic itself does not make any difference as long as the total code size is below 1499 kB
- Even if the code size is 1500 kB, the accept call stops working. From this I have concluded that this problem is related to the code size itself.
Can someone give me pointers? Is this a license problem (I do not think so since my program compiles fine)? Does the RTCS library bundled with MQX have some limitation?
Thanks for the help.
After doing some more experiments we have noticed that the problem has nothing to do with the code size. It rather has something to do with the total size of Global variables in the program. We wrote a test program with RTCS and added to this programs an array of integers with about 10,000 elements. Prior to adding of this array, "accept" worked fine. But after the array was added it stopped working. We reduced the size of this array by about 2000 elements and accept started working. In what way can global data affect RTCS?
I did never use MQX, so I don't know any specifics. But the description sounds as if you have a stack overflow issue, no? If so I would expect it to fail when using huge locals when calling accept. How to configure the stack in MQX, well I don't know.
Thanks for responding. In this case we know its not an issue with the stack because our "large arrays" are global and not local. There is something else that's affecting the RTCS stack operation.
As the size of global variables increases, then heap is moving towards the stack area. Because mqx_kernal_data and heap is kept after the bss and data section and stack is at the end of ram. please check the LCF file.
MQX+Application is not considering the stack size mentioned from the linker. Stack is growing independently.
and because of this code may be crashing. Please check after accept call MQX is working or not, or you are resetting the board.