硬件测试环境 pdd 不久前搞活动, 99 块买了两块阿里出的 L469 的开发板,最高主频为 80Mhz。所以本次测试硬件就使用该开发板进行测试。
工具准备 使用 git 工具下载 llvm 工具链 下载 make 工具
编译 在 rt-threadspSTM32stm32l496-ali-developer 目录下打开 env 工具: 使用命令 scons --target=cmake 生成 CMakelists.txt 文件: 这里的命令生成的 CMake 文件使用的是 gcc 的工具链,需要修改一下使用 llvm 的工具链: SET(CMAKE_C_COMPILER "D:/download/idm/LLVMEmbeddedToolchainForArm-13.0.0-windows/LLVMEmbeddedToolchainForArm-13.0.0/bin/clang.exe") SET(CMAKE_ASM_COMPILER "D:/download/idm/LLVMEmbeddedToolchainForArm-13.0.0-windows/LLVMEmbeddedToolchainForArm-13.0.0/bin/clang.exe") SET(CMAKE_C_FLAGS "--config armv7em_hard_fpv4_sp_d16_nosys -Os") SET(CMAKE_ASM_FLAGS " -c --config armv7em_hard_fpv4_sp_d16_nosys -Wa,-mimplicit-it=thumb") SET(CMAKE_C_COMPILER_WORKS TRUE) SET(CMAKE_CXX_COMPILER "D:/download/idm/LLVMEmbeddedToolchainForArm-13.0.0-windows/LLVMEmbeddedToolchainForArm-13.0.0/bin/clang++.exe") SET(CMAKE_CXX_FLAGS "--config armv7em_hard_fpv4_sp_d16_nosys -Os") SET(CMAKE_CXX_COMPILER_WORKS TRUE) SET(CMAKE_OBJCOPY "D:/download/idm/LLVMEmbeddedToolchainForArm-13.0.0-windows/LLVMEmbeddedToolchainForArm-13.0.0/bin/llvm-objcopy.exe") SET(CMAKE_SIZE "D:/download/idm/LLVMEmbeddedToolchainForArm-13.0.0-windows/LLVMEmbeddedToolchainForArm-13.0.0/bin/llvm-size.exe") SET(CMAKE_EXE_LINKER_FLAGS "--config armv7em_hard_fpv4_sp_d16_nosys ,--gc-sections,-Map=rtthread.map,-u,Reset_Handler -T ${CMAKE_SOURCE_DIR}/board/linker_scripts/link.lds") 输入命令 cd build & cmake -G "MinGW Makefiles" .. & D:software oolsxpack-windows-build-tools-2.12.2inmake.exe 编译工程: LiuKang@DESKTOP-538H6DE D:
epogithub
t-threadspstm32stm32l496-ali-developer $ cd build LiuKang@DESKTOP-538H6DE D:
epogithub
t-threadspstm32stm32l496-ali-developeruild $ cmake -G "MinGW Makefiles" .. -- Configuring done -- Generating done -- Build files have been written to: D:/repo/github/rt-thread/bsp/stm32/stm32l496-ali-developer/build LiuKang@DESKTOP-538H6DE D:
epogithub
t-threadspstm32stm32l496-ali-developeruild $ D:software oolsxpack-windows-build-tools-2.12.2inmake.exe [ 1%] Building C object CMakeFiles/rtthread.elf.dir/applications/main.c.obj [ 2%] Building C object CMakeFiles/rtthread.elf.dir/packages/CoreMark-latest/core_main.c.obj [ 4%] Building C object CMakeFiles/rtthread.elf.dir/packages/CoreMark-latest/core_util.c.obj [ 5%] Building C object CMakeFiles/rtthread.elf.dir/packages/CoreMark-latest/core_portme.c.obj [ 7%] Building C object CMakeFiles/rtthread.elf.dir/packages/CoreMark-latest/core_list_join.c.obj [ 8%] Building C object CMakeFiles/rtthread.elf.dir/packages/CoreMark-latest/core_state.c.obj [ 10%] Building C object CMakeFiles/rtthread.elf.dir/packages/CoreMark-latest/core_matrix.c.obj [ 11%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/libcpu/arm/common/showmem.c.obj [ 13%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/libcpu/arm/common/div0.c.obj [ 14%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/libcpu/arm/common/backtrace.c.obj [ 15%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/libcpu/arm/cortex-m4/cpuport.c.obj [ 17%] Building ASM object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/libcpu/arm/cortex-m4/context_gcc.S.obj [ 18%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/components/drivers/misc/pin.c.obj [ 20%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/components/drivers/serial/serial.c.obj [ 21%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/components/drivers/src/dataqueue.c.obj [ 23%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/components/drivers/src/ringblk_buf.c.obj [ 24%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/components/drivers/src/ringbuffer.c.obj [ 26%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/components/drivers/src/waitqueue.c.obj [ 27%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/components/drivers/src/completion.c.obj [ 28%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/components/drivers/src/pipe.c.obj [ 30%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/components/drivers/src/workqueue.c.obj [ 31%] Building ASM object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/bsp/stm32/libraries/STM32L4xx_HAL/CMSIS/Device/ST/STM32L4xx/Source/Templates/gcc/startup_stm32l496xx.s.obj clang: warning: argument unused during compilation: '-D HAVE_CCONFIG_H' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-D RT_USING_NEWLIB' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-D STM32L496xx' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-D USE_HAL_DRIVER' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-D __RTTHREAD__' [-Wunused-command-line-argument] [ 33%] Building C object CMakeFiles/rtthread.elf.dir/board/CubeMX_Config/Src/stm32l4xx_hal_msp.c.obj [ 34%] Building C object CMakeFiles/rtthread.elf.dir/board/board.c.obj [ 36%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/bsp/stm32/libraries/HAL_Drivers/drv_gpio.c.obj [ 37%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/bsp/stm32/libraries/HAL_Drivers/drv_usart.c.obj [ 39%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/bsp/stm32/libraries/HAL_Drivers/drv_common.c.obj [ 40%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/components/finsh/shell.c.obj [ 42%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/components/finsh/msh.c.obj [ 43%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/components/finsh/cmd.c.obj [ 44%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/src/idle.c.obj [ 46%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/src/kservice.c.obj [ 47%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/src/scheduler.c.obj [ 49%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/src/irq.c.obj [ 50%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/src/timer.c.obj [ 52%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/src/mempool.c.obj [ 53%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/src/ipc.c.obj [ 55%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/src/device.c.obj [ 56%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/src/clock.c.obj [ 57%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/src/thread.c.obj [ 59%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/src/mem.c.obj [ 60%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/src/components.c.obj [ 62%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/src/object.c.obj [ 63%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/components/libc/compilers/common/stdlib.c.obj [ 65%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/components/libc/compilers/common/time.c.obj [ 66%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/components/libc/compilers/gcc/newlib/syscalls.c.obj [ 68%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/components/libc/compilers/gcc/newlib/libc_syms.c.obj [ 69%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/bsp/stm32/libraries/STM32L4xx_HAL/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cryp.c.obj [ 71%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/bsp/stm32/libraries/STM32L4xx_HAL/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c.obj [ 72%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/bsp/stm32/libraries/STM32L4xx_HAL/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_usart.c.obj [ 73%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/bsp/stm32/libraries/STM32L4xx_HAL/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c.obj [ 75%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/bsp/stm32/libraries/STM32L4xx_HAL/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c.obj [ 76%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/bsp/stm32/libraries/STM32L4xx_HAL/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c.obj [ 78%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/bsp/stm32/libraries/STM32L4xx_HAL/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c.obj [ 79%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/bsp/stm32/libraries/STM32L4xx_HAL/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c.obj [ 81%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/bsp/stm32/libraries/STM32L4xx_HAL/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.c.obj [ 82%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/bsp/stm32/libraries/STM32L4xx_HAL/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma_ex.c.obj [ 84%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/bsp/stm32/libraries/STM32L4xx_HAL/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_exti.c.obj [ 85%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/bsp/stm32/libraries/STM32L4xx_HAL/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_crc.c.obj [ 86%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/bsp/stm32/libraries/STM32L4xx_HAL/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c.obj [ 88%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/bsp/stm32/libraries/STM32L4xx_HAL/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_usart_ex.c.obj [ 89%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/bsp/stm32/libraries/STM32L4xx_HAL/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.c.obj [ 91%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/bsp/stm32/libraries/STM32L4xx_HAL/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_crc_ex.c.obj [ 92%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/bsp/stm32/libraries/STM32L4xx_HAL/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_comp.c.obj [ 94%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/bsp/stm32/libraries/STM32L4xx_HAL/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c.obj [ 95%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/bsp/stm32/libraries/STM32L4xx_HAL/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rng.c.obj [ 97%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/bsp/stm32/libraries/STM32L4xx_HAL/CMSIS/Device/ST/STM32L4xx/Source/Templates/system_stm32l4xx.c.obj [ 98%] Building C object CMakeFiles/rtthread.elf.dir/D_/repo/github/rt-thread/bsp/stm32/libraries/STM32L4xx_HAL/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cryp_ex.c.obj [100%] Linking C executable rtthread.elf clang: warning: argument unused during compilation: '-Wa,-mimplicit-it=thumb' [-Wunused-command-line-argument] text data bss dec hex filename 117152 2864 1844 121860 1dc04 rtthread.elf [100%] Built target rtthread.elf 下载 bin 文件到开发板: llvm 的编译下载就完成啦
跑分测试 使用 LLVM、GCC、IAR 三种工具链编译出来的可执行文件,测试一下跑分情况: GCC 5.4.1 优化等级:-Os GCC 10.3.1 优化等级:-Os LLVM 优化等级:-Os IAR 优化等级: IAR 跑分情况 MDK 优化等级: MDK AC6 跑分情况 跑分排名 IAR (199.94) > MDK AC6 (160.74) > LLVM (159.24) > GCC 5.4.1 (143.1.8) > GCC 10.3.1 (136.48)
原作者:Papalymo
|