Всем доброго времени суток. В общем пишу себе какое-то подобие ftoa(). Но прям большое множество ошибок, похожих на те когда функции нету в тулчейне, но опознать не могу. Да и такую пачку в гугл не закинешь =)
вызываю так
Ошибки такие:
Причем если просто прировнять
C++:
unsigned char ftoa (char *array,unsigned char size, float f, unsigned char accurancy){
unsigned char len = 0;
char buff1[5]="";
char buff2[5]="";
//len = size/sizeof(array[0]);
int integer = (int)f;
float buff3 = f-integer;
buff3 = buff3*10;
int fractional = (int)buff3;
itoa(integer,buff1,10);
itoa(fractional,buff2,10);
strcat(array,buff1);
strcat(array,".");
strcat(array,buff2);
return 0;
}
C++:
char lal[15] = "";
float lal2 = 2.52;
unsigned char m = 2;
ftoa(lal,sizeof(lal),lal2,m);
PHP:
Severity Code Description Project File Line Column
Error Test.elf section `.text.avrlibc.fplib%33' will not fit in region `text' Test 1 1
Error Could not allocate section .text.avrlibc.fplib, size = 10 bytes, attributes = code Test addsf3.o 0 0
Error recipe for target 'Test.elf' failed Test C:\Users\Evgeniy\Documents\Atmel Studio\7.0\Test\Test\Debug\Makefile 106 1
Warning unused variable 'len' [-Wunused-variable] Test C:\Users\Evgeniy\Documents\Atmel Studio\7.0\Test\Test\main.c 108 16
Error ld returned 1 exit status Test collect2.exe 0 0
Error Could not allocate section .text, size = 2 bytes, attributes = code Test D:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATtiny_DFP/1.8.332/xc8/avr/lib/avr25/tiny-stack/memx-const/crtattiny2313.o 0 0
Error Could not allocate section .text.avrlibc.fplib, size = 10 bytes, attributes = code Test fixsfsi.o 0 0
Error Could not allocate section .text.avrlibc.fplib, size = 6 bytes, attributes = code Test fp_nan.o 0 0
Error Could not allocate section .text.avrlibc.fplib, size = 14 bytes, attributes = code Test fp_pscA.o 0 0
Error Could not allocate section .text.avrlibc.fplib, size = 14 bytes, attributes = code Test fp_pscB.o 0 0
Error Could not allocate section .text.avrlibc.fplib, size = 34 bytes, attributes = code Test fp_round.o 0 0
Error Could not allocate section .text.avrlibc.fplib, size = 14 bytes, attributes = code Test fp_zero.o 0 0
Error Could not allocate section .text.avrlibc, size = 20 bytes, attributes = code Test itoa_ncheck.o 0 0
Error Could not allocate section .text.SendHalfByte, size = 46 bytes, attributes = code Test main.o 0 0
Error Could not allocate section .text.millis, size = 30 bytes, attributes = code Test main.o 0 0
Error Could not allocate section .text.lcd_clear, size = 20 bytes, attributes = code Test main.o 0 0
Error Could not allocate section .text.setPos, size = 18 bytes, attributes = code Test main.o 0 0
Error Could not allocate section .text.avrlibc.fplib, size = 4 bytes, attributes = code Test mulsf3.o 0 0
Error Could not allocate program memory Test RUNCOMPILERTASK 0 0
Error Could not allocate section .text.avrlibc, size = 46 bytes, attributes = code Test strcat_M.o 0 0
Error Could not allocate section .text.avrlibc, size = 32 bytes, attributes = code Test strrev.o 0 0
Error Could not allocate section .text.avrlibc, size = 50 bytes, attributes = code Test utoa_ncheck.o 0 0
int fractional = 5;
то все выведеться коректно, в данном случае на дислпее будет 2.5. Тоесть если я правильно понял то загвозка только с дробной частью, а именно с её преобразованиями.