- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I've studied the Printing Floating Values using FX3 SDK – KBA231244 and its example project.
I've modified my C project with:
1. Followed example project to modify the system's fx3.ld & my project's cyfxtx.c.
2. Added "#include <sys/unistd.h>" & "#include <stdio.h>" in my project.
But show error: sbrkr.c:(.text+0x18): undefined reference to `_sbrk'
I knew the article said: The Sprintf() function internally calls the _sbrk system call. Add the definition of _sbrk, from the cyfxcppsyscall.cpp file (available in the BulkLoopAutoCpp project in the FX3 SDK), to the firmware.
However, I cannot find the cyfxcppsyscall.cpp in my C project, so I don't know how to modify it.
PS. I found the cyfxcppsyscall.cpp in the same directory as the fx3.ld, and it's content has already added the _sbrk function.
Does the cyfxcppsyscall.cpp cause the issue? If yes, how to implement it on C project?
Any help will be highly appreciated!
Hughes
Solved! Go to Solution.
- Labels:
-
USB Superspeed Peripherals
- Tags:
- fx3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Hughes,
However, I cannot find the cyfxcppsyscall.cpp in my C project, so I don't know how to modify it.
>> You can find the cyfxcppsyscall.cpp in the BulkLoopAutoCpp firmware of the FX3 SDK (attachment)
Please let me know if you are using the fx3.ld file and cyfxtx.c file attached with the KBA
PS. I found the cyfxcppsyscall.cpp in the same directory as the fx3.ld, and it's content has already added the _sbrk function.
>>Please let me know if _sbrk definition is copied to the main source file of your firmware (.c file) from cyfxcppsyscall.cpp file
Does the cyfxcppsyscall.cpp cause the issue? If yes, how to implement it on C project?
>> You can refer to the project attached with the KBA
Rashi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Hughes,
However, I cannot find the cyfxcppsyscall.cpp in my C project, so I don't know how to modify it.
>> You can find the cyfxcppsyscall.cpp in the BulkLoopAutoCpp firmware of the FX3 SDK (attachment)
Please let me know if you are using the fx3.ld file and cyfxtx.c file attached with the KBA
PS. I found the cyfxcppsyscall.cpp in the same directory as the fx3.ld, and it's content has already added the _sbrk function.
>>Please let me know if _sbrk definition is copied to the main source file of your firmware (.c file) from cyfxcppsyscall.cpp file
Does the cyfxcppsyscall.cpp cause the issue? If yes, how to implement it on C project?
>> You can refer to the project attached with the KBA
Rashi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Rashi:
Thanks for your reply! I've solved this issue!
By the way, I'm curious about heap memory which we created for sprintf( ).
The original memory has allocated the RTOS heap area(32KB), and I can use CyU3PMemAlloc( ).
What's the different between the two heap?
Thanks!
Hughes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Hughes,
In the KBA, second stage bootloader area is used for allocating runtime heap for sprintf() function as second stage bootloader memory area is used only when the application uses second stage bootloader.
RTOS Heap Area is used by the RTOS provided heap allocator. This is used by CyU3PMemInit(), CyU3PMemAlloc(), CyU3PMemFree(). So, in order to avoid conflict, it is good to use memory area like second stage bootloader (if the application doesn't use it).
Rashi