name=Aldan 1 Mikro-M Boards
version=1.0.0


# Compile variables
# ---------------------

compiler.warning_flags=-w
compiler.warning_flags.none=-w
compiler.warning_flags.default=
compiler.warning_flags.more=-Wall
compiler.warning_flags.all=-Wall -Wextra

compiler.path={runtime.tools.gcc-arm-none-eabi.path}/bin/
compiler.extra_includes="-I{build.core.path}/system" "-I{build.core.path}/system/CMSIS/Include" "-I{build.core.path}/system/CMSIS/Source" "-I{build.core.path}/system/StdPeriph_Driver/inc" "-I{build.core.path}/system/StdPeriph_Driver/src" "-I{build.core.path}/system/StdPeriph_Driver/inc/USB_Library" "-I{build.core.path}/system/StdPeriph_Driver/src/USB_Library" "-I{build.core.path}/aldan"
compiler.flags=-c -mcpu={build.mcu} -mthumb -gdwarf-2 -MD -MMD -MP -MF -Wall "-Og" "-g" -mapcs-frame -mthumb-interwork -fdata-sections -ffunction-sections -DUSE_MDR32F9Qx -D__STARTUP_CLEAR_BSS -D_start=main -pipe -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -MMD {compiler.extra_includes}

compiler.c.cmd=arm-none-eabi-gcc
compiler.c.flags={compiler.flags} -std=c99
compiler.c.elf.cmd=arm-none-eabi-gcc
compiler.c.elf.flags="-mcpu={build.mcu}" "-T{build.core.path}/system/linker_scripts/MDR32F9Qx.ld" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.c.elf.extra_flags} {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" "-L{build.path}" -Wl,--start-group {object_files} -Wl,--whole-archive "{build.path}/{archive_file}" -Wl,--no-whole-archive -lc -lstdc++ -Wl,--end-group -lm -lgcc --specs=nano.specs --specs=nosys.specs "-Wl,--print-memory-usage" -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -ffreestanding

compiler.S.cmd=arm-none-eabi-gcc
compiler.S.flags={compiler.flags} -std=c99

compiler.cpp.cmd=arm-none-eabi-g++
compiler.cpp.flags={compiler.flags} -std=c++11 -fno-exceptions -fno-threadsafe-statics

compiler.ar.cmd=arm-none-eabi-ar
compiler.ar.flags=rcs

compiler.objcopy.cmd=arm-none-eabi-objcopy

compiler.elf2hex.cmd=arm-none-eabi-objcopy
compiler.elf2hex.bin.flags=-O binary
compiler.elf2hex.hex.flags=-O ihex

compiler.ldflags=
compiler.size.cmd=arm-none-eabi-size
compiler.define=-DARDUINO=
compiler.readelf.cmd=arm-none-eabi-readelf

compiler.c.elf.extra_flags=
compiler.cpp.extra_flags=
compiler.c.extra_flags=
compiler.S.extra_flags=
compiler.ar.extra_flags=
compiler.elf2hex.extra_flags=


# Compile patterns
# -----------------------
## Compile c files
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} {compiler.c.extra_flags} {includes} "{source_file}" -o "{object_file}"

## Compile c++ files
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} {compiler.cpp.extra_flags} {includes} "{source_file}" -o "{object_file}"

## Compile S files
recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} {compiler.S.extra_flags} {includes} "{source_file}" -o "{object_file}"

## Create archives
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"

## Combine gc-sections, archives, and objects
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} 

## Create output files (.eep and .hex)
recipe.objcopy.bin.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.bin.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin"
recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex"

## Compute size
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
recipe.size.regex=^(?:\.text|\.rodata|\.ARM.exidx)\s+([0-9]+).*
recipe.size.regex.data=^(?:\.data|\.bss|\.noinit)\s+([0-9]+).*

## Save hex
recipe.output.tmp_file={build.project_name}.{build.preferred_out_format}
recipe.output.save_file={build.project_name}.{build.variant}.{build.preferred_out_format}

## Preprocessor
preproc.includes.flags=-w -x c++ -M -MG -MP
recipe.preproc.includes="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} {preproc.includes.flags} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {includes} "{source_file}"

preproc.macros.flags=-w -x c++ -E -CC
recipe.preproc.macros="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} {preproc.macros.flags} {compiler.cpp.extra_flags} {includes} "{source_file}" -o "{preprocessed_file_path}"


# Required discoveries and monitors
# ---------------------------------
pluggable_discovery.required.0=builtin:serial-discovery
pluggable_discovery.required.1=builtin:mdns-discovery
pluggable_monitor.required.serial=builtin:serial-monitor


# USB Default Flags
# Default blank usb manufacturer will be filled in at compile time
# - from numeric vendor ID, set to Unknown otherwise
build.usb_manufacturer="Unknown"
build.usb_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}'


# Uploader/Programmers tools
# ------------------------------
tools.rp.cmd=Programmer
tools.rp.cmd.windows=Programmer.exe
tools.rp.path={runtime.tools.Programmer.path}
tools.rp.path.windows={runtime.tools.Programmer.path}

# tools.rp.upload.verify is needed for backwards compatibility with IDE 1.6.8 or older, IDE 1.6.9 or newer overrides this value
tools.rp.upload.verify=
tools.rp.upload.params.verbose=-d
tools.rp.upload.params.quiet=
tools.rp.upload.params="--english" "--erase" "--load" "--run" "--speed" "0" "--port" "{serial.port}"
tools.rp.upload.pattern="{path}/{cmd}" "{runtime.tools.bootloaders.path}/MDR32F9Qx_default.hex" "{build.path}/{build.project_name}.hex" {tools.rp.upload.params}

#tools.rp.program.verify=
#tools.rp.program.params.verbose=-d
#tools.rp.program.params.quiet=
#tools.rp.program.params="--english" "--erase" "--load" "--run" "--speed" 8
#tools.rp.program.pattern="{path}/{cmd}" "{runtime.tools.bootloaders.path}/MDR32F9Qx_default.hex" "{build.path}/{build.project_name}.hex" {tools.rp.upload.params}

#tools.rp.erase.params="--english" "--erase" "--speed" 8
#tools.rp.erase.pattern="{path}/{cmd}" "{runtime.tools.bootloaders.path}/MDR32F9Qx_default.hex" "{build.path}/{build.project_name}.hex" {tools.rp.erase.params}
