# 86Duino X86 Core and platform.
# ------------------------------ 

name=Vortex86EX (32-bits) Boards

# X86 compile variables
# ---------------------

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

# Default "compiler.path" is correct, change only if you want to overidde the initial value
upx.path={runtime.hardware.path}/../tools/upx309w/
compiler.path={runtime.hardware.path}/../tools/djgpp/bin/
compiler.lib.path={runtime.hardware.path}/../tools/djgpp/lib/
compiler.include.path={runtime.hardware.path}/../tools/djgpp/i586-pc-msdosdjgpp/sys-include/
compiler.c.cmd=i586-pc-msdosdjgpp-gcc
compiler.c.flags=-c {compiler.warning_flags} -g -MMD -ffunction-sections -fdata-sections -O1  
compiler.c.elf.flags={compiler.warning_flags} -Wl,--gc-sections -O1
compiler.c.elf.cmd=i586-pc-msdosdjgpp-gcc
compiler.c.elf.libs=-lm
compiler.c.other.libs=
compiler.S.flags=-c -g -assembler-with-cpp
compiler.cpp.cmd=i586-pc-msdosdjgpp-gcc
compiler.cpp.flags=-c {compiler.warning_flags} -g -MMD -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -O1  
compiler.ar.cmd=i586-pc-msdosdjgpp-ar
compiler.ar.flags=rcs
compiler.objcopy.cmd=avr-objcopy
compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0
compiler.elf2hex.flags=-v
compiler.elf2hex.cmd=i586-pc-msdosdjgpp-strip
compiler.upx.cmd=upx
compiler.ldflags=
compiler.size.cmd=i586-pc-msdosdjgpp-size
# this can be overriden in boards.txt
build.extra_flags=

# AVR compile patterns
# --------------------

## Compile c files
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -DARDUINO={runtime.ide.version} -D_86DUINO=316 "{source_file}" -o "{object_file}" {includes} "-I{compiler.lib.path}" "-I{compiler.include.path}"

## Compile c++ files
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -DARDUINO={runtime.ide.version} -D_86DUINO=316 "{source_file}" -o "{object_file}" {includes} "-I{compiler.lib.path}" "-I{compiler.include.path}"

## Create archives
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} "{build.path}/libcore.a" "{object_file}" 

## Combine gc-sections, archives, and objects
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -o "{build.path}/{build.project_name}.exe" -Wl,--start-group {object_files} "{compiler.c.elf.libs}" -Wl,--end-group "-L{build.path}" "-L{compiler.lib.path}" -lcore {compiler.c.other.libs} -lstdc++

## Create eeprom
# recipe.objcopy.eep.pattern="{compiler.path}{compiler.objcopy.cmd}" {compiler.objcopy.eep.flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.eep"

## Create hex
# recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} "{build.path}/{build.project_name}.exe"

## use upx
recipe.objcopy.upx.pattern="{upx.path}{compiler.upx.cmd}.exe" "{build.path}/{build.project_name}.exe"
recipe.objcopy.upx.pattern.linux="{upx.path}{compiler.upx.cmd}" "{build.path}/{build.project_name}.exe"  

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

## Compute size
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.exe"
recipe.size.regex=Total\s+([0-9]+).*


# AVR Uploader/Programmers tools
# -------------------

tools.86upload.cmd.path={runtime.hardware.path}/../tools/x86/v86dude.exe
tools.86upload.cmd.path.linux={runtime.hardware.path}/../tools/x86/v86dude

tools.86upload.upload.params.verbose=-v -v -v -v
tools.86upload.upload.params.quiet=-q -q
tools.86upload.upload.pattern="{cmd.path}" "{serial.port}" "20" "{build.path}/{build.project_name}.exe" 

tools.86upload.program.params.verbose=-v -v -v -v
tools.86upload.program.params.quiet=-q -q
tools.86upload.program.pattern="{cmd.path}" "{serial.port}" "20" "{build.path}/{build.project_name}.exe"

tools.86upload.erase.params.verbose=-v -v -v -v
tools.86upload.erase.params.quiet=-q -q
tools.86upload.erase.pattern="{cmd.path}" "{serial.port}" "20" "{build.path}/{build.project_name}.exe"

tools.86upload.bootloader.params.verbose=-v -v -v -v
tools.86upload.bootloader.params.quiet=-q -q
tools.86upload.bootloader.pattern="{cmd.path}" "{serial.port}" "18" "{build.path}/{build.project_name}.exe" 

