Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bsp] add null CCFLAGS for Nuclei bsps #5851

Merged
merged 2 commits into from
Apr 21, 2022

Conversation

blta
Copy link
Contributor

@blta blta commented Apr 21, 2022

[
具体描述见#5841
我试了芯来,RT-Thread Stuido,和github上的RiSC-V,均编译不过。按照rtthread-stdudio生成rvstart工程的rtconfing.py调整SConstruct如下

--- a/bsp/nuclei/gd32vf103_rvstar/SConstruct
+++ b/bsp/nuclei/gd32vf103_rvstar/SConstruct
@@ -23,7 +23,7 @@ AddOption('--run',
 DefaultEnvironment(tools=[])
 env = Environment(tools = ['mingw'],
     AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
-    CC = rtconfig.CC, CFLAGS = rtconfig.CFLAGS,
+    CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
     CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
     AR = rtconfig.AR, ARFLAGS = '-rc', LIBS = rtconfig.LIBS,
     LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)

可以正常编译,scons --run debug 下载后,正常运行。
]

以下的内容不应该在提交PR时的message修改,修改下述message,PR会被直接关闭。请在提交PR后,浏览器查看PR并对以下检查项逐项check,没问题后逐条在页面上打钩。
The following content must not be changed in the submitted PR message. Otherwise, the PR will be closed immediately. After submitted PR, please use a web browser to visit PR, and check items one by one, and ticked them if no problem.

当前拉取/合并请求的状态 Intent for your PR

必须选择一项 Choose one (Mandatory):

  • 本拉取/合并请求是一个草稿版本 This PR is for a code-review and is intended to get feedback
  • 本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo

代码质量 Code Quality:

我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:

  • 已经仔细查看过代码改动的对比 Already check the difference between PR and old code
  • 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other styles
  • 没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
  • 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
  • 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
  • 本拉取/合并请求代码是高质量的 Code in this PR is of high quality
  • 本拉取/合并使用formatting等源码格式化工具确保格式符合RT-Thread代码规范 This PR complies with RT-Thread code specification

@mysterywolf
Copy link
Member

你的代码里用到C++的东西了吗

@mysterywolf
Copy link
Member

CFLAGS 是只给C文件设置的,CCFLAG是即给C又给C++设置,CXXFLAG是只给C++设置

@mysterywolf
Copy link
Member

这个是之前特意改成了CFLAG的 #5397

@blta
Copy link
Contributor Author

blta commented Apr 21, 2022

当前的BSP CI 没有检测该bsp

你的代码里用到C++的东西了吗

这个应该是芯来或者你们提交的BSP,里面没有C++, 但和rtthread studio生成的工程一样,必须配置成CCFLAGS
另外一个gd32vf103v-eval bsp倒是正常的,它在rtconfing.py里面配置了一些关于报错的CFLAGS选项

DEVICE = ' -march=rv32imac -mabi=ilp32 -DUSE_PLIC -DUSE_M_TIME -DNO_INIT -mcmodel=medany -msmall-data-limit=8 -L.  -nostartfiles  -lc '
CFLAGS = DEVICE
CFLAGS += ' -save-temps=obj'

然后SConstruct 无需更改

env = Environment(tools = ['mingw'],
    AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
    CC = rtconfig.CC, CFLAGS = rtconfig.CFLAGS,
    AR = rtconfig.AR, ARFLAGS = '-rc',

我尝试配置成一样,但是一直不成功,你们可以再看下。所以现在提交的是rtthread studio生成工程的方案

@mysterywolf
Copy link
Member

你用scons编译能过嘛?

@blta
Copy link
Contributor Author

blta commented Apr 21, 2022

现在就是Scons编译测试的,未改前一直报这个错

> scons
scons: Reading SConscript files ...
Supported downloaded modes for board gd32vf103v_rvstar are flashxip, chosen downloaded mode is flashxip
Newlib version:4.1.0
scons: done reading SConscript files.
scons: Building targets ...
scons: building associated VariantDir targets: build
CC build\applications\main.o
riscv-nuclei-elf-gcc: error:  -march=rv32imac -mabi=ilp32 -mcmodel=medany : No such file or directory
scons: *** [build\applications\main.o] Error 1
scons: building terminated because of errors.

原工程有个 LIBS 配置,我去掉了scons还是报一样的错

    LFLAGS  += ' -Wl,-cref,-Map=rtthread.map '
    LFLAGS  += ' -u _isatty -u _write -u _sbrk -u _read -u _close -u _fstat -u _lseek '
    CPATH   = ''
    LPATH   = ''
    LIBS = ['stdc++']

@mysterywolf
Copy link
Member

@Guozhanxin 郭老师看一下这个呗

@Guozhanxin
Copy link
Member

Guozhanxin commented Apr 21, 2022

我看了下,他的sdk里有追加 CCFLAGS 的操作,其实这里放一个空的配置项就好了。
image

@Guozhanxin
Copy link
Member

我看了下,他的sdk里有追加 CCFLAGS 的操作,其实这里放一个空的配置项就好了。 image

把这个目录下的另一个bsp也改一下吧,我看也有一样的问题。

@blta
Copy link
Contributor Author

blta commented Apr 21, 2022

实测可以的,板子运行正常

@blta blta changed the title [bsp] fix gd32vf103_rvstar building issue [bsp] add null CCFLAGS for Nuclei bsps Apr 21, 2022
@Guozhanxin Guozhanxin added the +1 Agree +1 label Apr 21, 2022
@blta
Copy link
Contributor Author

blta commented Apr 21, 2022

另外nuclei的bsp是不是没放进ci里测试?

@Guozhanxin
Copy link
Member

另外nuclei的bsp是不是没放进ci里测试?

是的,应该是工具链不通用,没加进来吧。你也可以试着加一下

@blta
Copy link
Contributor Author

blta commented Apr 21, 2022

另外nuclei的bsp是不是没放进ci里测试?

是的,应该是工具链不通用,没加进来吧。你也可以试着加一下

我看了gd32vf103v-eval bsp 在CI里,应该和编译器没关系,我试过通用的risc-v gcc 10.2.0也可正常编译。这个CI的配置是不是不在这个仓库里,开放的吗?我有空试一下

@Guozhanxin
Copy link
Member

另外nuclei的bsp是不是没放进ci里测试?

是的,应该是工具链不通用,没加进来吧。你也可以试着加一下

我看了gd32vf103v-eval bsp 在CI里,应该和编译器没关系,我试过通用的risc-v gcc 10.2.0也可正常编译。这个CI的配置是不是不在这个仓库里,开放的吗?我有空试一下

gd32vf103v-eval bsp 的ci是这样定义的。

- {RTT_BSP: "gd32vf103v-eval", RTT_TOOL_CHAIN: "sourcery-riscv-none-embed"}

如果要用通用的工具链的话,就要改下rtconfig.py的内容了。

@Guozhanxin Guozhanxin merged commit 04fe623 into RT-Thread:master Apr 21, 2022
@blta blta mentioned this pull request Apr 29, 2022
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
+1 Agree +1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants