From 791527caca746633fb28119a7c8987e297fe27df Mon Sep 17 00:00:00 2001 From: shuobatian Date: Mon, 11 Jan 2021 20:07:12 +0800 Subject: [PATCH 1/5] add armclang support --- bsp/stm32/stm32l475-atk-pandora/rtconfig.py | 33 +++++++++++++++++++++ components/drivers/spi/SConscript | 5 +++- libcpu/arm/cortex-m4/SConscript | 3 ++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/bsp/stm32/stm32l475-atk-pandora/rtconfig.py b/bsp/stm32/stm32l475-atk-pandora/rtconfig.py index f09dfbc3b7..ebf70be1e2 100644 --- a/bsp/stm32/stm32l475-atk-pandora/rtconfig.py +++ b/bsp/stm32/stm32l475-atk-pandora/rtconfig.py @@ -94,6 +94,39 @@ elif PLATFORM == 'armcc': POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' +elif PLATFORM == 'armclang': + # toolchains + CC = 'armclang' + CXX = 'armclang' + AS = 'armasm' + AR = 'armar' + LINK = 'armlink' + TARGET_EXT = 'axf' + + DEVICE = ' --cpu Cortex-M4.fp ' + CFLAGS = '-c ' + DEVICE + ' --apcs=interwork --c99' + AFLAGS = DEVICE + ' --apcs=interwork ' + LFLAGS = DEVICE + ' --info sizes --info totals --info unused --info veneers --list rt-thread.map --strict --scatter "board\linker_scripts\link.sct"' + CFLAGS += ' -I' + EXEC_PATH + '/ARM/ARMCLANG/include' + LFLAGS += ' --libpath=' + EXEC_PATH + '/ARM/ARMCLANG/lib' + + CFLAGS += ' -D__MICROLIB ' + AFLAGS += ' --pd "__MICROLIB SETA 1" ' + LFLAGS += ' --library_type=microlib ' + EXEC_PATH += '/ARM/ARMCLANG/bin/' + + if BUILD == 'debug': + CFLAGS += ' -g -O0' + AFLAGS += ' -g' + 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' diff --git a/components/drivers/spi/SConscript b/components/drivers/spi/SConscript index e19f30861f..d6cb93f7f1 100644 --- a/components/drivers/spi/SConscript +++ b/components/drivers/spi/SConscript @@ -28,7 +28,10 @@ if GetDepend('RT_USING_SFUD'): if rtconfig.CROSS_TOOL == 'gcc': LOCAL_CCFLAGS += ' -std=c99' elif rtconfig.CROSS_TOOL == 'keil': - LOCAL_CCFLAGS += ' --c99' + if rtconfig.PLATFORM == 'armcc': + LOCAL_CCFLAGS += ' --c99' + elif rtconfig.PLATFORM == 'armclang': + LOCAL_CCFLAGS += ' -std=c99' src += src_device diff --git a/libcpu/arm/cortex-m4/SConscript b/libcpu/arm/cortex-m4/SConscript index 9ff30a796b..d03dfb9c07 100644 --- a/libcpu/arm/cortex-m4/SConscript +++ b/libcpu/arm/cortex-m4/SConscript @@ -11,6 +11,9 @@ CPPPATH = [cwd] if rtconfig.PLATFORM == 'armcc': src += Glob('*_rvds.S') +if rtconfig.PLATFORM == 'armclang': + src += Glob('*_rvds.S') + if rtconfig.PLATFORM == 'gcc': src += Glob('*_init.S') src += Glob('*_gcc.S') From 94b5d009d1bae885d4a765b5786b4f34a823269d Mon Sep 17 00:00:00 2001 From: shuobatian Date: Mon, 11 Jan 2021 22:36:30 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=B8=8D=E4=BD=BF=E7=94=A8microlib?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/stm32/stm32l475-atk-pandora/rtconfig.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/bsp/stm32/stm32l475-atk-pandora/rtconfig.py b/bsp/stm32/stm32l475-atk-pandora/rtconfig.py index ebf70be1e2..eeabd79bcf 100644 --- a/bsp/stm32/stm32l475-atk-pandora/rtconfig.py +++ b/bsp/stm32/stm32l475-atk-pandora/rtconfig.py @@ -110,9 +110,6 @@ elif PLATFORM == 'armclang': CFLAGS += ' -I' + EXEC_PATH + '/ARM/ARMCLANG/include' LFLAGS += ' --libpath=' + EXEC_PATH + '/ARM/ARMCLANG/lib' - CFLAGS += ' -D__MICROLIB ' - AFLAGS += ' --pd "__MICROLIB SETA 1" ' - LFLAGS += ' --library_type=microlib ' EXEC_PATH += '/ARM/ARMCLANG/bin/' if BUILD == 'debug': From 7018a5c297ec812c5e7ae2c8ba891c5733bee64a Mon Sep 17 00:00:00 2001 From: shuobatian Date: Wed, 13 Jan 2021 21:47:40 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9armclang=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E5=8F=82=E6=95=B0=EF=BC=8Cdebug=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E7=AD=89=E7=BA=A7-O1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/stm32/stm32l475-atk-pandora/rtconfig.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/bsp/stm32/stm32l475-atk-pandora/rtconfig.py b/bsp/stm32/stm32l475-atk-pandora/rtconfig.py index eeabd79bcf..3b9f456d47 100644 --- a/bsp/stm32/stm32l475-atk-pandora/rtconfig.py +++ b/bsp/stm32/stm32l475-atk-pandora/rtconfig.py @@ -104,23 +104,26 @@ elif PLATFORM == 'armclang': TARGET_EXT = 'axf' DEVICE = ' --cpu Cortex-M4.fp ' - CFLAGS = '-c ' + DEVICE + ' --apcs=interwork --c99' + CFLAGS = ' -xc -std=c99 --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 --list rt-thread.map --strict --scatter "board\linker_scripts\link.sct"' + LFLAGS = DEVICE + ' --info sizes --info totals --info unused --info veneers ' + LFLAGS += ' --list rt-thread.map ' + LFLAGS += ' --strict --scatter "board\linker_scripts\link.sct" ' CFLAGS += ' -I' + EXEC_PATH + '/ARM/ARMCLANG/include' LFLAGS += ' --libpath=' + EXEC_PATH + '/ARM/ARMCLANG/lib' EXEC_PATH += '/ARM/ARMCLANG/bin/' if BUILD == 'debug': - CFLAGS += ' -g -O0' + CFLAGS += ' -g -O1' # armclang recommend AFLAGS += ' -g' else: CFLAGS += ' -O2' - - - CXXFLAGS = CFLAGS - CFLAGS += ' -std=c99' + + CXXFLAGS = CFLAGS POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' From ed28e65b7e57eb2e08509df4a194a97f6d2c6c16 Mon Sep 17 00:00:00 2001 From: shuobatian Date: Wed, 13 Jan 2021 21:55:25 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E9=98=B2=E6=AD=A2=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E8=BD=AC=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/stm32/stm32l475-atk-pandora/rtconfig.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bsp/stm32/stm32l475-atk-pandora/rtconfig.py b/bsp/stm32/stm32l475-atk-pandora/rtconfig.py index 3b9f456d47..386d34feb9 100644 --- a/bsp/stm32/stm32l475-atk-pandora/rtconfig.py +++ b/bsp/stm32/stm32l475-atk-pandora/rtconfig.py @@ -73,7 +73,7 @@ elif PLATFORM == 'armcc': DEVICE = ' --cpu Cortex-M4.fp ' CFLAGS = '-c ' + DEVICE + ' --apcs=interwork --c99' AFLAGS = DEVICE + ' --apcs=interwork ' - LFLAGS = DEVICE + ' --info sizes --info totals --info unused --info veneers --list rt-thread.map --strict --scatter "board\linker_scripts\link.sct"' + LFLAGS = DEVICE + r' --info sizes --info totals --info unused --info veneers --list rt-thread.map --strict --scatter "board\linker_scripts\link.sct"' CFLAGS += ' -I' + EXEC_PATH + '/ARM/ARMCC/include' LFLAGS += ' --libpath=' + EXEC_PATH + '/ARM/ARMCC/lib' @@ -111,7 +111,7 @@ elif PLATFORM == 'armclang': AFLAGS = DEVICE + ' --apcs=interwork ' LFLAGS = DEVICE + ' --info sizes --info totals --info unused --info veneers ' LFLAGS += ' --list rt-thread.map ' - LFLAGS += ' --strict --scatter "board\linker_scripts\link.sct" ' + LFLAGS += r' --strict --scatter "board\linker_scripts\link.sct" ' CFLAGS += ' -I' + EXEC_PATH + '/ARM/ARMCLANG/include' LFLAGS += ' --libpath=' + EXEC_PATH + '/ARM/ARMCLANG/lib' From b546e25f9f47e9a302f43a6adebf76b7dd54eb95 Mon Sep 17 00:00:00 2001 From: shuobatian Date: Wed, 13 Jan 2021 21:59:02 +0800 Subject: [PATCH 5/5] =?UTF-8?q?armcc=20=E9=93=BE=E6=8E=A5=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/stm32/stm32l475-atk-pandora/rtconfig.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bsp/stm32/stm32l475-atk-pandora/rtconfig.py b/bsp/stm32/stm32l475-atk-pandora/rtconfig.py index 386d34feb9..9314a28375 100644 --- a/bsp/stm32/stm32l475-atk-pandora/rtconfig.py +++ b/bsp/stm32/stm32l475-atk-pandora/rtconfig.py @@ -73,7 +73,8 @@ elif PLATFORM == 'armcc': DEVICE = ' --cpu Cortex-M4.fp ' CFLAGS = '-c ' + DEVICE + ' --apcs=interwork --c99' AFLAGS = DEVICE + ' --apcs=interwork ' - LFLAGS = DEVICE + r' --info sizes --info totals --info unused --info veneers --list rt-thread.map --strict --scatter "board\linker_scripts\link.sct"' + LFLAGS = DEVICE + ' --info sizes --info totals --info unused --info veneers --list rt-thread.map ' + LFLAGS += r' --strict --scatter "board\linker_scripts\link.sct" ' CFLAGS += ' -I' + EXEC_PATH + '/ARM/ARMCC/include' LFLAGS += ' --libpath=' + EXEC_PATH + '/ARM/ARMCC/lib'