EFM32 程序的自动编译和烧写

物联网 微控制器 机器学习 供应
2021-06-22 12:45:16

我正在做一个机器学习项目,我需要收集一些有关 EFM32 微控制器 (EZR32LG) 运行时间的数据。

在收集了一个小数据集并意识到我需要更多(更多)数据后,我决定将数据收集过程自动化。我已经设法自动化了大部分,但我坚持做一件事。

之前,我使用 Simplicity Studio IDE 手动编译、刷写和运行我的代码/设备,但是,由于我需要大量数据,因此我也想将其自动化。

我尝试对 Simplicity Studio 的 makefile 等进行逆向工程,但我对它们有点不知所措,所以我想尝试不同的方法。

我需要运行哪些命令才能为我的微控制器(Silicon Labs EZR32LG、SLWSTK6200A_EZR32LG)编译、链接和刷新二进制文件?

我已经找到了可以用来刷新我的软件的命令行工具(Simplicity Commander),但是我对 IDE 使用的所有 GCC 命令感到有些不知所措,是否有任何不必要的命令/选项或我需要的东西可以没有吗?

如果有人想知道,以下是 Simplicity Studio 似乎为了编译/链接程序而运行的命令:

make -j4 all

arm-none-eabi-gcc -g -gdwarf-2 -mcpu=cortex-m3 -mthumb '-DEZR32LG330F256R60=1' '-DDEBUG=1' -I"C:/SiliconLabs/SimplicityStudio/v3/developer/sdks/efm32/v2/CMSIS/Include" -I"C:/SiliconLabs/SimplicityStudio/v3/developer/sdks/efm32/v2/kits/common/bsp" -I"C:/SiliconLabs/SimplicityStudio/v3/developer/sdks/efm32/v2/emlib/inc" -I"C:/SiliconLabs/SimplicityStudio/v3/developer/sdks/efm32/v2/kits/common/drivers" -I"C:/SiliconLabs/SimplicityStudio/v3/developer/sdks/efm32/v2/Device/SiliconLabs/EZR32LG/Include" -I"C:/SiliconLabs/SimplicityStudio/v3/developer/sdks/efm32/v2/kits/SLWSTK6200A_EZR32LG/config" -O0 -Wall -c -fmessage-length=0 -mno-sched-prolog -fno-builtin -ffunction-sections -fdata-sections -std=c99 -MMD -MP -MF"src/bsort.d" -MT"src/bsort.o" -o "src/bsort.o" "../src/bsort.c"

arm-none-eabi-gcc -g -gdwarf-2 -mcpu=cortex-m3 -mthumb '-DEZR32LG330F256R60=1' '-DDEBUG=1' -I"C:/SiliconLabs/SimplicityStudio/v3/developer/sdks/efm32/v2/CMSIS/Include" -I"C:/SiliconLabs/SimplicityStudio/v3/developer/sdks/efm32/v2/kits/common/bsp" -I"C:/SiliconLabs/SimplicityStudio/v3/developer/sdks/efm32/v2/emlib/inc" -I"C:/SiliconLabs/SimplicityStudio/v3/developer/sdks/efm32/v2/kits/common/drivers" -I"C:/SiliconLabs/SimplicityStudio/v3/developer/sdks/efm32/v2/Device/SiliconLabs/EZR32LG/Include" -I"C:/SiliconLabs/SimplicityStudio/v3/developer/sdks/efm32/v2/kits/SLWSTK6200A_EZR32LG/config" -O0 -Wall -c -fmessage-length=0 -mno-sched-prolog -fno-builtin -ffunction-sections -fdata-sections -std=c99 -MMD -MP -MF"src/bsort_block_r129-130.d" -MT"src/bsort_block_r129-130.o" -o "src/bsort_block_r129-130.o" "../src/bsort_block_r129-130.c"

arm-none-eabi-gcc -g -gdwarf-2 -mcpu=cortex-m3 -mthumb -T "External_Test.ld" -Xlinker --gc-sections -Xlinker -Map="External_Test.map" --specs=nano.specs -o External_Test.axf "./src/bsort.o" "./src/bsort_block_r129-130.o" "./emlib/em_cmu.o" "./emlib/em_gpio.o" "./emlib/em_system.o" "./CMSIS/ezr32lg/startup_ezr32lg.o" "./CMSIS/ezr32lg/system_ezr32lg.o" -Wl,--start-group -lgcc -lc -lnosys -Wl,--end-group

arm-none-eabi-objcopy -O ihex "External_Test.axf" "External_Test.hex"

arm-none-eabi-objcopy -O binary "External_Test.axf" "External_Test.bin"

arm-none-eabi-size "External_Test.axf"

这是生成文件:

################################################################################
# Automatically-generated file. Do not edit!
################################################################################

-include ../makefile.init

RM := rm -rf

# All of the sources participating in the build are defined here
-include sources.mk
-include src/subdir.mk
-include emlib/subdir.mk
-include CMSIS/ezr32lg/subdir.mk
-include subdir.mk
-include objects.mk

ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
endif

-include ../makefile.defs

# Add inputs and outputs from these tool invocations to the build variables 

# All Target
all: External_Test.axf

# Tool invocations
External_Test.axf: $(OBJS) $(USER_OBJS)
    @echo 'Building target: $@'
    @echo 'Invoking: GNU ARM C Linker'
    arm-none-eabi-gcc -g -gdwarf-2 -mcpu=cortex-m3 -mthumb -T "External_Test.ld" -Xlinker --gc-sections -Xlinker -Map="External_Test.map" --specs=nano.specs -o External_Test.axf "./src/jfdctint.o" "./src/jfdctint_block_15.o" "./emlib/em_cmu.o" "./emlib/em_gpio.o" "./emlib/em_system.o" "./CMSIS/ezr32lg/startup_ezr32lg.o" "./CMSIS/ezr32lg/system_ezr32lg.o" -Wl,--start-group -lgcc -lc -lnosys -Wl,--end-group
    @echo 'Finished building target: $@'
    @echo ' '

    @echo 'Building hex file: External_Test.hex'
    arm-none-eabi-objcopy -O ihex "External_Test.axf" "External_Test.hex"
    @echo ' '

    @echo 'Building bin file: External_Test.bin'
    arm-none-eabi-objcopy -O binary "External_Test.axf" "External_Test.bin"
    @echo ' '

    @echo 'Running size tool'
    arm-none-eabi-size "External_Test.axf"
    @echo ' '

# Other Targets
clean:
    -$(RM) $(OBJS)$(C_DEPS)$(EXECUTABLES) External_Test.axf
    -@echo ' '

.PHONY: all clean dependents
.SECONDARY:

-include ../makefile.targets

自动化 make 命令并替换 makefile 中的某些内容不会有太大问题,但是在查看(600 多行)链接器映射时,我有点害怕。

(200 多行)链接器脚本也是如此...

我意识到我正在构建我的程序的调试版本,这是有意的,将来可能会改变。

我还忘了提到我之前的自动化(以及我正在集成的框架)是用 Java 编写的,因此 Java 解决方案是必须的。

编辑:我只是注意到命令和 makefile 来自不同的“运行”,如果您将命令段落中的“bsort”一词替换为 jfdctint 并记住文件名中的数字或多或少是随机的,您将获得与 makefile 匹配的运行命令。

我不知道这是否是要问的正确网站,它似乎是最合适的,如有必要,请随时移动我的问题。

0个回答
没有发现任何回复~