board.mk 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. # lwip/src/core/raw.c:334:43: error: declaration of 'recv' shadows a global declaration
  33. CFLAGS += -Wno-error=shadow
  34. SPRESENSE_SDK = $(TOP)/hw/mcu/sony/cxd56/spresense-exported-sdk
  35. SRC_C += src/portable/sony/cxd56/dcd_cxd56.c
  36. INC += \
  37. $(SPRESENSE_SDK)/nuttx/include \
  38. $(SPRESENSE_SDK)/nuttx/arch \
  39. $(SPRESENSE_SDK)/nuttx/arch/chip \
  40. $(SPRESENSE_SDK)/nuttx/arch/os \
  41. $(SPRESENSE_SDK)/sdk/include \
  42. LIBS += \
  43. $(SPRESENSE_SDK)/nuttx/libs/libapps.a \
  44. $(SPRESENSE_SDK)/nuttx/libs/libnuttx.a \
  45. LD_FILE = hw/mcu/sony/cxd56/spresense-exported-sdk/nuttx/scripts/ramconfig.ld
  46. LDFLAGS += \
  47. -Xlinker --entry=__start \
  48. -nostartfiles \
  49. -nodefaultlibs \
  50. -Wl,--gc-sections \
  51. -u spresense_main
  52. $(MKSPK): $(BUILD)/$(PROJECT).elf
  53. $(MAKE) -C $(TOP)/hw/mcu/sony/cxd56/mkspk
  54. $(BUILD)/$(PROJECT).spk: $(MKSPK)
  55. @echo CREATE $@
  56. @$(MKSPK) -c 2 $(BUILD)/$(PROJECT).elf nuttx $@
  57. # flash
  58. flash: $(BUILD)/$(PROJECT).spk
  59. @echo FLASH $<
  60. @$(PYTHON) $(TOP)/hw/mcu/sony/cxd56/tools/flash_writer.py -s -c $(SERIAL) -d -b 115200 -n $<