Skip to content

如何分别给 c代码和 C++代码设定编译参数 #4844

@Guozhanxin

Description

@Guozhanxin

按照下面这种写法,先把 CFlags 赋值给 CXXFlags,然后再单独给 CFlag 添加参数。编译时,新添加的参数仍然会传递给 CXX 编译器。
bsp: stm32-f429-apollo
编译器:armclang.

elif PLATFORM == 'armclang':
    # toolchains
    CC = 'armclang'
    CXX = 'armclang'
    AS = 'armasm'
    AR = 'armar'
    LINK = 'armlink'
    TARGET_EXT = 'axf'

    DEVICE = ' --cpu Cortex-M4.fp '
    CFLAGS = ' --target=arm-arm-none-eabi -mcpu=cortex-m4 '
    CFLAGS += ' -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 '
    CFLAGS += ' -mfloat-abi=hard -c -fno-rtti -funsigned-char -fshort-enums -fshort-wchar '
    CFLAGS += ' -gdwarf-3 -ffunction-sections '
    AFLAGS = DEVICE + ' --apcs=interwork '
    LFLAGS = DEVICE + ' --info sizes --info totals --info unused --info veneers '
   ...
    CXXFLAGS = CFLAGS
    CFLAGS += ' -std=c99'

    POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions