board.mk 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. DEPS_SUBMODULES += hw/mcu/sony/cxd56/spresense-exported-sdk
  2. # Platforms are: Linux, Darwin, MSYS, CYGWIN
  3. PLATFORM := $(firstword $(subst _, ,$(shell uname -s 2>/dev/null)))
  4. ifeq ($(PLATFORM),Darwin)
  5. # macOS
  6. MKSPK = $(TOP)/hw/mcu/sony/cxd56/mkspk/mkspk
  7. else ifeq ($(PLATFORM),Linux)
  8. # Linux
  9. MKSPK = $(TOP)/hw/mcu/sony/cxd56/mkspk/mkspk
  10. else
  11. # Cygwin/MSYS2
  12. MKSPK = $(TOP)/hw/mcu/sony/cxd56/mkspk/mkspk.exe
  13. endif
  14. SERIAL ?= /dev/ttyUSB0
  15. CFLAGS += \
  16. -DCONFIG_HAVE_DOUBLE \
  17. -Dmain=spresense_main \
  18. -pipe \
  19. -std=gnu11 \
  20. -mcpu=cortex-m4 \
  21. -mthumb \
  22. -mfpu=fpv4-sp-d16 \
  23. -mfloat-abi=hard \
  24. -mabi=aapcs \
  25. -fno-builtin \
  26. -fno-strength-reduce \
  27. -fomit-frame-pointer \
  28. -Wno-error=undef \
  29. -Wno-error=cast-align \
  30. -Wno-error=unused-parameter \
  31. -DCFG_TUSB_MCU=OPT_MCU_CXD56 \
  32. # suppress following warnings from mcu driver
  33. # lwip/src/core/raw.c:334:43: error: declaration of 'recv' shadows a global declaration
  34. CFLAGS += -Wno-error=shadow -Wno-error=redundant-decls
  35. SPRESENSE_SDK = $(TOP)/hw/mcu/sony/cxd56/spresense-exported-sdk
  36. SRC_C += src/portable/sony/cxd56/dcd_cxd56.c
  37. INC += \
  38. $(SPRESENSE_SDK)/nuttx/include \
  39. $(SPRESENSE_SDK)/nuttx/arch \
  40. $(SPRESENSE_SDK)/nuttx/arch/chip \
  41. $(SPRESENSE_SDK)/nuttx/arch/os \
  42. $(SPRESENSE_SDK)/sdk/include \
  43. LIBS += \
  44. $(SPRESENSE_SDK)/nuttx/libs/libapps.a \
  45. $(SPRESENSE_SDK)/nuttx/libs/libnuttx.a \
  46. LD_FILE = hw/mcu/sony/cxd56/spresense-exported-sdk/nuttx/scripts/ramconfig.ld
  47. LDFLAGS += \
  48. -Xlinker --entry=__start \
  49. -nostartfiles \
  50. -nodefaultlibs \
  51. -Wl,--gc-sections \
  52. -u spresense_main
  53. $(MKSPK): $(BUILD)/$(PROJECT).elf
  54. $(MAKE) -C $(TOP)/hw/mcu/sony/cxd56/mkspk
  55. $(BUILD)/$(PROJECT).spk: $(MKSPK)
  56. @echo CREATE $@
  57. @$(MKSPK) -c 2 $(BUILD)/$(PROJECT).elf nuttx $@
  58. # flash
  59. flash: $(BUILD)/$(PROJECT).spk
  60. @echo FLASH $<
  61. @$(PYTHON) $(TOP)/hw/mcu/sony/cxd56/tools/flash_writer.py -s -c $(SERIAL) -d -b 115200 -n $<