- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For some reason this code gets stuck at sprintf in debug mode. Any tips?
#include <project.h>
#include <stdio.h>
int main()
{
CyGlobalIntEnable; /* Enable global interrupts. */
UART_Start();
char* str;
sprintf(str, "Hello");
for(;;)
{
UART_UartPutString(str);
}
}
Solved! Go to Solution.
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Set heap size to 0x0200 (in cydwr System), set use newlib nano (build settings Linker)and allow for float formatting.
You defined str to be a pointer to char, but you did not allocate any memory for your string.
Better define
char str[80]; // Maximum line length
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Set heap size to 0x0200 (in cydwr System), set use newlib nano (build settings Linker)and allow for float formatting.
You defined str to be a pointer to char, but you did not allocate any memory for your string.
Better define
char str[80]; // Maximum line length
Bob