diff --git a/bsp/stm32/stm32f091-st-nucleo/SConstruct b/bsp/stm32/stm32f091-st-nucleo/SConstruct index c120f925df4ab8d990e5e95e2fe56b1d671a93b9..7979e3a23ed06d9558cf03e7108fa9249ff9ef78 100644 --- a/bsp/stm32/stm32f091-st-nucleo/SConstruct +++ b/bsp/stm32/stm32f091-st-nucleo/SConstruct @@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'], AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, AR = rtconfig.AR, ARFLAGS = '-rc', + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) env.PrependENVPath('PATH', rtconfig.EXEC_PATH) diff --git a/bsp/stm32/stm32f091-st-nucleo/board/linker_scripts/link.lds b/bsp/stm32/stm32f091-st-nucleo/board/linker_scripts/link.lds index 5f371f6694f0e3b38a7fd52eaa1187d908da000e..a137112572d3ad10ac3147e85ec89a2d14e01692 100644 --- a/bsp/stm32/stm32f091-st-nucleo/board/linker_scripts/link.lds +++ b/bsp/stm32/stm32f091-st-nucleo/board/linker_scripts/link.lds @@ -46,6 +46,14 @@ SECTIONS __rt_init_end = .; . = ALIGN(4); + + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + + . = ALIGN(4); + _etext = .; } > ROM = 0 @@ -72,6 +80,11 @@ SECTIONS *(.data.*) *(.gnu.linkonce.d*) + PROVIDE(__dtors_start__ = .); + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + PROVIDE(__dtors_end__ = .); + . = ALIGN(4); /* This is used by the startup in order to initialize the .data secion */ _edata = . ; diff --git a/bsp/stm32/stm32f091-st-nucleo/rtconfig.py b/bsp/stm32/stm32f091-st-nucleo/rtconfig.py index c4d744f4f3d888af50a278e44098828a082c9655..3c8992f7d01582ecc40216354adbb9fabafdd849 100644 --- a/bsp/stm32/stm32f091-st-nucleo/rtconfig.py +++ b/bsp/stm32/stm32f091-st-nucleo/rtconfig.py @@ -44,7 +44,7 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' DEVICE = ' -mcpu=cortex-m0 -mthumb -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -std=c99 -Dgcc' + CFLAGS = DEVICE + ' -Dgcc' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' @@ -57,11 +57,15 @@ if PLATFORM == 'gcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' elif PLATFORM == 'armcc': # toolchains CC = 'armcc' + CXX = 'armcc' AS = 'armasm' AR = 'armar' LINK = 'armlink' @@ -85,11 +89,15 @@ elif PLATFORM == 'armcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' elif PLATFORM == 'iar': # toolchains CC = 'iccarm' + CXX = 'iccarm' AS = 'iasmarm' AR = 'iarchive' LINK = 'ilinkarm' @@ -130,5 +138,7 @@ elif PLATFORM == 'iar': LFLAGS = ' --config "board/linker_scripts/link.icf"' LFLAGS += ' --entry __iar_program_start' + CXXFLAGS = CFLAGS + EXEC_PATH = EXEC_PATH + '/arm/bin/' POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' diff --git a/bsp/stm32/stm32f103-atk-nano/SConstruct b/bsp/stm32/stm32f103-atk-nano/SConstruct index 05326b2b755fed11adc30f979ea01faf8bb5cfd6..27b5e7fccce3302bc36debeac6842b661a04a663 100644 --- a/bsp/stm32/stm32f103-atk-nano/SConstruct +++ b/bsp/stm32/stm32f103-atk-nano/SConstruct @@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'], AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, AR = rtconfig.AR, ARFLAGS = '-rc', + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) env.PrependENVPath('PATH', rtconfig.EXEC_PATH) diff --git a/bsp/stm32/stm32f103-atk-nano/board/linker_scripts/link.lds b/bsp/stm32/stm32f103-atk-nano/board/linker_scripts/link.lds index 74d06fdc5757a3c990b76e04aefa2fab47d78400..c1923d786ec208a204dd2fff41756ba705b392fd 100644 --- a/bsp/stm32/stm32f103-atk-nano/board/linker_scripts/link.lds +++ b/bsp/stm32/stm32f103-atk-nano/board/linker_scripts/link.lds @@ -46,6 +46,14 @@ SECTIONS __rt_init_end = .; . = ALIGN(4); + + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + + . = ALIGN(4); + _etext = .; } > ROM = 0 @@ -72,6 +80,11 @@ SECTIONS *(.data.*) *(.gnu.linkonce.d*) + PROVIDE(__dtors_start__ = .); + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + PROVIDE(__dtors_end__ = .); + . = ALIGN(4); /* This is used by the startup in order to initialize the .data secion */ _edata = . ; diff --git a/bsp/stm32/stm32f103-atk-nano/rtconfig.py b/bsp/stm32/stm32f103-atk-nano/rtconfig.py index 40826ac99e18049c751f057ab72c8c53c0cdd13c..91aba6247859efa22ee160d54fa2fe6ade2ca528 100644 --- a/bsp/stm32/stm32f103-atk-nano/rtconfig.py +++ b/bsp/stm32/stm32f103-atk-nano/rtconfig.py @@ -44,7 +44,7 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' DEVICE = ' -mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -std=c99 -Dgcc' + CFLAGS = DEVICE + ' -Dgcc' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' @@ -57,11 +57,15 @@ if PLATFORM == 'gcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' elif PLATFORM == 'armcc': # toolchains CC = 'armcc' + CXX = 'armcc' AS = 'armasm' AR = 'armar' LINK = 'armlink' @@ -85,11 +89,15 @@ elif PLATFORM == 'armcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' elif PLATFORM == 'iar': # toolchains CC = 'iccarm' + CXX = 'iccarm' AS = 'iasmarm' AR = 'iarchive' LINK = 'ilinkarm' @@ -129,6 +137,8 @@ elif PLATFORM == 'iar': LFLAGS = ' --config "board/linker_scripts/link.icf"' LFLAGS += ' --entry __iar_program_start' + + CXXFLAGS = CFLAGS EXEC_PATH = EXEC_PATH + '/arm/bin/' POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' diff --git a/bsp/stm32/stm32f103-atk-warshipv3/SConstruct b/bsp/stm32/stm32f103-atk-warshipv3/SConstruct index 05326b2b755fed11adc30f979ea01faf8bb5cfd6..27b5e7fccce3302bc36debeac6842b661a04a663 100644 --- a/bsp/stm32/stm32f103-atk-warshipv3/SConstruct +++ b/bsp/stm32/stm32f103-atk-warshipv3/SConstruct @@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'], AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, AR = rtconfig.AR, ARFLAGS = '-rc', + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) env.PrependENVPath('PATH', rtconfig.EXEC_PATH) diff --git a/bsp/stm32/stm32f103-atk-warshipv3/board/linker_scripts/link.lds b/bsp/stm32/stm32f103-atk-warshipv3/board/linker_scripts/link.lds index 52ffe5e45946c959b283bedd3de9826ec54426f5..f1bc84f8f1a7e072f7d332fcfc7c44dee6fa512d 100644 --- a/bsp/stm32/stm32f103-atk-warshipv3/board/linker_scripts/link.lds +++ b/bsp/stm32/stm32f103-atk-warshipv3/board/linker_scripts/link.lds @@ -46,6 +46,14 @@ SECTIONS __rt_init_end = .; . = ALIGN(4); + + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + + . = ALIGN(4); + _etext = .; } > ROM = 0 @@ -72,6 +80,11 @@ SECTIONS *(.data.*) *(.gnu.linkonce.d*) + PROVIDE(__dtors_start__ = .); + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + PROVIDE(__dtors_end__ = .); + . = ALIGN(4); /* This is used by the startup in order to initialize the .data secion */ _edata = . ; diff --git a/bsp/stm32/stm32f103-atk-warshipv3/rtconfig.py b/bsp/stm32/stm32f103-atk-warshipv3/rtconfig.py index 40826ac99e18049c751f057ab72c8c53c0cdd13c..c6d16622da8a2f0014ed8749ebd90a09ced91d69 100644 --- a/bsp/stm32/stm32f103-atk-warshipv3/rtconfig.py +++ b/bsp/stm32/stm32f103-atk-warshipv3/rtconfig.py @@ -44,7 +44,7 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' DEVICE = ' -mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -std=c99 -Dgcc' + CFLAGS = DEVICE + ' -Dgcc' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' @@ -57,11 +57,15 @@ if PLATFORM == 'gcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' elif PLATFORM == 'armcc': # toolchains CC = 'armcc' + CXX = 'armcc' AS = 'armasm' AR = 'armar' LINK = 'armlink' @@ -85,11 +89,15 @@ elif PLATFORM == 'armcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' elif PLATFORM == 'iar': # toolchains CC = 'iccarm' + CXX = 'iccarm' AS = 'iasmarm' AR = 'iarchive' LINK = 'ilinkarm' @@ -130,5 +138,7 @@ elif PLATFORM == 'iar': LFLAGS = ' --config "board/linker_scripts/link.icf"' LFLAGS += ' --entry __iar_program_start' + CXXFLAGS = CFLAGS + EXEC_PATH = EXEC_PATH + '/arm/bin/' POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' diff --git a/bsp/stm32/stm32f103-dofly-lyc8/SConstruct b/bsp/stm32/stm32f103-dofly-lyc8/SConstruct index c28354a99db6725b666ec6eee89d3d4100034b9d..c4c95cfdb86f9aa8611cb3cac355ed39ae3557f2 100644 --- a/bsp/stm32/stm32f103-dofly-lyc8/SConstruct +++ b/bsp/stm32/stm32f103-dofly-lyc8/SConstruct @@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'], AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, AR = rtconfig.AR, ARFLAGS = '-rc', + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) env.PrependENVPath('PATH', rtconfig.EXEC_PATH) diff --git a/bsp/stm32/stm32f103-dofly-lyc8/board/linker_scripts/link.lds b/bsp/stm32/stm32f103-dofly-lyc8/board/linker_scripts/link.lds index f9fdaf17c55b38763972a4188a81bbb3cf4ca482..22e29d2ed7435ed117ea2e42ada2d1c15d687092 100644 --- a/bsp/stm32/stm32f103-dofly-lyc8/board/linker_scripts/link.lds +++ b/bsp/stm32/stm32f103-dofly-lyc8/board/linker_scripts/link.lds @@ -46,6 +46,14 @@ SECTIONS __rt_init_end = .; . = ALIGN(4); + + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + + . = ALIGN(4); + _etext = .; } > ROM = 0 @@ -72,6 +80,11 @@ SECTIONS *(.data.*) *(.gnu.linkonce.d*) + PROVIDE(__dtors_start__ = .); + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + PROVIDE(__dtors_end__ = .); + . = ALIGN(4); /* This is used by the startup in order to initialize the .data secion */ _edata = . ; diff --git a/bsp/stm32/stm32f103-dofly-lyc8/rtconfig.py b/bsp/stm32/stm32f103-dofly-lyc8/rtconfig.py index 40826ac99e18049c751f057ab72c8c53c0cdd13c..91aba6247859efa22ee160d54fa2fe6ade2ca528 100644 --- a/bsp/stm32/stm32f103-dofly-lyc8/rtconfig.py +++ b/bsp/stm32/stm32f103-dofly-lyc8/rtconfig.py @@ -44,7 +44,7 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' DEVICE = ' -mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -std=c99 -Dgcc' + CFLAGS = DEVICE + ' -Dgcc' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' @@ -57,11 +57,15 @@ if PLATFORM == 'gcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' elif PLATFORM == 'armcc': # toolchains CC = 'armcc' + CXX = 'armcc' AS = 'armasm' AR = 'armar' LINK = 'armlink' @@ -85,11 +89,15 @@ elif PLATFORM == 'armcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' elif PLATFORM == 'iar': # toolchains CC = 'iccarm' + CXX = 'iccarm' AS = 'iasmarm' AR = 'iarchive' LINK = 'ilinkarm' @@ -129,6 +137,8 @@ elif PLATFORM == 'iar': LFLAGS = ' --config "board/linker_scripts/link.icf"' LFLAGS += ' --entry __iar_program_start' + + CXXFLAGS = CFLAGS EXEC_PATH = EXEC_PATH + '/arm/bin/' POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' diff --git a/bsp/stm32/stm32f103-fire-arbitrary/SConstruct b/bsp/stm32/stm32f103-fire-arbitrary/SConstruct index 05326b2b755fed11adc30f979ea01faf8bb5cfd6..27b5e7fccce3302bc36debeac6842b661a04a663 100644 --- a/bsp/stm32/stm32f103-fire-arbitrary/SConstruct +++ b/bsp/stm32/stm32f103-fire-arbitrary/SConstruct @@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'], AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, AR = rtconfig.AR, ARFLAGS = '-rc', + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) env.PrependENVPath('PATH', rtconfig.EXEC_PATH) diff --git a/bsp/stm32/stm32f103-fire-arbitrary/board/linker_scripts/link.lds b/bsp/stm32/stm32f103-fire-arbitrary/board/linker_scripts/link.lds index 52ffe5e45946c959b283bedd3de9826ec54426f5..28d8239542217b38d0c4dc183271a2415bc95a91 100644 --- a/bsp/stm32/stm32f103-fire-arbitrary/board/linker_scripts/link.lds +++ b/bsp/stm32/stm32f103-fire-arbitrary/board/linker_scripts/link.lds @@ -46,6 +46,14 @@ SECTIONS __rt_init_end = .; . = ALIGN(4); + + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + + . = ALIGN(4); + _etext = .; } > ROM = 0 @@ -72,6 +80,11 @@ SECTIONS *(.data.*) *(.gnu.linkonce.d*) + PROVIDE(__dtors_start__ = .); + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + PROVIDE(__dtors_end__ = .); + . = ALIGN(4); /* This is used by the startup in order to initialize the .data secion */ _edata = . ; diff --git a/bsp/stm32/stm32f103-fire-arbitrary/rtconfig.py b/bsp/stm32/stm32f103-fire-arbitrary/rtconfig.py index 40826ac99e18049c751f057ab72c8c53c0cdd13c..91aba6247859efa22ee160d54fa2fe6ade2ca528 100644 --- a/bsp/stm32/stm32f103-fire-arbitrary/rtconfig.py +++ b/bsp/stm32/stm32f103-fire-arbitrary/rtconfig.py @@ -44,7 +44,7 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' DEVICE = ' -mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -std=c99 -Dgcc' + CFLAGS = DEVICE + ' -Dgcc' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' @@ -57,11 +57,15 @@ if PLATFORM == 'gcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' elif PLATFORM == 'armcc': # toolchains CC = 'armcc' + CXX = 'armcc' AS = 'armasm' AR = 'armar' LINK = 'armlink' @@ -85,11 +89,15 @@ elif PLATFORM == 'armcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' elif PLATFORM == 'iar': # toolchains CC = 'iccarm' + CXX = 'iccarm' AS = 'iasmarm' AR = 'iarchive' LINK = 'ilinkarm' @@ -129,6 +137,8 @@ elif PLATFORM == 'iar': LFLAGS = ' --config "board/linker_scripts/link.icf"' LFLAGS += ' --entry __iar_program_start' + + CXXFLAGS = CFLAGS EXEC_PATH = EXEC_PATH + '/arm/bin/' POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' diff --git a/bsp/stm32/stm32f103-hw100k-ibox/SConstruct b/bsp/stm32/stm32f103-hw100k-ibox/SConstruct index 05326b2b755fed11adc30f979ea01faf8bb5cfd6..27b5e7fccce3302bc36debeac6842b661a04a663 100644 --- a/bsp/stm32/stm32f103-hw100k-ibox/SConstruct +++ b/bsp/stm32/stm32f103-hw100k-ibox/SConstruct @@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'], AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, AR = rtconfig.AR, ARFLAGS = '-rc', + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) env.PrependENVPath('PATH', rtconfig.EXEC_PATH) diff --git a/bsp/stm32/stm32f103-hw100k-ibox/board/linker_scripts/link.lds b/bsp/stm32/stm32f103-hw100k-ibox/board/linker_scripts/link.lds index 52ffe5e45946c959b283bedd3de9826ec54426f5..01ebc4164b02d618ee59309a1978d1bfd5d5bed5 100644 --- a/bsp/stm32/stm32f103-hw100k-ibox/board/linker_scripts/link.lds +++ b/bsp/stm32/stm32f103-hw100k-ibox/board/linker_scripts/link.lds @@ -46,6 +46,14 @@ SECTIONS __rt_init_end = .; . = ALIGN(4); + + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + + . = ALIGN(4); + _etext = .; } > ROM = 0 @@ -72,6 +80,11 @@ SECTIONS *(.data.*) *(.gnu.linkonce.d*) + PROVIDE(__dtors_start__ = .); + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + PROVIDE(__dtors_end__ = .); + . = ALIGN(4); /* This is used by the startup in order to initialize the .data secion */ _edata = . ; diff --git a/bsp/stm32/stm32f103-hw100k-ibox/rtconfig.py b/bsp/stm32/stm32f103-hw100k-ibox/rtconfig.py index 40826ac99e18049c751f057ab72c8c53c0cdd13c..c6d16622da8a2f0014ed8749ebd90a09ced91d69 100644 --- a/bsp/stm32/stm32f103-hw100k-ibox/rtconfig.py +++ b/bsp/stm32/stm32f103-hw100k-ibox/rtconfig.py @@ -44,7 +44,7 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' DEVICE = ' -mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -std=c99 -Dgcc' + CFLAGS = DEVICE + ' -Dgcc' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' @@ -57,11 +57,15 @@ if PLATFORM == 'gcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' elif PLATFORM == 'armcc': # toolchains CC = 'armcc' + CXX = 'armcc' AS = 'armasm' AR = 'armar' LINK = 'armlink' @@ -85,11 +89,15 @@ elif PLATFORM == 'armcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' elif PLATFORM == 'iar': # toolchains CC = 'iccarm' + CXX = 'iccarm' AS = 'iasmarm' AR = 'iarchive' LINK = 'ilinkarm' @@ -130,5 +138,7 @@ elif PLATFORM == 'iar': LFLAGS = ' --config "board/linker_scripts/link.icf"' LFLAGS += ' --entry __iar_program_start' + CXXFLAGS = CFLAGS + EXEC_PATH = EXEC_PATH + '/arm/bin/' POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' diff --git a/bsp/stm32/stm32f103-mini-system/SConstruct b/bsp/stm32/stm32f103-mini-system/SConstruct index 05326b2b755fed11adc30f979ea01faf8bb5cfd6..27b5e7fccce3302bc36debeac6842b661a04a663 100644 --- a/bsp/stm32/stm32f103-mini-system/SConstruct +++ b/bsp/stm32/stm32f103-mini-system/SConstruct @@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'], AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, AR = rtconfig.AR, ARFLAGS = '-rc', + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) env.PrependENVPath('PATH', rtconfig.EXEC_PATH) diff --git a/bsp/stm32/stm32f103-mini-system/board/linker_scripts/link.lds b/bsp/stm32/stm32f103-mini-system/board/linker_scripts/link.lds index f9fdaf17c55b38763972a4188a81bbb3cf4ca482..22e29d2ed7435ed117ea2e42ada2d1c15d687092 100644 --- a/bsp/stm32/stm32f103-mini-system/board/linker_scripts/link.lds +++ b/bsp/stm32/stm32f103-mini-system/board/linker_scripts/link.lds @@ -46,6 +46,14 @@ SECTIONS __rt_init_end = .; . = ALIGN(4); + + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + + . = ALIGN(4); + _etext = .; } > ROM = 0 @@ -72,6 +80,11 @@ SECTIONS *(.data.*) *(.gnu.linkonce.d*) + PROVIDE(__dtors_start__ = .); + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + PROVIDE(__dtors_end__ = .); + . = ALIGN(4); /* This is used by the startup in order to initialize the .data secion */ _edata = . ; diff --git a/bsp/stm32/stm32f103-mini-system/rtconfig.py b/bsp/stm32/stm32f103-mini-system/rtconfig.py index 40826ac99e18049c751f057ab72c8c53c0cdd13c..a839777aef5501292f9178cff8fd97afd8c38af5 100644 --- a/bsp/stm32/stm32f103-mini-system/rtconfig.py +++ b/bsp/stm32/stm32f103-mini-system/rtconfig.py @@ -44,7 +44,7 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' DEVICE = ' -mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -std=c99 -Dgcc' + CFLAGS = DEVICE + ' -Dgcc' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' @@ -57,11 +57,15 @@ if PLATFORM == 'gcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' elif PLATFORM == 'armcc': # toolchains CC = 'armcc' + CXX = 'armcc' AS = 'armasm' AR = 'armar' LINK = 'armlink' @@ -85,11 +89,16 @@ elif PLATFORM == 'armcc': else: CFLAGS += ' -O2' + + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' elif PLATFORM == 'iar': # toolchains CC = 'iccarm' + CXX = 'iccarm' AS = 'iasmarm' AR = 'iarchive' LINK = 'ilinkarm' @@ -130,5 +139,7 @@ elif PLATFORM == 'iar': LFLAGS = ' --config "board/linker_scripts/link.icf"' LFLAGS += ' --entry __iar_program_start' + CXXFLAGS = CFLAGS + EXEC_PATH = EXEC_PATH + '/arm/bin/' POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' diff --git a/bsp/stm32/stm32f107-uc-eval/SConstruct b/bsp/stm32/stm32f107-uc-eval/SConstruct index 05326b2b755fed11adc30f979ea01faf8bb5cfd6..27b5e7fccce3302bc36debeac6842b661a04a663 100644 --- a/bsp/stm32/stm32f107-uc-eval/SConstruct +++ b/bsp/stm32/stm32f107-uc-eval/SConstruct @@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'], AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, AR = rtconfig.AR, ARFLAGS = '-rc', + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) env.PrependENVPath('PATH', rtconfig.EXEC_PATH) diff --git a/bsp/stm32/stm32f107-uc-eval/board/linker_scripts/link.lds b/bsp/stm32/stm32f107-uc-eval/board/linker_scripts/link.lds index d895f771e7c1ccf566ed0798ed95cf2917ca406b..8bb1de29b67f630fa470a9ae66ad779a4ccef445 100644 --- a/bsp/stm32/stm32f107-uc-eval/board/linker_scripts/link.lds +++ b/bsp/stm32/stm32f107-uc-eval/board/linker_scripts/link.lds @@ -46,6 +46,14 @@ SECTIONS __rt_init_end = .; . = ALIGN(4); + + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + + . = ALIGN(4); + _etext = .; } > ROM = 0 @@ -72,6 +80,11 @@ SECTIONS *(.data.*) *(.gnu.linkonce.d*) + PROVIDE(__dtors_start__ = .); + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + PROVIDE(__dtors_end__ = .); + . = ALIGN(4); /* This is used by the startup in order to initialize the .data secion */ _edata = . ; diff --git a/bsp/stm32/stm32f107-uc-eval/rtconfig.py b/bsp/stm32/stm32f107-uc-eval/rtconfig.py index 40826ac99e18049c751f057ab72c8c53c0cdd13c..91aba6247859efa22ee160d54fa2fe6ade2ca528 100644 --- a/bsp/stm32/stm32f107-uc-eval/rtconfig.py +++ b/bsp/stm32/stm32f107-uc-eval/rtconfig.py @@ -44,7 +44,7 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' DEVICE = ' -mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -std=c99 -Dgcc' + CFLAGS = DEVICE + ' -Dgcc' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' @@ -57,11 +57,15 @@ if PLATFORM == 'gcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' elif PLATFORM == 'armcc': # toolchains CC = 'armcc' + CXX = 'armcc' AS = 'armasm' AR = 'armar' LINK = 'armlink' @@ -85,11 +89,15 @@ elif PLATFORM == 'armcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' elif PLATFORM == 'iar': # toolchains CC = 'iccarm' + CXX = 'iccarm' AS = 'iasmarm' AR = 'iarchive' LINK = 'ilinkarm' @@ -129,6 +137,8 @@ elif PLATFORM == 'iar': LFLAGS = ' --config "board/linker_scripts/link.icf"' LFLAGS += ' --entry __iar_program_start' + + CXXFLAGS = CFLAGS EXEC_PATH = EXEC_PATH + '/arm/bin/' POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' diff --git a/bsp/stm32/stm32f401-st-nucleo/SConstruct b/bsp/stm32/stm32f401-st-nucleo/SConstruct index 1101c708bdc865d6c4825b93e872b4b485798261..629f25c6ee6f4a645c8eec066935e414c62753a0 100644 --- a/bsp/stm32/stm32f401-st-nucleo/SConstruct +++ b/bsp/stm32/stm32f401-st-nucleo/SConstruct @@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'], AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, AR = rtconfig.AR, ARFLAGS = '-rc', + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) env.PrependENVPath('PATH', rtconfig.EXEC_PATH) diff --git a/bsp/stm32/stm32f401-st-nucleo/board/linker_scripts/link.lds b/bsp/stm32/stm32f401-st-nucleo/board/linker_scripts/link.lds index d89ce4e1adac70b45cd738617dda39d499893fa3..4690564fa212687c18b9cf4f0e5b18d64aea0cea 100644 --- a/bsp/stm32/stm32f401-st-nucleo/board/linker_scripts/link.lds +++ b/bsp/stm32/stm32f401-st-nucleo/board/linker_scripts/link.lds @@ -47,6 +47,14 @@ SECTIONS __rt_init_end = .; . = ALIGN(4); + + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + + . = ALIGN(4); + _etext = .; } > ROM = 0 @@ -73,6 +81,11 @@ SECTIONS *(.data.*) *(.gnu.linkonce.d*) + PROVIDE(__dtors_start__ = .); + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + PROVIDE(__dtors_end__ = .); + . = ALIGN(4); /* This is used by the startup in order to initialize the .data secion */ _edata = . ; diff --git a/bsp/stm32/stm32f401-st-nucleo/rtconfig.py b/bsp/stm32/stm32f401-st-nucleo/rtconfig.py index 3241586f69fbfa0128724a3900c004ca490b5dba..3aafec60b86849c2ec39d8c3133a90c5b5d38d12 100644 --- a/bsp/stm32/stm32f401-st-nucleo/rtconfig.py +++ b/bsp/stm32/stm32f401-st-nucleo/rtconfig.py @@ -44,7 +44,7 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -std=c99 -Dgcc' + CFLAGS = DEVICE + ' -Dgcc' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' @@ -57,11 +57,15 @@ if PLATFORM == 'gcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' elif PLATFORM == 'armcc': # toolchains CC = 'armcc' + CXX = 'armcc' AS = 'armasm' AR = 'armar' LINK = 'armlink' @@ -85,11 +89,15 @@ elif PLATFORM == 'armcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' elif PLATFORM == 'iar': # toolchains CC = 'iccarm' + CXX = 'iccarm' AS = 'iasmarm' AR = 'iarchive' LINK = 'ilinkarm' @@ -130,5 +138,8 @@ elif PLATFORM == 'iar': LFLAGS = ' --config "board/linker_scripts/link.icf"' LFLAGS += ' --entry __iar_program_start' + + CXXFLAGS = CFLAGS + EXEC_PATH = EXEC_PATH + '/arm/bin/' POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' diff --git a/bsp/stm32/stm32f405-smdz-breadfruit/SConstruct b/bsp/stm32/stm32f405-smdz-breadfruit/SConstruct index 6180d5bea2b8e7c7c30ba93fec9d75a4e5c6b087..110a631aea786e15de301a8e160104858df4472d 100644 --- a/bsp/stm32/stm32f405-smdz-breadfruit/SConstruct +++ b/bsp/stm32/stm32f405-smdz-breadfruit/SConstruct @@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'], AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, AR = rtconfig.AR, ARFLAGS = '-rc', + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) env.PrependENVPath('PATH', rtconfig.EXEC_PATH) diff --git a/bsp/stm32/stm32f405-smdz-breadfruit/board/linker_scripts/link.lds b/bsp/stm32/stm32f405-smdz-breadfruit/board/linker_scripts/link.lds index fb96952f9327cc8539f8c605ecc4b0ba2290d97c..d7aaa5969d58f7a28e7b59299e1c040e20a128b3 100644 --- a/bsp/stm32/stm32f405-smdz-breadfruit/board/linker_scripts/link.lds +++ b/bsp/stm32/stm32f405-smdz-breadfruit/board/linker_scripts/link.lds @@ -49,6 +49,14 @@ SECTIONS __rt_init_end = .; . = ALIGN(4); + + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + + . = ALIGN(4); + _etext = .; } > CODE = 0 @@ -75,6 +83,11 @@ SECTIONS *(.data.*) *(.gnu.linkonce.d*) + PROVIDE(__dtors_start__ = .); + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + PROVIDE(__dtors_end__ = .); + . = ALIGN(4); /* This is used by the startup in order to initialize the .data secion */ _edata = . ; diff --git a/bsp/stm32/stm32f405-smdz-breadfruit/rtconfig.py b/bsp/stm32/stm32f405-smdz-breadfruit/rtconfig.py index ca3993b30d1c060854003ae962b0b4ae0f556166..5094363dfae61ea59ef3f412bc4b3f31ef3ad9a5 100644 --- a/bsp/stm32/stm32f405-smdz-breadfruit/rtconfig.py +++ b/bsp/stm32/stm32f405-smdz-breadfruit/rtconfig.py @@ -44,7 +44,7 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -std=c99 -Dgcc' + CFLAGS = DEVICE + ' -Dgcc' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' @@ -57,11 +57,15 @@ if PLATFORM == 'gcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' elif PLATFORM == 'armcc': # toolchains CC = 'armcc' + CXX = 'armcc' AS = 'armasm' AR = 'armar' LINK = 'armlink' @@ -85,11 +89,15 @@ elif PLATFORM == 'armcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' elif PLATFORM == 'iar': # toolchains CC = 'iccarm' + CXX = 'iccarm' AS = 'iasmarm' AR = 'iarchive' LINK = 'ilinkarm' @@ -130,5 +138,7 @@ elif PLATFORM == 'iar': LFLAGS = ' --config "board/linker_scripts/link.icf"' LFLAGS += ' --entry __iar_program_start' + CXXFLAGS = CFLAGS + EXEC_PATH = EXEC_PATH + '/arm/bin/' POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' diff --git a/bsp/stm32/stm32f407-atk-explorer/SConstruct b/bsp/stm32/stm32f407-atk-explorer/SConstruct index 1101c708bdc865d6c4825b93e872b4b485798261..629f25c6ee6f4a645c8eec066935e414c62753a0 100644 --- a/bsp/stm32/stm32f407-atk-explorer/SConstruct +++ b/bsp/stm32/stm32f407-atk-explorer/SConstruct @@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'], AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, AR = rtconfig.AR, ARFLAGS = '-rc', + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) env.PrependENVPath('PATH', rtconfig.EXEC_PATH) diff --git a/bsp/stm32/stm32f407-atk-explorer/board/linker_scripts/link.lds b/bsp/stm32/stm32f407-atk-explorer/board/linker_scripts/link.lds index fb96952f9327cc8539f8c605ecc4b0ba2290d97c..79a7e76df32602bc51622ea2f5dfc26b4500a02c 100644 --- a/bsp/stm32/stm32f407-atk-explorer/board/linker_scripts/link.lds +++ b/bsp/stm32/stm32f407-atk-explorer/board/linker_scripts/link.lds @@ -49,6 +49,14 @@ SECTIONS __rt_init_end = .; . = ALIGN(4); + + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + + . = ALIGN(4); + _etext = .; } > CODE = 0 @@ -75,6 +83,11 @@ SECTIONS *(.data.*) *(.gnu.linkonce.d*) + PROVIDE(__dtors_start__ = .); + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + PROVIDE(__dtors_end__ = .); + . = ALIGN(4); /* This is used by the startup in order to initialize the .data secion */ _edata = . ; diff --git a/bsp/stm32/stm32f407-atk-explorer/rtconfig.py b/bsp/stm32/stm32f407-atk-explorer/rtconfig.py index 3241586f69fbfa0128724a3900c004ca490b5dba..4a9fe33cef7faf24e59b8909c2de8d26d3da78eb 100644 --- a/bsp/stm32/stm32f407-atk-explorer/rtconfig.py +++ b/bsp/stm32/stm32f407-atk-explorer/rtconfig.py @@ -44,7 +44,7 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -std=c99 -Dgcc' + CFLAGS = DEVICE + ' -Dgcc' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' @@ -57,11 +57,15 @@ if PLATFORM == 'gcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' elif PLATFORM == 'armcc': # toolchains CC = 'armcc' + CXX = 'armcc' AS = 'armasm' AR = 'armar' LINK = 'armlink' @@ -85,11 +89,15 @@ elif PLATFORM == 'armcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' elif PLATFORM == 'iar': # toolchains CC = 'iccarm' + CXX = 'iccarm' AS = 'iasmarm' AR = 'iarchive' LINK = 'ilinkarm' @@ -130,5 +138,7 @@ elif PLATFORM == 'iar': LFLAGS = ' --config "board/linker_scripts/link.icf"' LFLAGS += ' --entry __iar_program_start' + CXXFLAGS = CFLAGS + EXEC_PATH = EXEC_PATH + '/arm/bin/' POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' diff --git a/bsp/stm32/stm32f407-st-discovery/SConstruct b/bsp/stm32/stm32f407-st-discovery/SConstruct index f80a225c3b0ae44b8bae1ee575b59d0966dccc51..b3728e2330ef0555940b38fe18eab9a53bac8712 100644 --- a/bsp/stm32/stm32f407-st-discovery/SConstruct +++ b/bsp/stm32/stm32f407-st-discovery/SConstruct @@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'], AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, AR = rtconfig.AR, ARFLAGS = '-rc', + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) env.PrependENVPath('PATH', rtconfig.EXEC_PATH) diff --git a/bsp/stm32/stm32f407-st-discovery/board/linker_scripts/link.lds b/bsp/stm32/stm32f407-st-discovery/board/linker_scripts/link.lds index 02bebed7a6a103ed5288a7ae282b0b7e4ea8683b..46cc164fa9d8c9ebfedaa8cd76178da56c6895fe 100644 --- a/bsp/stm32/stm32f407-st-discovery/board/linker_scripts/link.lds +++ b/bsp/stm32/stm32f407-st-discovery/board/linker_scripts/link.lds @@ -48,6 +48,14 @@ SECTIONS __rt_init_end = .; . = ALIGN(4); + + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + + . = ALIGN(4); + _etext = .; } > CODE = 0 diff --git a/bsp/stm32/stm32f407-st-discovery/rtconfig.py b/bsp/stm32/stm32f407-st-discovery/rtconfig.py index 4d9d4450aab336996020e36da7eaf049ccd10ce8..4f3dbc90ee68c1c08e4745547c48970e1dd659ec 100644 --- a/bsp/stm32/stm32f407-st-discovery/rtconfig.py +++ b/bsp/stm32/stm32f407-st-discovery/rtconfig.py @@ -44,7 +44,7 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -std=c99 -Dgcc' + CFLAGS = DEVICE + ' -Dgcc' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' @@ -57,11 +57,15 @@ if PLATFORM == 'gcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' elif PLATFORM == 'armcc': # toolchains CC = 'armcc' + CXX = 'armcc' AS = 'armasm' AR = 'armar' LINK = 'armlink' @@ -85,11 +89,15 @@ elif PLATFORM == 'armcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' elif PLATFORM == 'iar': # toolchains CC = 'iccarm' + CXX = 'iccarm' AS = 'iasmarm' AR = 'iarchive' LINK = 'ilinkarm' @@ -130,5 +138,7 @@ elif PLATFORM == 'iar': LFLAGS = ' --config "board/linker_scripts/link.icf"' LFLAGS += ' --entry __iar_program_start' + CXXFLAGS = CFLAGS + EXEC_PATH = EXEC_PATH + '/arm/bin/' POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' diff --git a/bsp/stm32/stm32f411-st-nucleo/SConstruct b/bsp/stm32/stm32f411-st-nucleo/SConstruct index f80a225c3b0ae44b8bae1ee575b59d0966dccc51..b3728e2330ef0555940b38fe18eab9a53bac8712 100644 --- a/bsp/stm32/stm32f411-st-nucleo/SConstruct +++ b/bsp/stm32/stm32f411-st-nucleo/SConstruct @@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'], AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, AR = rtconfig.AR, ARFLAGS = '-rc', + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) env.PrependENVPath('PATH', rtconfig.EXEC_PATH) diff --git a/bsp/stm32/stm32f411-st-nucleo/board/linker_scripts/link.lds b/bsp/stm32/stm32f411-st-nucleo/board/linker_scripts/link.lds index 4d08a6d00e016b28bb2ad24816a896066bf70793..cab0cf0418467f8435ee66b8659adc1506e96d26 100644 --- a/bsp/stm32/stm32f411-st-nucleo/board/linker_scripts/link.lds +++ b/bsp/stm32/stm32f411-st-nucleo/board/linker_scripts/link.lds @@ -47,6 +47,15 @@ SECTIONS __rt_init_end = .; . = ALIGN(4); + + + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + + . = ALIGN(4); + _etext = .; } > ROM = 0 @@ -73,6 +82,11 @@ SECTIONS *(.data.*) *(.gnu.linkonce.d*) + PROVIDE(__dtors_start__ = .); + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + PROVIDE(__dtors_end__ = .); + . = ALIGN(4); /* This is used by the startup in order to initialize the .data secion */ _edata = . ; diff --git a/bsp/stm32/stm32f411-st-nucleo/rtconfig.py b/bsp/stm32/stm32f411-st-nucleo/rtconfig.py index 4d9d4450aab336996020e36da7eaf049ccd10ce8..69a32c6da2364598b0fbefefeae7d15234e523cc 100644 --- a/bsp/stm32/stm32f411-st-nucleo/rtconfig.py +++ b/bsp/stm32/stm32f411-st-nucleo/rtconfig.py @@ -44,7 +44,7 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -std=c99 -Dgcc' + CFLAGS = DEVICE + ' -Dgcc' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' @@ -57,11 +57,15 @@ if PLATFORM == 'gcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' elif PLATFORM == 'armcc': # toolchains CC = 'armcc' + CXX = 'armcc' AS = 'armasm' AR = 'armar' LINK = 'armlink' @@ -85,11 +89,15 @@ elif PLATFORM == 'armcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' elif PLATFORM == 'iar': # toolchains CC = 'iccarm' + CXX = 'iccarm' AS = 'iasmarm' AR = 'iarchive' LINK = 'ilinkarm' @@ -130,5 +138,7 @@ elif PLATFORM == 'iar': LFLAGS = ' --config "board/linker_scripts/link.icf"' LFLAGS += ' --entry __iar_program_start' + CXXFLAGS = CFLAGS + EXEC_PATH = EXEC_PATH + '/arm/bin/' POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' diff --git a/bsp/stm32/stm32f429-armfly-v6/SConstruct b/bsp/stm32/stm32f429-armfly-v6/SConstruct index 1101c708bdc865d6c4825b93e872b4b485798261..629f25c6ee6f4a645c8eec066935e414c62753a0 100644 --- a/bsp/stm32/stm32f429-armfly-v6/SConstruct +++ b/bsp/stm32/stm32f429-armfly-v6/SConstruct @@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'], AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, AR = rtconfig.AR, ARFLAGS = '-rc', + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) env.PrependENVPath('PATH', rtconfig.EXEC_PATH) diff --git a/bsp/stm32/stm32f429-armfly-v6/board/linker_scripts/link.lds b/bsp/stm32/stm32f429-armfly-v6/board/linker_scripts/link.lds index adf166dd6441a94b4d54d5ef15e805e8cf31b62b..7fb843251f68e3a3e9d9afeb3a843ca6912a077a 100644 --- a/bsp/stm32/stm32f429-armfly-v6/board/linker_scripts/link.lds +++ b/bsp/stm32/stm32f429-armfly-v6/board/linker_scripts/link.lds @@ -49,6 +49,14 @@ SECTIONS __rt_init_end = .; . = ALIGN(4); + + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + + . = ALIGN(4); + _etext = .; } > CODE = 0 @@ -75,6 +83,11 @@ SECTIONS *(.data.*) *(.gnu.linkonce.d*) + PROVIDE(__dtors_start__ = .); + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + PROVIDE(__dtors_end__ = .); + . = ALIGN(4); /* This is used by the startup in order to initialize the .data secion */ _edata = . ; diff --git a/bsp/stm32/stm32f429-armfly-v6/rtconfig.py b/bsp/stm32/stm32f429-armfly-v6/rtconfig.py index 2e3b7cf4929d22771893e59487c441aed871e6f6..3bb974643b521ea260a84f98252eaeab04ac3dd3 100644 --- a/bsp/stm32/stm32f429-armfly-v6/rtconfig.py +++ b/bsp/stm32/stm32f429-armfly-v6/rtconfig.py @@ -35,6 +35,7 @@ if PLATFORM == 'gcc': PREFIX = 'arm-none-eabi-' CC = PREFIX + 'gcc' AS = PREFIX + 'gcc' + CXX = PREFIX + 'g++' AR = PREFIX + 'ar' LINK = PREFIX + 'gcc' TARGET_EXT = 'elf' @@ -43,7 +44,7 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -std=c99 -Dgcc' + CFLAGS = DEVICE + ' -Dgcc' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' @@ -56,11 +57,15 @@ if PLATFORM == 'gcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' elif PLATFORM == 'armcc': # toolchains CC = 'armcc' + CXX = 'armcc' AS = 'armasm' AR = 'armar' LINK = 'armlink' @@ -84,11 +89,15 @@ elif PLATFORM == 'armcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' elif PLATFORM == 'iar': # toolchains CC = 'iccarm' + CXX = 'iccarm' AS = 'iasmarm' AR = 'iarchive' LINK = 'ilinkarm' @@ -129,5 +138,8 @@ elif PLATFORM == 'iar': LFLAGS = ' --config "board/linker_scripts/link.icf"' LFLAGS += ' --entry __iar_program_start' + + CXXFLAGS = CFLAGS + EXEC_PATH = EXEC_PATH + '/arm/bin/' POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' diff --git a/bsp/stm32/stm32f429-atk-apollo/SConstruct b/bsp/stm32/stm32f429-atk-apollo/SConstruct index 1101c708bdc865d6c4825b93e872b4b485798261..629f25c6ee6f4a645c8eec066935e414c62753a0 100644 --- a/bsp/stm32/stm32f429-atk-apollo/SConstruct +++ b/bsp/stm32/stm32f429-atk-apollo/SConstruct @@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'], AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, AR = rtconfig.AR, ARFLAGS = '-rc', + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) env.PrependENVPath('PATH', rtconfig.EXEC_PATH) diff --git a/bsp/stm32/stm32f429-atk-apollo/board/linker_scripts/link.lds b/bsp/stm32/stm32f429-atk-apollo/board/linker_scripts/link.lds index bc4b95e6aebfb5c7e0e781e5ad28e3f6130c45c4..d023c0b256b54e18a653838a5ec22dd6ceab8f14 100644 --- a/bsp/stm32/stm32f429-atk-apollo/board/linker_scripts/link.lds +++ b/bsp/stm32/stm32f429-atk-apollo/board/linker_scripts/link.lds @@ -55,6 +55,14 @@ SECTIONS __rt_init_end = .; . = ALIGN(4); + + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + + . = ALIGN(4); + _etext = .; } > CODE = 0 @@ -81,6 +89,11 @@ SECTIONS *(.data.*) *(.gnu.linkonce.d*) + PROVIDE(__dtors_start__ = .); + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + PROVIDE(__dtors_end__ = .); + . = ALIGN(4); /* This is used by the startup in order to initialize the .data secion */ _edata = . ; diff --git a/bsp/stm32/stm32f429-atk-apollo/rtconfig.py b/bsp/stm32/stm32f429-atk-apollo/rtconfig.py index 3241586f69fbfa0128724a3900c004ca490b5dba..4a9fe33cef7faf24e59b8909c2de8d26d3da78eb 100644 --- a/bsp/stm32/stm32f429-atk-apollo/rtconfig.py +++ b/bsp/stm32/stm32f429-atk-apollo/rtconfig.py @@ -44,7 +44,7 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -std=c99 -Dgcc' + CFLAGS = DEVICE + ' -Dgcc' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' @@ -57,11 +57,15 @@ if PLATFORM == 'gcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' elif PLATFORM == 'armcc': # toolchains CC = 'armcc' + CXX = 'armcc' AS = 'armasm' AR = 'armar' LINK = 'armlink' @@ -85,11 +89,15 @@ elif PLATFORM == 'armcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' elif PLATFORM == 'iar': # toolchains CC = 'iccarm' + CXX = 'iccarm' AS = 'iasmarm' AR = 'iarchive' LINK = 'ilinkarm' @@ -130,5 +138,7 @@ elif PLATFORM == 'iar': LFLAGS = ' --config "board/linker_scripts/link.icf"' LFLAGS += ' --entry __iar_program_start' + CXXFLAGS = CFLAGS + EXEC_PATH = EXEC_PATH + '/arm/bin/' POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' diff --git a/bsp/stm32/stm32f429-fire-challenger/SConstruct b/bsp/stm32/stm32f429-fire-challenger/SConstruct index 1101c708bdc865d6c4825b93e872b4b485798261..629f25c6ee6f4a645c8eec066935e414c62753a0 100644 --- a/bsp/stm32/stm32f429-fire-challenger/SConstruct +++ b/bsp/stm32/stm32f429-fire-challenger/SConstruct @@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'], AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, AR = rtconfig.AR, ARFLAGS = '-rc', + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) env.PrependENVPath('PATH', rtconfig.EXEC_PATH) diff --git a/bsp/stm32/stm32f429-fire-challenger/board/linker_scripts/link.lds b/bsp/stm32/stm32f429-fire-challenger/board/linker_scripts/link.lds index adf166dd6441a94b4d54d5ef15e805e8cf31b62b..7fb843251f68e3a3e9d9afeb3a843ca6912a077a 100644 --- a/bsp/stm32/stm32f429-fire-challenger/board/linker_scripts/link.lds +++ b/bsp/stm32/stm32f429-fire-challenger/board/linker_scripts/link.lds @@ -49,6 +49,14 @@ SECTIONS __rt_init_end = .; . = ALIGN(4); + + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + + . = ALIGN(4); + _etext = .; } > CODE = 0 @@ -75,6 +83,11 @@ SECTIONS *(.data.*) *(.gnu.linkonce.d*) + PROVIDE(__dtors_start__ = .); + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + PROVIDE(__dtors_end__ = .); + . = ALIGN(4); /* This is used by the startup in order to initialize the .data secion */ _edata = . ; diff --git a/bsp/stm32/stm32f429-fire-challenger/rtconfig.py b/bsp/stm32/stm32f429-fire-challenger/rtconfig.py index 3241586f69fbfa0128724a3900c004ca490b5dba..4a9fe33cef7faf24e59b8909c2de8d26d3da78eb 100644 --- a/bsp/stm32/stm32f429-fire-challenger/rtconfig.py +++ b/bsp/stm32/stm32f429-fire-challenger/rtconfig.py @@ -44,7 +44,7 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -std=c99 -Dgcc' + CFLAGS = DEVICE + ' -Dgcc' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' @@ -57,11 +57,15 @@ if PLATFORM == 'gcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' elif PLATFORM == 'armcc': # toolchains CC = 'armcc' + CXX = 'armcc' AS = 'armasm' AR = 'armar' LINK = 'armlink' @@ -85,11 +89,15 @@ elif PLATFORM == 'armcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' elif PLATFORM == 'iar': # toolchains CC = 'iccarm' + CXX = 'iccarm' AS = 'iasmarm' AR = 'iarchive' LINK = 'ilinkarm' @@ -130,5 +138,7 @@ elif PLATFORM == 'iar': LFLAGS = ' --config "board/linker_scripts/link.icf"' LFLAGS += ' --entry __iar_program_start' + CXXFLAGS = CFLAGS + EXEC_PATH = EXEC_PATH + '/arm/bin/' POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' diff --git a/bsp/stm32/stm32f446-st-nucleo/SConstruct b/bsp/stm32/stm32f446-st-nucleo/SConstruct index 1101c708bdc865d6c4825b93e872b4b485798261..629f25c6ee6f4a645c8eec066935e414c62753a0 100644 --- a/bsp/stm32/stm32f446-st-nucleo/SConstruct +++ b/bsp/stm32/stm32f446-st-nucleo/SConstruct @@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'], AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, AR = rtconfig.AR, ARFLAGS = '-rc', + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) env.PrependENVPath('PATH', rtconfig.EXEC_PATH) diff --git a/bsp/stm32/stm32f446-st-nucleo/board/linker_scripts/link.lds b/bsp/stm32/stm32f446-st-nucleo/board/linker_scripts/link.lds index 21d57b9d71164413172096ce1da399b332419d88..34823737b3517e0a77d21a1df46f643b72c2464a 100644 --- a/bsp/stm32/stm32f446-st-nucleo/board/linker_scripts/link.lds +++ b/bsp/stm32/stm32f446-st-nucleo/board/linker_scripts/link.lds @@ -47,6 +47,14 @@ SECTIONS __rt_init_end = .; . = ALIGN(4); + + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + + . = ALIGN(4); + _etext = .; } > ROM = 0 @@ -73,6 +81,12 @@ SECTIONS *(.data.*) *(.gnu.linkonce.d*) + + PROVIDE(__dtors_start__ = .); + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + PROVIDE(__dtors_end__ = .); + . = ALIGN(4); /* This is used by the startup in order to initialize the .data secion */ _edata = . ; diff --git a/bsp/stm32/stm32f446-st-nucleo/rtconfig.py b/bsp/stm32/stm32f446-st-nucleo/rtconfig.py index 3241586f69fbfa0128724a3900c004ca490b5dba..4a9fe33cef7faf24e59b8909c2de8d26d3da78eb 100644 --- a/bsp/stm32/stm32f446-st-nucleo/rtconfig.py +++ b/bsp/stm32/stm32f446-st-nucleo/rtconfig.py @@ -44,7 +44,7 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -std=c99 -Dgcc' + CFLAGS = DEVICE + ' -Dgcc' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' @@ -57,11 +57,15 @@ if PLATFORM == 'gcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' elif PLATFORM == 'armcc': # toolchains CC = 'armcc' + CXX = 'armcc' AS = 'armasm' AR = 'armar' LINK = 'armlink' @@ -85,11 +89,15 @@ elif PLATFORM == 'armcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' elif PLATFORM == 'iar': # toolchains CC = 'iccarm' + CXX = 'iccarm' AS = 'iasmarm' AR = 'iarchive' LINK = 'ilinkarm' @@ -130,5 +138,7 @@ elif PLATFORM == 'iar': LFLAGS = ' --config "board/linker_scripts/link.icf"' LFLAGS += ' --entry __iar_program_start' + CXXFLAGS = CFLAGS + EXEC_PATH = EXEC_PATH + '/arm/bin/' POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' diff --git a/bsp/stm32/stm32f746-st-disco/SConstruct b/bsp/stm32/stm32f746-st-disco/SConstruct index b6053d64c214908969ed5d0416a4ea9167e9f4a1..012e6b41bff80836ad9c69c617f3866b6142d5b6 100644 --- a/bsp/stm32/stm32f746-st-disco/SConstruct +++ b/bsp/stm32/stm32f746-st-disco/SConstruct @@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'], AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, AR = rtconfig.AR, ARFLAGS = '-rc', + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) env.PrependENVPath('PATH', rtconfig.EXEC_PATH) diff --git a/bsp/stm32/stm32f746-st-disco/board/linker_scripts/link.lds b/bsp/stm32/stm32f746-st-disco/board/linker_scripts/link.lds index 83adc09622bde5760eb4facd94f74f022a8bd318..09cdaa3a09b8b5f4853f977918b980f623b96601 100644 --- a/bsp/stm32/stm32f746-st-disco/board/linker_scripts/link.lds +++ b/bsp/stm32/stm32f746-st-disco/board/linker_scripts/link.lds @@ -47,6 +47,14 @@ SECTIONS __rt_init_end = .; . = ALIGN(4); + + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + + . = ALIGN(4); + _etext = .; } > ROM = 0 @@ -73,6 +81,11 @@ SECTIONS *(.data.*) *(.gnu.linkonce.d*) + PROVIDE(__dtors_start__ = .); + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + PROVIDE(__dtors_end__ = .); + . = ALIGN(4); /* This is used by the startup in order to initialize the .data secion */ _edata = . ; diff --git a/bsp/stm32/stm32f746-st-disco/rtconfig.py b/bsp/stm32/stm32f746-st-disco/rtconfig.py index dbe66205eb420982572a779dbf6b05e23e20d8b9..4c4dc4ef021ba3e2cd163b04b177722f0afb1e20 100644 --- a/bsp/stm32/stm32f746-st-disco/rtconfig.py +++ b/bsp/stm32/stm32f746-st-disco/rtconfig.py @@ -43,7 +43,7 @@ if PLATFORM == 'gcc': STRIP = PREFIX + 'strip' DEVICE = ' -mcpu=' + CPU + ' -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -std=c99 -g -Wall' + CFLAGS = DEVICE + ' -g -Wall' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' @@ -56,6 +56,9 @@ if PLATFORM == 'gcc': else: CFLAGS += ' -O2 -Os' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' # module setting @@ -92,6 +95,7 @@ elif PLATFORM == 'armcc': CFLAGS += ' -O2 -Otime' CXXFLAGS = CFLAGS + POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' elif PLATFORM == 'iar': diff --git a/bsp/stm32/stm32f767-atk-apollo/SConstruct b/bsp/stm32/stm32f767-atk-apollo/SConstruct index dd77b5c1d3d8763d578147c3f3233bdab16e056c..ca0f33d6925bcb25f33c4786cafcaf421fc9e9ec 100644 --- a/bsp/stm32/stm32f767-atk-apollo/SConstruct +++ b/bsp/stm32/stm32f767-atk-apollo/SConstruct @@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'], AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, AR = rtconfig.AR, ARFLAGS = '-rc', + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) env.PrependENVPath('PATH', rtconfig.EXEC_PATH) diff --git a/bsp/stm32/stm32f767-atk-apollo/board/linker_scripts/link.lds b/bsp/stm32/stm32f767-atk-apollo/board/linker_scripts/link.lds index c6fe92740e50f7eb432799d51bf86f5db1c82d56..50169db32036958574462b05ef4b4406d155fde5 100644 --- a/bsp/stm32/stm32f767-atk-apollo/board/linker_scripts/link.lds +++ b/bsp/stm32/stm32f767-atk-apollo/board/linker_scripts/link.lds @@ -47,6 +47,14 @@ SECTIONS __rt_init_end = .; . = ALIGN(4); + + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + + . = ALIGN(4); + _etext = .; } > ROM = 0 @@ -73,6 +81,11 @@ SECTIONS *(.data.*) *(.gnu.linkonce.d*) + PROVIDE(__dtors_start__ = .); + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + PROVIDE(__dtors_end__ = .); + . = ALIGN(4); /* This is used by the startup in order to initialize the .data secion */ _edata = . ; diff --git a/bsp/stm32/stm32f767-atk-apollo/rtconfig.py b/bsp/stm32/stm32f767-atk-apollo/rtconfig.py index 11cbdba8c4ad3edf2f8d15535f623a2893f695e1..251d8168e79cfa667d1f99932eee4a3c8721b4d8 100644 --- a/bsp/stm32/stm32f767-atk-apollo/rtconfig.py +++ b/bsp/stm32/stm32f767-atk-apollo/rtconfig.py @@ -44,7 +44,7 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' DEVICE = ' -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -std=c99 -Dgcc' + CFLAGS = DEVICE + ' -Dgcc' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' @@ -57,11 +57,15 @@ if PLATFORM == 'gcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' elif PLATFORM == 'armcc': # toolchains CC = 'armcc' + CXX = 'armcc' AS = 'armasm' AR = 'armar' LINK = 'armlink' @@ -86,11 +90,14 @@ elif PLATFORM == 'armcc': CFLAGS += ' -O2' CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' elif PLATFORM == 'iar': # toolchains CC = 'iccarm' + CXX = 'iccarm' AS = 'iasmarm' AR = 'iarchive' LINK = 'ilinkarm' @@ -131,5 +138,7 @@ elif PLATFORM == 'iar': LFLAGS = ' --config "board/linker_scripts/link.icf"' LFLAGS += ' --entry __iar_program_start' + CXXFLAGS = CFLAGS + EXEC_PATH = EXEC_PATH + '/arm/bin/' POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' \ No newline at end of file diff --git a/bsp/stm32/stm32f767-fire-challenger/SConstruct b/bsp/stm32/stm32f767-fire-challenger/SConstruct index dd77b5c1d3d8763d578147c3f3233bdab16e056c..ca0f33d6925bcb25f33c4786cafcaf421fc9e9ec 100644 --- a/bsp/stm32/stm32f767-fire-challenger/SConstruct +++ b/bsp/stm32/stm32f767-fire-challenger/SConstruct @@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'], AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, AR = rtconfig.AR, ARFLAGS = '-rc', + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) env.PrependENVPath('PATH', rtconfig.EXEC_PATH) diff --git a/bsp/stm32/stm32f767-fire-challenger/board/linker_scripts/link.lds b/bsp/stm32/stm32f767-fire-challenger/board/linker_scripts/link.lds index c6fe92740e50f7eb432799d51bf86f5db1c82d56..50169db32036958574462b05ef4b4406d155fde5 100644 --- a/bsp/stm32/stm32f767-fire-challenger/board/linker_scripts/link.lds +++ b/bsp/stm32/stm32f767-fire-challenger/board/linker_scripts/link.lds @@ -47,6 +47,14 @@ SECTIONS __rt_init_end = .; . = ALIGN(4); + + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + + . = ALIGN(4); + _etext = .; } > ROM = 0 @@ -73,6 +81,11 @@ SECTIONS *(.data.*) *(.gnu.linkonce.d*) + PROVIDE(__dtors_start__ = .); + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + PROVIDE(__dtors_end__ = .); + . = ALIGN(4); /* This is used by the startup in order to initialize the .data secion */ _edata = . ; diff --git a/bsp/stm32/stm32f767-fire-challenger/rtconfig.py b/bsp/stm32/stm32f767-fire-challenger/rtconfig.py index 11cbdba8c4ad3edf2f8d15535f623a2893f695e1..93d7b660335085b9fff0cf8e5cf64832e5de5bca 100644 --- a/bsp/stm32/stm32f767-fire-challenger/rtconfig.py +++ b/bsp/stm32/stm32f767-fire-challenger/rtconfig.py @@ -44,7 +44,7 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' DEVICE = ' -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -std=c99 -Dgcc' + CFLAGS = DEVICE + ' -Dgcc' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' @@ -57,11 +57,15 @@ if PLATFORM == 'gcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' elif PLATFORM == 'armcc': # toolchains CC = 'armcc' + CXX = 'armcc' AS = 'armasm' AR = 'armar' LINK = 'armlink' @@ -85,12 +89,15 @@ elif PLATFORM == 'armcc': else: CFLAGS += ' -O2' - CXXFLAGS = CFLAGS + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' elif PLATFORM == 'iar': # toolchains CC = 'iccarm' + CXX = 'iccarm' AS = 'iasmarm' AR = 'iarchive' LINK = 'ilinkarm' @@ -131,5 +138,7 @@ elif PLATFORM == 'iar': LFLAGS = ' --config "board/linker_scripts/link.icf"' LFLAGS += ' --entry __iar_program_start' + CXXFLAGS = CFLAGS + EXEC_PATH = EXEC_PATH + '/arm/bin/' POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' \ No newline at end of file diff --git a/bsp/stm32/stm32f767-st-nucleo/SConstruct b/bsp/stm32/stm32f767-st-nucleo/SConstruct index b6053d64c214908969ed5d0416a4ea9167e9f4a1..012e6b41bff80836ad9c69c617f3866b6142d5b6 100644 --- a/bsp/stm32/stm32f767-st-nucleo/SConstruct +++ b/bsp/stm32/stm32f767-st-nucleo/SConstruct @@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'], AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, AR = rtconfig.AR, ARFLAGS = '-rc', + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) env.PrependENVPath('PATH', rtconfig.EXEC_PATH) diff --git a/bsp/stm32/stm32f767-st-nucleo/board/linker_scripts/link.lds b/bsp/stm32/stm32f767-st-nucleo/board/linker_scripts/link.lds index e9f089ac5cbd9396982c50001b6d10cc11f941fe..406ae0c82eb89b838527312ea69852544d92b787 100644 --- a/bsp/stm32/stm32f767-st-nucleo/board/linker_scripts/link.lds +++ b/bsp/stm32/stm32f767-st-nucleo/board/linker_scripts/link.lds @@ -47,6 +47,14 @@ SECTIONS __rt_init_end = .; . = ALIGN(4); + + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + + . = ALIGN(4); + _etext = .; } > ROM = 0 @@ -73,6 +81,11 @@ SECTIONS *(.data.*) *(.gnu.linkonce.d*) + PROVIDE(__dtors_start__ = .); + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + PROVIDE(__dtors_end__ = .); + . = ALIGN(4); /* This is used by the startup in order to initialize the .data secion */ _edata = . ; diff --git a/bsp/stm32/stm32f767-st-nucleo/rtconfig.py b/bsp/stm32/stm32f767-st-nucleo/rtconfig.py index dbe66205eb420982572a779dbf6b05e23e20d8b9..ef578d17cac2a1cb292d6dc8d2493a030009af48 100644 --- a/bsp/stm32/stm32f767-st-nucleo/rtconfig.py +++ b/bsp/stm32/stm32f767-st-nucleo/rtconfig.py @@ -43,7 +43,7 @@ if PLATFORM == 'gcc': STRIP = PREFIX + 'strip' DEVICE = ' -mcpu=' + CPU + ' -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -std=c99 -g -Wall' + CFLAGS = DEVICE + ' -g -Wall' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' @@ -56,6 +56,9 @@ if PLATFORM == 'gcc': else: CFLAGS += ' -O2 -Os' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' # module setting @@ -70,6 +73,7 @@ elif PLATFORM == 'armcc': # toolchains CC = 'armcc' CXX = 'armcc' + CXX = 'armcc' AS = 'armasm' AR = 'armar' LINK = 'armlink' @@ -91,13 +95,16 @@ elif PLATFORM == 'armcc': else: CFLAGS += ' -O2 -Otime' - CXXFLAGS = CFLAGS + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' elif PLATFORM == 'iar': # toolchains CC = 'iccarm' CXX = 'iccarm' + CXX = 'iccarm' AS = 'iasmarm' AR = 'iarchive' LINK = 'ilinkarm' diff --git a/bsp/stm32/stm32g071-st-nucleo/SConstruct b/bsp/stm32/stm32g071-st-nucleo/SConstruct index 59e76d2f2e6bf41def783d3ee1e36a3fcd735c79..9de90da39b9fe11da74de6e618a2e7a4828b4816 100644 --- a/bsp/stm32/stm32g071-st-nucleo/SConstruct +++ b/bsp/stm32/stm32g071-st-nucleo/SConstruct @@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'], AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, AR = rtconfig.AR, ARFLAGS = '-rc', + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) env.PrependENVPath('PATH', rtconfig.EXEC_PATH) diff --git a/bsp/stm32/stm32g071-st-nucleo/board/linker_scripts/link.lds b/bsp/stm32/stm32g071-st-nucleo/board/linker_scripts/link.lds index f8692a3b45854e6011bcab742e55f220885b3c66..963ce61634c73344c65937f037a1d3d0fb74b57e 100644 --- a/bsp/stm32/stm32g071-st-nucleo/board/linker_scripts/link.lds +++ b/bsp/stm32/stm32g071-st-nucleo/board/linker_scripts/link.lds @@ -46,6 +46,14 @@ SECTIONS __rt_init_end = .; . = ALIGN(4); + + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + + . = ALIGN(4); + _etext = .; } > ROM = 0 @@ -72,6 +80,11 @@ SECTIONS *(.data.*) *(.gnu.linkonce.d*) + PROVIDE(__dtors_start__ = .); + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + PROVIDE(__dtors_end__ = .); + . = ALIGN(4); /* This is used by the startup in order to initialize the .data secion */ _edata = . ; diff --git a/bsp/stm32/stm32g071-st-nucleo/rtconfig.py b/bsp/stm32/stm32g071-st-nucleo/rtconfig.py index 7c5cbfea7f1a1e5d1957eca8d8c890a128d41aa6..7b2a05c9e3ac15db6ce2d31eba54d621c53d7adc 100644 --- a/bsp/stm32/stm32g071-st-nucleo/rtconfig.py +++ b/bsp/stm32/stm32g071-st-nucleo/rtconfig.py @@ -44,7 +44,7 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' DEVICE = ' -mcpu=cortex-m0plus -mthumb -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -std=c99 -Dgcc' + CFLAGS = DEVICE + ' -Dgcc' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' @@ -57,11 +57,15 @@ if PLATFORM == 'gcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' elif PLATFORM == 'armcc': # toolchains CC = 'armcc' + CXX = 'armcc' AS = 'armasm' AR = 'armar' LINK = 'armlink' @@ -85,11 +89,15 @@ elif PLATFORM == 'armcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' elif PLATFORM == 'iar': # toolchains CC = 'iccarm' + CXX = 'iccarm' AS = 'iasmarm' AR = 'iarchive' LINK = 'ilinkarm' @@ -130,5 +138,7 @@ elif PLATFORM == 'iar': LFLAGS = ' --config "board/linker_scripts/link.icf"' LFLAGS += ' --entry __iar_program_start' + CXXFLAGS = CFLAGS + EXEC_PATH = EXEC_PATH + '/arm/bin/' POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' diff --git a/bsp/stm32/stm32l053-st-nucleo/SConstruct b/bsp/stm32/stm32l053-st-nucleo/SConstruct index 1528fcf082083245ecb97dd0f6332d1149cf816b..b158e3828bdc2858e6931c66c0a90059a4f342e3 100644 --- a/bsp/stm32/stm32l053-st-nucleo/SConstruct +++ b/bsp/stm32/stm32l053-st-nucleo/SConstruct @@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'], AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, AR = rtconfig.AR, ARFLAGS = '-rc', + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) env.PrependENVPath('PATH', rtconfig.EXEC_PATH) diff --git a/bsp/stm32/stm32l053-st-nucleo/board/linker_scripts/link.lds b/bsp/stm32/stm32l053-st-nucleo/board/linker_scripts/link.lds index e31508b29cde5867a8c2a36441c11513993512ab..3838be73541d608d2566c5d18fed155b7b0df046 100644 --- a/bsp/stm32/stm32l053-st-nucleo/board/linker_scripts/link.lds +++ b/bsp/stm32/stm32l053-st-nucleo/board/linker_scripts/link.lds @@ -46,6 +46,14 @@ SECTIONS __rt_init_end = .; . = ALIGN(4); + + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + + . = ALIGN(4); + _etext = .; } > ROM = 0 @@ -72,6 +80,12 @@ SECTIONS *(.data.*) *(.gnu.linkonce.d*) + + PROVIDE(__dtors_start__ = .); + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + PROVIDE(__dtors_end__ = .); + . = ALIGN(4); /* This is used by the startup in order to initialize the .data secion */ _edata = . ; diff --git a/bsp/stm32/stm32l053-st-nucleo/rtconfig.py b/bsp/stm32/stm32l053-st-nucleo/rtconfig.py index 7c5cbfea7f1a1e5d1957eca8d8c890a128d41aa6..ff1b0664a58920040d1253651a4ecca95ca0ca99 100644 --- a/bsp/stm32/stm32l053-st-nucleo/rtconfig.py +++ b/bsp/stm32/stm32l053-st-nucleo/rtconfig.py @@ -44,7 +44,7 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' DEVICE = ' -mcpu=cortex-m0plus -mthumb -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -std=c99 -Dgcc' + CFLAGS = DEVICE + ' -Dgcc' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' @@ -57,11 +57,15 @@ if PLATFORM == 'gcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' elif PLATFORM == 'armcc': # toolchains CC = 'armcc' + CXX = 'armcc' AS = 'armasm' AR = 'armar' LINK = 'armlink' @@ -85,11 +89,15 @@ elif PLATFORM == 'armcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' elif PLATFORM == 'iar': # toolchains CC = 'iccarm' + CXX = 'iccarm' AS = 'iasmarm' AR = 'iarchive' LINK = 'ilinkarm' @@ -130,5 +138,7 @@ elif PLATFORM == 'iar': LFLAGS = ' --config "board/linker_scripts/link.icf"' LFLAGS += ' --entry __iar_program_start' + CXXFLAGS = CFLAGS + EXEC_PATH = EXEC_PATH + '/arm/bin/' POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' diff --git a/bsp/stm32/stm32l432-st-nucleo/SConstruct b/bsp/stm32/stm32l432-st-nucleo/SConstruct index e1989a9d815bbffd7e87d257337ad83e6e487ff4..58a36adbfcda854f736ce3ae40262f4cdf92a9b0 100644 --- a/bsp/stm32/stm32l432-st-nucleo/SConstruct +++ b/bsp/stm32/stm32l432-st-nucleo/SConstruct @@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'], AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, AR = rtconfig.AR, ARFLAGS = '-rc', + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) env.PrependENVPath('PATH', rtconfig.EXEC_PATH) diff --git a/bsp/stm32/stm32l432-st-nucleo/board/linker_scripts/link.lds b/bsp/stm32/stm32l432-st-nucleo/board/linker_scripts/link.lds index 82a4371c68fc9a8a462f78ece75b0a958a8220f6..a20112b7ef83d805ab317e45d94e6eceaaac760d 100644 --- a/bsp/stm32/stm32l432-st-nucleo/board/linker_scripts/link.lds +++ b/bsp/stm32/stm32l432-st-nucleo/board/linker_scripts/link.lds @@ -47,6 +47,14 @@ SECTIONS __rt_init_end = .; . = ALIGN(4); + + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + + . = ALIGN(4); + _etext = .; } > ROM = 0 @@ -73,6 +81,12 @@ SECTIONS *(.data.*) *(.gnu.linkonce.d*) + + PROVIDE(__dtors_start__ = .); + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + PROVIDE(__dtors_end__ = .); + . = ALIGN(4); /* This is used by the startup in order to initialize the .data secion */ _edata = . ; diff --git a/bsp/stm32/stm32l432-st-nucleo/rtconfig.py b/bsp/stm32/stm32l432-st-nucleo/rtconfig.py index d632114e2d35f232096fde113c44c96790ae288c..ae800430f2c622c858cc3a84b10097d77b1efe0f 100644 --- a/bsp/stm32/stm32l432-st-nucleo/rtconfig.py +++ b/bsp/stm32/stm32l432-st-nucleo/rtconfig.py @@ -44,7 +44,7 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -std=c99 -Dgcc' + CFLAGS = DEVICE + ' -Dgcc' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' @@ -57,11 +57,15 @@ if PLATFORM == 'gcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' elif PLATFORM == 'armcc': # toolchains CC = 'armcc' + CXX = 'armcc' AS = 'armasm' AR = 'armar' LINK = 'armlink' @@ -85,11 +89,15 @@ elif PLATFORM == 'armcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' elif PLATFORM == 'iar': # toolchains CC = 'iccarm' + CXX = 'iccarm' AS = 'iasmarm' AR = 'iarchive' LINK = 'ilinkarm' @@ -130,5 +138,7 @@ elif PLATFORM == 'iar': LFLAGS = ' --config "board/linker_scripts/link.icf"' LFLAGS += ' --entry __iar_program_start' + CXXFLAGS = CFLAGS + EXEC_PATH = EXEC_PATH + '/arm/bin/' POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' diff --git a/bsp/stm32/stm32l475-atk-pandora/SConstruct b/bsp/stm32/stm32l475-atk-pandora/SConstruct index e1989a9d815bbffd7e87d257337ad83e6e487ff4..58a36adbfcda854f736ce3ae40262f4cdf92a9b0 100644 --- a/bsp/stm32/stm32l475-atk-pandora/SConstruct +++ b/bsp/stm32/stm32l475-atk-pandora/SConstruct @@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'], AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, AR = rtconfig.AR, ARFLAGS = '-rc', + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) env.PrependENVPath('PATH', rtconfig.EXEC_PATH) diff --git a/bsp/stm32/stm32l475-atk-pandora/board/linker_scripts/link.lds b/bsp/stm32/stm32l475-atk-pandora/board/linker_scripts/link.lds index 91149a6a2f29d850ffc0b7bd4dbf29930b81a422..9017e4b0f8c240e6461078553074f40db9a9d2c2 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/linker_scripts/link.lds +++ b/bsp/stm32/stm32l475-atk-pandora/board/linker_scripts/link.lds @@ -47,6 +47,14 @@ SECTIONS __rt_init_end = .; . = ALIGN(4); + + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + + . = ALIGN(4); + _etext = .; } > ROM = 0 @@ -73,6 +81,11 @@ SECTIONS *(.data.*) *(.gnu.linkonce.d*) + PROVIDE(__dtors_start__ = .); + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + PROVIDE(__dtors_end__ = .); + . = ALIGN(4); /* This is used by the startup in order to initialize the .data secion */ _edata = . ; diff --git a/bsp/stm32/stm32l475-atk-pandora/rtconfig.py b/bsp/stm32/stm32l475-atk-pandora/rtconfig.py index d632114e2d35f232096fde113c44c96790ae288c..2b495647e4df4651ad367382c38618b61e4c4d57 100644 --- a/bsp/stm32/stm32l475-atk-pandora/rtconfig.py +++ b/bsp/stm32/stm32l475-atk-pandora/rtconfig.py @@ -44,7 +44,7 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -std=c99 -Dgcc' + CFLAGS = DEVICE + ' -Dgcc' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' @@ -57,11 +57,15 @@ if PLATFORM == 'gcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' elif PLATFORM == 'armcc': # toolchains CC = 'armcc' + CXX = 'armcc' AS = 'armasm' AR = 'armar' LINK = 'armlink' @@ -85,11 +89,16 @@ elif PLATFORM == 'armcc': else: CFLAGS += ' -O2' + + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' elif PLATFORM == 'iar': # toolchains CC = 'iccarm' + CXX = 'iccarm' AS = 'iasmarm' AR = 'iarchive' LINK = 'ilinkarm' @@ -130,5 +139,7 @@ elif PLATFORM == 'iar': LFLAGS = ' --config "board/linker_scripts/link.icf"' LFLAGS += ' --entry __iar_program_start' + CXXFLAGS = CFLAGS + EXEC_PATH = EXEC_PATH + '/arm/bin/' POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' diff --git a/bsp/stm32/stm32l475-st-discovery/SConstruct b/bsp/stm32/stm32l475-st-discovery/SConstruct index 6e29ff6ae3f788569e1328c5ea69efc61b16ad7d..1a3000812b9c3e73ea12c69a154ca85b25894b3d 100644 --- a/bsp/stm32/stm32l475-st-discovery/SConstruct +++ b/bsp/stm32/stm32l475-st-discovery/SConstruct @@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'], AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, AR = rtconfig.AR, ARFLAGS = '-rc', + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) env.PrependENVPath('PATH', rtconfig.EXEC_PATH) diff --git a/bsp/stm32/stm32l475-st-discovery/board/linker_scripts/link.lds b/bsp/stm32/stm32l475-st-discovery/board/linker_scripts/link.lds index e57d211bd1325e096527757222c8eb2930ef8fe7..a399cbe150a919002ef5a24b2706716c8827acca 100644 --- a/bsp/stm32/stm32l475-st-discovery/board/linker_scripts/link.lds +++ b/bsp/stm32/stm32l475-st-discovery/board/linker_scripts/link.lds @@ -48,6 +48,14 @@ SECTIONS __rt_init_end = .; . = ALIGN(4); + + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + + . = ALIGN(4); + _etext = .; } > ROM = 0 @@ -74,6 +82,11 @@ SECTIONS *(.data.*) *(.gnu.linkonce.d*) + PROVIDE(__dtors_start__ = .); + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + PROVIDE(__dtors_end__ = .); + . = ALIGN(4); /* This is used by the startup in order to initialize the .data secion */ _edata = . ; diff --git a/bsp/stm32/stm32l475-st-discovery/rtconfig.py b/bsp/stm32/stm32l475-st-discovery/rtconfig.py index d98a0bf18fc9e37101cfb005e81335ec9b90cd66..2876ce676183a7855a635646a21746d08fb8ad8f 100644 --- a/bsp/stm32/stm32l475-st-discovery/rtconfig.py +++ b/bsp/stm32/stm32l475-st-discovery/rtconfig.py @@ -44,7 +44,7 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -std=c99 -Dgcc' + CFLAGS = DEVICE + ' -Dgcc' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' @@ -57,11 +57,15 @@ if PLATFORM == 'gcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' elif PLATFORM == 'armcc': # toolchains CC = 'armcc' + CXX = 'armcc' AS = 'armasm' AR = 'armar' LINK = 'armlink' @@ -85,11 +89,15 @@ elif PLATFORM == 'armcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' elif PLATFORM == 'iar': # toolchains CC = 'iccarm' + CXX = 'iccarm' AS = 'iasmarm' AR = 'iarchive' LINK = 'ilinkarm' @@ -130,5 +138,7 @@ elif PLATFORM == 'iar': LFLAGS = ' --config "board/linker_scripts/link.icf"' LFLAGS += ' --entry __iar_program_start' + CXXFLAGS = CFLAGS + EXEC_PATH = EXEC_PATH + '/arm/bin/' POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' diff --git a/bsp/stm32/stm32l476-st-nucleo/SConstruct b/bsp/stm32/stm32l476-st-nucleo/SConstruct index e1989a9d815bbffd7e87d257337ad83e6e487ff4..58a36adbfcda854f736ce3ae40262f4cdf92a9b0 100644 --- a/bsp/stm32/stm32l476-st-nucleo/SConstruct +++ b/bsp/stm32/stm32l476-st-nucleo/SConstruct @@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'], AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, AR = rtconfig.AR, ARFLAGS = '-rc', + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) env.PrependENVPath('PATH', rtconfig.EXEC_PATH) diff --git a/bsp/stm32/stm32l476-st-nucleo/board/linker_scripts/link.lds b/bsp/stm32/stm32l476-st-nucleo/board/linker_scripts/link.lds index 7edc4c685597fe6981b531792471f8f8ffea24ba..312244b71e73a1e617b2ce6522fe43d735d7b4b3 100644 --- a/bsp/stm32/stm32l476-st-nucleo/board/linker_scripts/link.lds +++ b/bsp/stm32/stm32l476-st-nucleo/board/linker_scripts/link.lds @@ -47,6 +47,14 @@ SECTIONS __rt_init_end = .; . = ALIGN(4); + + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + + . = ALIGN(4); + _etext = .; } > ROM = 0 @@ -73,6 +81,11 @@ SECTIONS *(.data.*) *(.gnu.linkonce.d*) + PROVIDE(__dtors_start__ = .); + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + PROVIDE(__dtors_end__ = .); + . = ALIGN(4); /* This is used by the startup in order to initialize the .data secion */ _edata = . ; diff --git a/bsp/stm32/stm32l476-st-nucleo/rtconfig.py b/bsp/stm32/stm32l476-st-nucleo/rtconfig.py index d632114e2d35f232096fde113c44c96790ae288c..f13d785d547a1d7cdda2663f7bd13e96acab2a03 100644 --- a/bsp/stm32/stm32l476-st-nucleo/rtconfig.py +++ b/bsp/stm32/stm32l476-st-nucleo/rtconfig.py @@ -44,7 +44,7 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -std=c99 -Dgcc' + CFLAGS = DEVICE + ' -Dgcc' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' @@ -57,11 +57,15 @@ if PLATFORM == 'gcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' elif PLATFORM == 'armcc': # toolchains CC = 'armcc' + CXX = 'armcc' AS = 'armasm' AR = 'armar' LINK = 'armlink' @@ -85,11 +89,15 @@ elif PLATFORM == 'armcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' elif PLATFORM == 'iar': # toolchains CC = 'iccarm' + CXX = 'iccarm' AS = 'iasmarm' AR = 'iarchive' LINK = 'ilinkarm' @@ -129,6 +137,8 @@ elif PLATFORM == 'iar': LFLAGS = ' --config "board/linker_scripts/link.icf"' LFLAGS += ' --entry __iar_program_start' + + CXXFLAGS = CFLAGS EXEC_PATH = EXEC_PATH + '/arm/bin/' POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' diff --git a/bsp/stm32/stm32l496-ali-developer/SConstruct b/bsp/stm32/stm32l496-ali-developer/SConstruct index e1989a9d815bbffd7e87d257337ad83e6e487ff4..58a36adbfcda854f736ce3ae40262f4cdf92a9b0 100644 --- a/bsp/stm32/stm32l496-ali-developer/SConstruct +++ b/bsp/stm32/stm32l496-ali-developer/SConstruct @@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'], AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, AR = rtconfig.AR, ARFLAGS = '-rc', + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) env.PrependENVPath('PATH', rtconfig.EXEC_PATH) diff --git a/bsp/stm32/stm32l496-ali-developer/board/linker_scripts/link.lds b/bsp/stm32/stm32l496-ali-developer/board/linker_scripts/link.lds index 2047b8e1664b2673d61af83021b5916586c62e79..941ff06a51b23e881cf0a87bd120850b2986f004 100644 --- a/bsp/stm32/stm32l496-ali-developer/board/linker_scripts/link.lds +++ b/bsp/stm32/stm32l496-ali-developer/board/linker_scripts/link.lds @@ -46,6 +46,14 @@ SECTIONS __rt_init_end = .; . = ALIGN(4); + + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + + . = ALIGN(4); + _etext = .; } > ROM = 0 @@ -72,6 +80,11 @@ SECTIONS *(.data.*) *(.gnu.linkonce.d*) + PROVIDE(__dtors_start__ = .); + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + PROVIDE(__dtors_end__ = .); + . = ALIGN(4); /* This is used by the startup in order to initialize the .data secion */ _edata = . ; diff --git a/bsp/stm32/stm32l496-ali-developer/rtconfig.py b/bsp/stm32/stm32l496-ali-developer/rtconfig.py index d632114e2d35f232096fde113c44c96790ae288c..ae800430f2c622c858cc3a84b10097d77b1efe0f 100644 --- a/bsp/stm32/stm32l496-ali-developer/rtconfig.py +++ b/bsp/stm32/stm32l496-ali-developer/rtconfig.py @@ -44,7 +44,7 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -std=c99 -Dgcc' + CFLAGS = DEVICE + ' -Dgcc' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' @@ -57,11 +57,15 @@ if PLATFORM == 'gcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' elif PLATFORM == 'armcc': # toolchains CC = 'armcc' + CXX = 'armcc' AS = 'armasm' AR = 'armar' LINK = 'armlink' @@ -85,11 +89,15 @@ elif PLATFORM == 'armcc': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' elif PLATFORM == 'iar': # toolchains CC = 'iccarm' + CXX = 'iccarm' AS = 'iasmarm' AR = 'iarchive' LINK = 'ilinkarm' @@ -130,5 +138,7 @@ elif PLATFORM == 'iar': LFLAGS = ' --config "board/linker_scripts/link.icf"' LFLAGS += ' --entry __iar_program_start' + CXXFLAGS = CFLAGS + EXEC_PATH = EXEC_PATH + '/arm/bin/' POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'