glabo

glabo

0个粉丝

7

问答

0

专栏

1

资料

glabo  发布于  2022-12-22 10:32:45
采纳率 0%
7个问答
1358

himix200编译器编译驱动,浮点数问题

 

平台:hi3531dv200
编译器:aarch64-himix200-linux

驱动部分代码:

  1. void txdrv_aublc_factory_set(AUBLC_T *pAublc)
  2. {
  3. uint32_t i;
  4. int16_t r_vhl, b_vhl;
  5. float f_val;
  6. txcra_iostream_mask((__CONST uint8_t *)&TXREG_AUBLC_INIT_TBL);
  7. for (i = 0; i < MAX_AUBLC_BUF_SIZE; i ++)
  8. {
  9. txcra_iostream_mask((__CONST uint8_t *)&TXREG_AUBLC_RGB_DIS_TBL);
  10. txcra_iostream_mask((__CONST uint8_t *)&TXREG_AUBLC_RGB_EN_TBL);
  11. g_aublc_rl_buf[i] = txcra_readrange(REG_AUBLC_R_VL, 0, 0x0A);
  12. g_aublc_rh_buf[i] = txcra_readrange(REG_AUBLC_R_VH, 0, 0x0A);
  13. g_aublc_gl_buf[i] = txcra_readrange(REG_AUBLC_G_VL, 0, 0x0A);
  14. g_aublc_gh_buf[i] = txcra_readrange(REG_AUBLC_G_VH, 0, 0x0A);
  15. g_aublc_bl_buf[i] = txcra_readrange(REG_AUBLC_B_VL, 0, 0x0A);
  16. g_aublc_bh_buf[i] = txcra_readrange(REG_AUBLC_B_VH, 0, 0x0A);
  17. }
  18. g_aublc_rl_buf[0] = txfunc_find_median_value((uint16_t *)g_aublc_rl_buf, MAX_AUBLC_BUF_SIZE, 16);
  19. g_aublc_rh_buf[0] = txfunc_find_median_value((uint16_t *)g_aublc_rh_buf, MAX_AUBLC_BUF_SIZE, 16);
  20. g_aublc_gl_buf[0] = txfunc_find_median_value((uint16_t *)g_aublc_gl_buf, MAX_AUBLC_BUF_SIZE, 16);
  21. g_aublc_gh_buf[0] = txfunc_find_median_value((uint16_t *)g_aublc_gh_buf, MAX_AUBLC_BUF_SIZE, 16);
  22. g_aublc_bl_buf[0] = txfunc_find_median_value((uint16_t *)g_aublc_bl_buf, MAX_AUBLC_BUF_SIZE, 16);
  23. g_aublc_bh_buf[0] = txfunc_find_median_value((uint16_t *)g_aublc_bh_buf, MAX_AUBLC_BUF_SIZE, 16);
  24. r_vhl = (g_aublc_gh_buf[0] - g_aublc_gl_buf[0]) - (g_aublc_rh_buf[0] - g_aublc_rl_buf[0]);
  25. b_vhl = (g_aublc_gh_buf[0] - g_aublc_gl_buf[0]) - (g_aublc_bh_buf[0] - g_aublc_bl_buf[0]);
  26. f_val = abs(r_vhl);
  27. if (r_vhl >= 0)
  28. {
  29. pAublc->r_gain = 0x80 - f_val / 1.600;
  30. }
  31. else
  32. {
  33. pAublc->r_gain = 0x80 + f_val / 1.478;
  34. }
  35. f_val = abs(b_vhl);
  36. if (b_vhl >= 0)
  37. {
  38. pAublc->b_gain = 0x80 - f_val / 1.600;
  39. }
  40. else
  41. {
  42. pAublc->b_gain = 0x80 + f_val / 1.478;
  43. }
  44. txcra_write(REG_RGBADC_GAINB, pAublc->b_gain);
  45. txcra_write(REG_RGBADC_GAINR, pAublc->r_gain);
  46. for (i = 0; i < MAX_AUBLC_BUF_SIZE; i ++)
  47. {
  48. txcra_iostream_mask((__CONST uint8_t *)&TXREG_AUBLC_RGB_DIS_TBL);
  49. txcra_iostream_mask((__CONST uint8_t *)&TXREG_AUBLC_RGB_EN_TBL);
  50. g_aublc_rm_buf[i] = txcra_readrange(REG_AUBLC_R_VM, 0, 0x0A);
  51. g_aublc_gm_buf[i] = txcra_readrange(REG_AUBLC_G_VM, 0, 0x0A);
  52. g_aublc_bm_buf[i] = txcra_readrange(REG_AUBLC_B_VM, 0, 0x0A);
  53. }
  54. g_aublc_rm_buf[0] = txfunc_find_median_value((uint16_t *)g_aublc_rm_buf, MAX_AUBLC_BUF_SIZE, 16);
  55. g_aublc_gm_buf[0] = txfunc_find_median_value((uint16_t *)g_aublc_gm_buf, MAX_AUBLC_BUF_SIZE, 16);
  56. g_aublc_bm_buf[0] = txfunc_find_median_value((uint16_t *)g_aublc_bm_buf, MAX_AUBLC_BUF_SIZE, 16);
  57. r_vhl = g_aublc_gm_buf[0] - g_aublc_rm_buf[0];
  58. b_vhl = g_aublc_gm_buf[0] - g_aublc_bm_buf[0];
  59. f_val = abs(r_vhl);
  60. if (r_vhl > 0)
  61. {
  62. pAublc->r_offset = 0x40 - f_val / 2.5;
  63. }
  64. else
  65. {
  66. pAublc->r_offset = 0x40 + f_val / 2.5;
  67. }
  68. f_val = abs(b_vhl);
  69. if (b_vhl > 0)
  70. {
  71. pAublc->b_offset = 0x40 - f_val / 2.5;
  72. }
  73. else
  74. {
  75. pAublc->b_offset = 0x40 + f_val / 2.5;
  76. }
  77. }

