-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2 UARTs not working with gcc arm embedded #687
Comments
ARM Internal Ref: IOTMORF-309 |
I have tested the above example on NUCLEO_L053R8 with the following to see if this issue is still valid:
So, yes this issue is still valid... Tested also with NUCLEO_L073RZ
|
@kegilbert HI - thanks for sharing the info. can you share the build instructions you've used ? @0xc0170 - any idea about the below changes behind using mbed5 vs mbed2 and would be related to printf ? |
Some further findings: |
Here is what I see now: That would most probably explain why the later calls to pc2.printf() to not actually reach the serial port, because there is no registered file to actually map to it. The rootcause for fopen to fail seems to be a memory restriction as I have checked the errno and it is positioned to ENOMEM. @ks73
|
+1 for adding a check. Why does it fail? Not enough memory thus it fails via allocating new space on the heap ? |
Ok I'll try to add a check. about error, I checked ENOMEM was the error but I haven't checked the details behind. |
The following sample code does not work as expected when compiled with gcc arm embedded. Only the first UART (pc) outputs data as expected, there is no output on the second UART.
When stepping through the initialization of the serial objects I noticed that in the Stream.cpp constructor std::fopen only succeeds for the first call (that from Serial pc). The second instance (pc2) fails to initialitze because fopen returns 0, so that there are no correct function pointers in place for the subsequent calls to pc2.printf / putc.
I compiled this example also with the online compiler and it works correctly. The target ist STM32L053 Nucleo board.
The text was updated successfully, but these errors were encountered: