2

I'm working a Machine Learning project, and I need to gather some data about the run-time of an EFM32 Microcontroller (EZR32LG).

After gathering a small dataset and realizing I need more (A lot more) data, I decided I'd automate the data-gathering process. I've managed to automate most of it, but I'm stuck on one thing.

Before, I used the Simplicity Studio IDE to manually compile, flash and run my code/device, however, since I need a lot of data, I'd like to automate this as well.

I tried reverse-engineering Simplicity Studio's makefiles etc., but I was a bit overwhelmed by them, so I'd like to try a different approach.

What commands do I need to run in order to compile, link and flash a binary for my microcontroller (Silicon Labs EZR32LG, SLWSTK6200A_EZR32LG)?

I've already found the command-line-tool I can use to flash my software (Simplicity Commander), but I'm a bit overwhelmed by all the GCC commands the IDE uses, are there any unnecessary commands/options or things that I could do without?

In case anyone is wondering, here are the commands Simplicity Studio seems to run in order to compile/link a program:

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"

Here's the makefile:

################################################################################
# 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

Automating the make command and substituting some things in the makefile wouldn't be too much of an issue, but when looking at the (600+ line) linker map is where I get a bit intimidated.

The same goes for the (200+ line) linker script...

I realize I'm building a debug version of my program, this is intentional and could change in the future.

I also forgot to mention that my previous automation (and the framework I'm integrating into) is written in Java, so Java solutions are a must.

Edit: I just noticed that the commands and the makefile are from different 'runs', if you replace the word 'bsort' in the commands-paragraph with the word jfdctint and keep in mind that the numbers in the filenames are more or less random, you'd get the commands for the run that matches the makefile.

I don't know if this is the correct site to ask, it just seemed like the best fit, feel free to move my question if necessary.

1
  • 3
    Although we may not have a strong population who can answer this question, I think provisioning is on topic for IoT. Apr 16 '18 at 6:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.