Makefile文件:

  1. export ARCH=arm64
  2. export CROSS_COMPILE=aarch64-himix200-linux-
  3. PWD := $(shell pwd)
  4. KERNDIR := /home/linux/nvr/Hi3531DV200_SDK_V2.0.0.3/osdrv/opensource/kernel/linux-4.19.y
  5. CONFIG_CV8988 := m
  6. #ccflags-y += -mfloat-softfp -mfpu=neon
  7. ifneq ($(KERNELRELEASE),)
  8. cv8988-objs += cv8988.o
  9. cv8988-objs += mtx_drv_aublc.o
  10. cv8988-objs += mtx_drv_comm.o
  11. cv8988-objs += mtx_drv_cra.o
  12. cv8988-objs += mtx_drv_mdt.o
  13. cv8988-objs += mtx_drv_modules.o
  14. cv8988-objs += mtx_lib_api.o
  15. cv8988-objs += TX_VESA_TIMING_TBL.o
  16. obj-$(CONFIG_CV8988) += cv8988.o
  17. else
  18. all:
  19. $(Q)$(MAKE) $(S) -C $(KERNDIR) M=$(PWD) modules
  20. clean:
  21. $(Q)$(MAKE) $(S) -C $(KERNDIR) M=$(PWD) clean
  22. endif
  23. .PHONY: all clean

