undefined reference to `_sbrk' when using atof() function
Hi,
I am trying to cast a string as a float in a function, I was successfully able to cast a string as an integer in the same function and I can compile the code without any errors as long as I comment out the atof() part.
my code is:
void cmd_color(
(void)argv;
float fx, fy;
char test[20];
strcpy(test, "123.456");
//test = 123.456;
// fx = atof(argv[0]);
fy = atof(test);
fx = 4.8;
// fy = 2.4;
chprintf(chp, "String values = %s , %s . Float values = %f , %f\r\n", argv[0], argv[1], fx, fy);
// Color(atof(x), atof(y));
//Color(
FindValues();
//printing ratios of the 3 primary LEDs
chprintf(chp, "Ratio of Red LED is %f \r\n", Ratior());
chprintf(chp, "Ratio of Green LED is %f \r\n", Ratiog());
chprintf(chp, "Ratio of Blue LED is %f \r\n", Ratiob());
}
the above code has been modified from its original context in order to try and debug it, my final aim/goal is to read two variable length strings argv[0] and argv[1] and use them as inputs for the function Color which takes two floats.
the compiler outputs this:
Compiling console.c
console.c:18:30: warning: 'chp' defined but not used [-Wunused-variable]
Linking build/ch.elf
/Users/
sbrkr.c:
collect2: error: ld returned 1 exit status
make: *** [build/ch.elf] Error 1
I am using a make file provided to me by ChibiOS which is an embedded RTOS and has worked without any problems until now.
my version of arm gcc is 4.7.4 which has been downloaded from this website.
any suggestions would be massively appreciated as this error is driving me nuts!
Question information
- Language:
- English Edit question
- Status:
- Answered
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Maskari for more information if necessary.