Hi, everyone,
I am developing a TCP/IP application based on the sample telnet2ser. My problem is only about printf function.
At the main task function, my printf is used well. But when the program goes to "_mqx_int lw_telnet_server(void (_CODE_PTR_ user_fn)(void))" function and call "printf("hello");" as the first statement, the MQX is in ISR and has a endless loop in idle task, with nothing displayed in the console.
I have traced the printf and found that the only different between the error and correct is around as the following figure.
The problem is focused on "tmp = (char) c". This statement will change the file_ptr->SIZE or other element in struct file_ptr except file_ptr->DEV_PTR. And then when it goes into _io_serial_polled_write function in serl_pol.c, the fd_ptr struct always has wrong values but its address is the same as the correct procedure.
Please give me some help. I can't get out of here anymore. Please!
Could Anybody help me?
more findings here. the temporary variable "char tmp" did get address 0x1FFF0E80. and the address of "file_ptr" is 0x1FFF0E6C.
After that, when it has changed "tmp"s value, the element's value in struct file_ptr would changed ,then MQX goes to IDLE TASK.
How can I resolve this?