编译报错:

  1. make -C /home/linux/nvr/Hi3531DV200_SDK_V2.0.0.3/osdrv/opensource/kernel/linux-4.19.y M=/home/linux/nvr/Hi3531DV200_SDK_V2.0.0.3/drv/extdrv/cv8988/cv8988_vga_decoder_sdk_v1.0_20211013 modules
  2. make[1]: 进入目录“/home/linux/nvr/Hi3531DV200_SDK_V2.0.0.3/osdrv/opensource/kernel/linux-4.19.y
  3. make[2]: 放弃循环依赖 /home/linux/nvr/Hi3531DV200_SDK_V2.0.0.3/drv/extdrv/cv8988/cv8988_vga_decoder_sdk_v1.0_20211013/cv8988.o <- /home/linux/nvr/Hi3531DV200_SDK_V2.0.0.3/drv/extdrv/cv8988/cv8988_vga_decoder_sdk_v1.0_20211013/cv8988.o
  4. CC [M] /home/linux/nvr/Hi3531DV200_SDK_V2.0.0.3/drv/extdrv/cv8988/cv8988_vga_decoder_sdk_v1.0_20211013/mtx_drv_aublc.o
  5. /home/linux/nvr/Hi3531DV200_SDK_V2.0.0.3/drv/extdrv/cv8988/cv8988_vga_decoder_sdk_v1.0_20211013/mtx_drv_aublc.c: In function 'txdrv_aublc_factory_set':
  6. /home/linux/nvr/Hi3531DV200_SDK_V2.0.0.3/drv/extdrv/cv8988/cv8988_vga_decoder_sdk_v1.0_20211013/mtx_drv_aublc.c:141:24: error: '-mgeneral-regs-only' is incompatible with floating-point code
  7. pAublc->r_gain = 0x80 - f_val/1.600 ;
  8. ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
  9. /home/linux/nvr/Hi3531DV200_SDK_V2.0.0.3/drv/extdrv/cv8988/cv8988_vga_decoder_sdk_v1.0_20211013/mtx_drv_aublc.c:141:24: error: '-mgeneral-regs-only' is incompatible with floating-point argument
  10. /home/linux/nvr/Hi3531DV200_SDK_V2.0.0.3/drv/extdrv/cv8988/cv8988_vga_decoder_sdk_v1.0_20211013/mtx_drv_aublc.c:141:24: error: '-mgeneral-regs-only' is incompatible with floating-point argument
  11. /home/linux/nvr/Hi3531DV200_SDK_V2.0.0.3/drv/extdrv/cv8988/cv8988_vga_decoder_sdk_v1.0_20211013/mtx_drv_aublc.c:141:24: error: '-mgeneral-regs-only' is incompatible with floating-point code
  12. /home/linux/nvr/Hi3531DV200_SDK_V2.0.0.3/drv/extdrv/cv8988/cv8988_vga_decoder_sdk_v1.0_20211013/mtx_drv_aublc.c:141:24: internal compiler error: Segmentation fault
  13. Please submit a full bug report,
  14. with preprocessed source if appropriate.
  15. See <https://gcc.gnu.org/bugs/> for instructions.
  16. make[2]: *** [scripts/Makefile.build:304:/home/linux/nvr/Hi3531DV200_SDK_V2.0.0.3/drv/extdrv/cv8988/cv8988_vga_decoder_sdk_v1.0_20211013/mtx_drv_aublc.o] 错误 1
  17. make[1]: *** [Makefile:1524_module_/home/linux/nvr/Hi3531DV200_SDK_V2.0.0.3/drv/extdrv/cv8988/cv8988_vga_decoder_sdk_v1.0_20211013] 错误 2
  18. make[1]: 离开目录“/home/linux/nvr/Hi3531DV200_SDK_V2.0.0.3/osdrv/opensource/kernel/linux-4.19.y
  19. make: *** [Makefile:22all] 错误 2

我尝试添加以下编译选项,去解决问题,又提示我没有识别到这两个编译选项
ccflags-y += -mfloat-softfp -mfpu=neon

请问是否是编译器的问题,如何解决呢?

我来回答
回答4个
时间排序
认可量排序

UncleRoderick

32个粉丝

14

问答

1

专栏

14

资料

UncleRoderick 2022-12-22 13:31:14
认可0

内核里面默认是不支持浮点运算的,可以参考这个文章试试,如果不行就只能改用应用层做了。
https://blog.csdn.net/jinking01/article/details/128246594

glabo
glabo   回复   UncleRoderick  2022-12-22 13:48:38
0

感谢您的回复,刚才尝试了一下没有效果!

UncleRoderick
UncleRoderick   回复   glabo  2022-12-23 09:15:59
0

没效果的话那就只能用应用层驱动处理了

glabo

0个粉丝

7

问答

0

专栏

1

资料

glabo 2022-12-23 16:48:39
认可0

解决方法是去掉了内核得编译选项,但是是否会存在其它问题还需要进一步验证

或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币

Markdown 语法

  • 加粗**内容**
  • 斜体*内容*
  • 删除线~~内容~~
  • 引用> 引用内容
  • 代码`代码`
  • 代码块```编程语言↵代码```
  • 链接[链接标题](url)
  • 无序列表- 内容
  • 有序列表1. 内容
  • 缩进内容
  • 图片![alt](url)
+ 添加网盘链接/附件

Markdown 语法

  • 加粗**内容**
  • 斜体*内容*
  • 删除线~~内容~~
  • 引用> 引用内容
  • 代码`代码`
  • 代码块```编程语言↵代码```
  • 链接[链接标题](url)
  • 无序列表- 内容
  • 有序列表1. 内容
  • 缩进内容
  • 图片![alt](url)
举报反馈

举报类型

  • 内容涉黄/赌/毒
  • 内容侵权/抄袭
  • 政治相关
  • 涉嫌广告
  • 侮辱谩骂
  • 其他

详细说明

易百纳技术社区