Browse Source

keil支持全局勾选GNU扩展

Meco Man 3 years ago
parent
commit
945ad1324e
4 changed files with 3 additions and 9 deletions
  1. 0 4
      rt-thread/README.md
  2. 0 4
      rt-thread/README_ZH.md
  3. 3 1
      rt-thread/SConscript
  4. BIN
      rt-thread/assets/mdk.png

+ 0 - 4
rt-thread/README.md

@@ -30,10 +30,6 @@ The specific path in RT-Thread ENV package manager is as follows:
 Then let the RT-Thread package manager automatically update, or use the
 `pkgs --update` command to update the package to the BSP.
 
-**Note:** For use in Keil MDK, please use the **ARM Clang** compiler or manually check **GNU Extensions** in the compile options.
-
-![MDK](./assets/mdk.png)
-
 ### 1.2 RT-Thread Studio
 
 Search for `TinyUSB` in RT-Thread Settings to add the package to the project.

+ 0 - 4
rt-thread/README_ZH.md

@@ -30,10 +30,6 @@ RT-Thread ENV 包管理器中的路径如下:
 然后让 RT-Thread 的包管理器自动更新,或者使用 `pkgs --update`
 命令更新包到 BSP 中。
 
-**注意:** 在 Keil MDK 中使用时,请选择 **ARM Clang** 编译器,或手动在编译选项中选中 **GNU Extensions**
-
-![MDK](./assets/mdk.png)
-
 ### 1.2、RT-Thread Studio
 
 在 RT-Thread Settings 中搜索 `TinyUSB` 即可将软件包添加至工程中。

+ 3 - 1
rt-thread/SConscript

@@ -47,13 +47,15 @@ if GetDepend(["PKG_TINYUSB_DEVICE_EXAMPLE_CDC"]):
 if GetDepend(["PKG_TINYUSB_DEVICE_EXAMPLE_HID"]):
     src += ["example/hid_example.c"]
   
+CXXFLAGS = ''
 LOCAL_CFLAGS = ''
 
 if rtconfig.PLATFORM == 'gcc' or rtconfig.PLATFORM == 'armclang': # GCC or Keil AC6
     LOCAL_CFLAGS += ' -std=c99'
 elif rtconfig.PLATFORM == 'armcc': # Keil AC5
+    CXXFLAGS = ' --gnu' # enable global GNU extension support for the whole project
     LOCAL_CFLAGS += ' --c99 --gnu'
     
-group = DefineGroup('TinyUSB', src, depend = ['PKG_USING_TINYUSB'], CPPPATH = path, LOCAL_CFLAGS = LOCAL_CFLAGS)
+group = DefineGroup('TinyUSB', src, depend = ['PKG_USING_TINYUSB'], CPPPATH = path, LOCAL_CFLAGS = LOCAL_CFLAGS, CXXFLAGS = CXXFLAGS)
 
 Return('group')

BIN
rt-thread/assets/mdk.png