EXAMPLE_BASE_DIR ?= $(shell realpath .)
EXAMPLE_NAME := $(notdir $(patsubst %/,%,$(CURDIR)))
SDK_BASE_DIR ?= $(shell realpath ./../..)

export SDK_BASE_DIR
export EXAMPLE_NAME
export EXAMPLE_BASE_DIR

GCC_PATH := $(shell which arm-none-eabi-gcc)
CROSS_COMPILE := $(patsubst %gcc,%,$(GCC_PATH))
ifeq ($(GCC_PATH),)
$(error arm-none-eabi-gcc not found in PATH. Please install the ARM toolchain.)
endif

# add custom cmake definition
#cmake_definition+=-Dxxx=sss

LDFLAGS += -T$(EXAMPLE_BASE_DIR)/boot2.ld
BOOT2_PRE_CRC ?= boot2_pre_crc.bin

include $(SDK_BASE_DIR)/project.build
