board.mk 1.7 KB

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