使用ccsv5.5版本
仿真c5535的板子,sizeof(int)是1,float是2,double也是2,用ccsv6版本仿真c5535会闪退,但是仿真c6713是没有问题的。有没有大神可以帮解决一下,让v5.5sizeof返回值正确或者让v6.0顺利仿真c5535都可以,跪谢!
已经尝试过使用int16_t但是sizeof是1,下面是main函数部分
- #include "codec2.h"
- #include
- #include
- #include
- #include
- //#include
- int main()
- {
- int mode;
- void *codec2;
- FILE *fin;
- FILE *fout;
- // short *buf;
- short *buf;
- unsigned char *bits;
- int nsam, nbit, nbyte, gray;
- int i = 0;
- char file_in1[40] = "E:\voice_test\nihao.raw";
- char file_out1[40] = "E:\voice_test\shengcheng\nihao_ccs.c2";
-
- mode = CODEC2_MODE_3200;
-
- fin = fopen(file_in1,"rb");
- fout = fopen(file_out1,"wb");
- codec2 = codec2_create(mode);
- nsam = 160;
- nbit = 64;
- buf = (short*)malloc(nsam*sizeof(short));
- nbyte = (nbit + 7) / 8;
- size_t j = sizeof(nsam);
- size_t k = sizeof(float);
- size_t h = sizeof(int32_t);
- size_t l = sizeof(char);
- bits = (unsigned char*)malloc(nbyte*sizeof(char));
- gray = 1;
- codec2_set_natural_or_gray(codec2, gray);
- while(fread(buf, sizeof(short), nsam, fin) == (size_t)nsam) {
- i++;
- codec2_encode_3200(codec2, bits, buf);
- fwrite(bits, sizeof(char), nbyte, fout);
- if (i == 10)
- i = 0;
- // if this is in a pipeline, we probably don't want the usual
- // buffering to occur
- if (fout == stdout) fflush(stdout);
- if (fin == stdin) fflush(stdin);
- }
- codec2_destroy(codec2);
- free(buf);
- free(bits);
- fclose(fin);
- fclose(fout);
- return 0;
- }