; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[setup]
compiler = arm_none_eabi_gcc
host_interface_spi = 1
host_interface_i2c = 2

[platformio]
include_dir = inc
src_dir = src
default_envs = release_spi
build_dir = build/${setup.compiler}

[env]
custom_target = arm_cortex_m0plus
custom_api_dir = ./../../api
custom_common_dir = ./../_common
extra_scripts = pre:pre_script.py
                post:post_script.py
custom_prog_name = bmv080_example
upload_protocol = jlink
platform = raspberrypi
board = pico
framework = arduino
platform_packages = toolchain-gccarmnoneeabi @ 1.120301.0
                    tool-rp2040tools @ 1.0.2
                    framework-arduino-mbed @ 4.1.1
debug_tool = jlink
monitor_speed = 115200
build_flags =
    -mcpu=cortex-m0plus
    -mfloat-abi=soft
    -std=gnu11
    -mthumb
    -DUSE_EXTERNAL_INTERRUPT
    -Wall
    -Wno-ignored-qualifiers
    -Wno-cast-function-type
    -Wno-deprecated-declarations
    -fstack-usage
    -ffunction-sections
    -fdata-sections
    -MMD
    -MP
    -I ${this.custom_api_dir}/inc
    -I ${this.custom_common_dir}/inc 
    -Wl,--gc-sections
    -Wl,-u_printf_float
    -Wl,--static
    -l lib_bmv080.a 
    -l lib_postProcessor.a
    -lc 
    -lm
    -Os
    -DHOST_INTERFACE_SPI=${setup.host_interface_spi}
    -DHOST_INTERFACE_I2C=${setup.host_interface_i2c}

[env:release_spi]
build_type = release
build_flags =
    -DHOST_INTERFACE=${setup.host_interface_spi}
    -L ${env.custom_api_dir}/lib/${env.custom_target}/${setup.compiler}/${this.build_type}
    ${env.build_flags}

[env:release_i2c]
build_type = release
build_flags =
    -DHOST_INTERFACE=${setup.host_interface_i2c}
    -L ${env.custom_api_dir}/lib/${env.custom_target}/${setup.compiler}/${this.build_type}
    ${env.build_flags}