diff --git a/port/stm32-f4discovery-cc256x-2/Makefile b/port/stm32-f4discovery-cc256x-2/Makefile index cf320951d..d4ef8de86 100644 --- a/port/stm32-f4discovery-cc256x-2/Makefile +++ b/port/stm32-f4discovery-cc256x-2/Makefile @@ -1,5 +1,5 @@ ########################################################################################################################## -# File automatically-generated by tool: [projectgenerator] version: [3.1.0] date: [Thu Mar 07 18:15:11 CET 2019] +# File automatically-generated by tool: [projectgenerator] version: [3.1.0] date: [Thu Mar 07 21:47:00 CET 2019] ########################################################################################################################## # ------------------------------------------------ @@ -31,37 +31,153 @@ OPT = -O2 # Build path BUILD_DIR = build +BTSTACK_ROOT = ../.. +VPATH += ${BTSTACK_ROOT}/3rd-party/micro-ecc +VPATH += ${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/srce +VPATH += ${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/srce +VPATH += ${BTSTACK_ROOT}/3rd-party/hxcmod-player +VPATH += ${BTSTACK_ROOT}/3rd-party/hxcmod-player/mods +VPATH += ${BTSTACK_ROOT}/3rd-party/md5 +VPATH += ${BTSTACK_ROOT}/3rd-party/yxml +VPATH += ${BTSTACK_ROOT}/3rd-party/segger-rtt +VPATH += ${BTSTACK_ROOT}/chipset/cc256x +VPATH += ${BTSTACK_ROOT}/example +VPATH += ${BTSTACK_ROOT}/platform/embedded +VPATH += ${BTSTACK_ROOT}/src +VPATH += ${BTSTACK_ROOT}/src/ble +VPATH += ${BTSTACK_ROOT}/src/ble/gatt-service +VPATH += ${BTSTACK_ROOT}/src/classic +VPATH += Drivers/STM32F4xx_HAL_DRIVER/Src +VPATH += Src +VPATH += port +VPATH += port/bsp + ###################################### # source ###################################### # C sources -C_SOURCES = \ -Src/main.c \ -Src/gpio.c \ -Src/dma.c \ -Src/usart.c \ -Src/stm32f4xx_it.c \ -Src/stm32f4xx_hal_msp.c \ -Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c \ -Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c \ -Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c \ -Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c \ -Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c \ -Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c \ -Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c \ -Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c \ -Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c \ -Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c \ -Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c \ -Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c \ -Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c \ -Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c \ -Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c \ -Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c \ -Src/system_stm32f4xx.c +C_SOURCES = \ +a2dp_sink.c \ +a2dp_source.c \ +ad_parser.c \ +ancs_client.c \ +att_db.c \ +att_dispatch.c \ +att_server.c \ +audio.c \ +avdtp.c \ +avdtp_acceptor.c \ +avdtp_initiator.c \ +avdtp_sink.c \ +avdtp_source.c \ +avdtp_util.c \ +avrcp.c \ +avrcp_browsing_controller.c \ +avrcp_controller.c \ +avrcp_media_item_iterator.c \ +avrcp_target.c \ +battery_service_server.c \ +bluetooth_init_cc2564B_1.6_BT_Spec_4.1.c \ +btstack_audio.c \ +btstack_audio_embedded.c \ +btstack_chipset_cc256x.c \ +btstack_crypto.c \ +btstack_cvsd_plc.c \ +btstack_hid_parser.c \ +btstack_link_key_db_tlv.c \ +btstack_linked_list.c \ +btstack_memory.c \ +btstack_memory_pool.c \ +btstack_resample.c \ +btstack_ring_buffer.c \ +btstack_run_loop.c \ +btstack_run_loop_embedded.c \ +btstack_sbc_decoder_bluedroid.c \ +btstack_sbc_encoder_bluedroid.c \ +btstack_sbc_plc.c \ +btstack_stdin_embedded.c \ +btstack_tlv.c \ +btstack_tlv_flash_bank.c \ +btstack_uart_block_embedded.c \ +btstack_util.c \ +cs43l22.c \ +device_id_server.c \ +device_information_service_server.c \ +dma.c \ +gatt_client.c \ +goep_client.c \ +gpio.c \ +hal_audio_f4discovery.c \ +hal_flash_bank_stm32.c \ +hci.c \ +hci_cmd.c \ +hci_dump.c \ +hci_transport_h4.c \ +hfp.c \ +hfp_ag.c \ +hfp_gsm_model.c \ +hfp_hf.c \ +hfp_msbc.c \ +hid_device.c \ +hids_device.c \ +hsp_ag.c \ +hsp_hs.c \ +hxcmod.c \ +l2cap.c \ +l2cap_signaling.c \ +le_device_db_memory.c \ +le_device_db_tlv.c \ +main.c \ +main.c \ +md5.c \ +nao-deceased_by_disease.c \ +obex_iterator.c \ +pbap_client.c \ +port.c \ +rfcomm.c \ +sco_demo_util.c \ +sdp_client.c \ +sdp_client_rfcomm.c \ +sdp_server.c \ +sdp_util.c \ +SEGGER_RTT.c \ +SEGGER_RTT_Syscalls_GCC.c \ +sm.c \ +spi.c \ +spp_server.c \ +stm32f4_discovery.c \ +stm32f4_discovery_audio.c \ +stm32f4xx_hal.c \ +stm32f4xx_hal_cortex.c \ +stm32f4xx_hal_dma.c \ +stm32f4xx_hal_dma_ex.c \ +stm32f4xx_hal_exti.c \ +stm32f4xx_hal_flash.c \ +stm32f4xx_hal_flash_ex.c \ +stm32f4xx_hal_flash_ramfunc.c \ +stm32f4xx_hal_gpio.c \ +stm32f4xx_hal_i2c.c \ +stm32f4xx_hal_i2c_ex.c \ +stm32f4xx_hal_i2s.c \ +stm32f4xx_hal_i2s_ex.c \ +stm32f4xx_hal_msp.c \ +stm32f4xx_hal_pwr.c \ +stm32f4xx_hal_pwr_ex.c \ +stm32f4xx_hal_rcc.c \ +stm32f4xx_hal_rcc_ex.c \ +stm32f4xx_hal_spi.c \ +stm32f4xx_hal_tim.c \ +stm32f4xx_hal_tim_ex.c \ +stm32f4xx_hal_uart.c \ +stm32f4xx_it.c \ +system_stm32f4xx.c \ +uECC.c \ +usart.c \ +usart.c \ +yxml.c \ # ASM sources -ASM_SOURCES = \ +ASM_SOURCES = \ startup_stm32f407xx.s @@ -95,7 +211,7 @@ CPU = -mcpu=cortex-m4 FPU = -mfpu=fpv4-sp-d16 # float-abi -FLOAT-ABI = -mfloat-abi=hard +FLOAT-ABI = -mfloat-abi=softfp # mcu MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI) @@ -105,8 +221,8 @@ MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI) AS_DEFS = # C defines -C_DEFS = \ --DUSE_HAL_DRIVER \ +C_DEFS = \ +-DUSE_HAL_DRIVER \ -DSTM32F407xx @@ -114,14 +230,34 @@ C_DEFS = \ AS_INCLUDES = # C includes -C_INCLUDES = \ --IInc \ --IDrivers/STM32F4xx_HAL_Driver/Inc \ --IDrivers/STM32F4xx_HAL_Driver/Inc/Legacy \ --IDrivers/CMSIS/Device/ST/STM32F4xx/Include \ --IDrivers/CMSIS/Include \ --IDrivers/CMSIS/Include +C_INCLUDES = \ +-IInc \ +-IDrivers/STM32F4xx_HAL_Driver/Inc \ +-IDrivers/STM32F4xx_HAL_Driver/Inc/Legacy \ +-IDrivers/CMSIS/Device/ST/STM32F4xx/Include \ +-IDrivers/CMSIS/Include \ +C_INCLUDES += -I. +C_INCLUDES += -I$(BUILD_DIR) +C_INCLUDES += -I${BTSTACK_ROOT}/src/ble +C_INCLUDES += -I${BTSTACK_ROOT}/src/ble/gatt-service +C_INCLUDES += -I${BTSTACK_ROOT}/src/classic +C_INCLUDES += -I${BTSTACK_ROOT}/src +C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/micro-ecc +C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/include +C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/include +C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/hxcmod-player +C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/hxcmod-player/mods +C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/md5 +C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/yxml +C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/segger-rtt +C_INCLUDES += -I${BTSTACK_ROOT}/platform/embedded +C_INCLUDES += -I${BTSTACK_ROOT}/chipset/cc256x +C_INCLUDES += -I pdm +C_INCLUDES += -I port +C_INCLUDES += -I port/bsp +C_INCLUDES += -I src +C_INCLUDES += -I Drivers/STM32F4xx_HAL_Driver/Inc # compile gcc flags ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections @@ -144,13 +280,77 @@ CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)" LDSCRIPT = STM32F407VGTx_FLASH.ld # libraries -LIBS = -lc -lm -lnosys -LIBDIR = +LIBS = -lPDMFilter_CM4_GCC -lc -lm -lnosys +LIBDIR = -Lpdm LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections # default action: build all -all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin +LE_EXAMPLES = \ + ancs_client_demo \ + gap_le_advertisements \ + gatt_battery_query \ + gatt_browser \ + le_counter \ + le_streamer \ + le_streamer_client \ + sm_pairing_peripheral \ + sm_pairing_central +EXAMPLES = \ + audio_duplex \ + a2dp_sink_demo \ + a2dp_source_demo \ + ancs_client_demo \ + dut_mode_classic \ + gap_dedicated_bonding \ + gap_inquiry \ + gap_le_advertisements \ + gatt_battery_query \ + gatt_browser \ + hfp_ag_demo \ + hfp_hf_demo \ + hid_host_demo \ + hid_keyboard_demo \ + hid_mouse_demo \ + hog_keyboard_demo \ + hog_mouse_demo \ + hsp_ag_demo \ + hsp_hs_demo \ + mod_player \ + le_counter \ + le_streamer \ + le_streamer_client \ + pbap_client_demo \ + sdp_bnep_query \ + sdp_general_query \ + sdp_rfcomm_query \ + sine_player \ + sm_pairing_central \ + sm_pairing_peripheral \ + spp_and_le_counter \ + spp_and_le_streamer \ + spp_counter \ + spp_streamer \ + spp_streamer_client \ + +GATT_FILES = \ + ancs_client_demo.gatt \ + le_counter.gatt \ + le_streamer.gatt \ + gatt_browser.gatt \ + gatt_battery_query.gatt \ + hog_keyboard_demo.gatt \ + hog_mouse_demo.gatt \ + sm_pairing_peripheral.gatt \ + sm_pairing_central.gatt \ + spp_and_le_counter.gatt \ + spp_and_le_streamer.gatt \ + +include ${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/Makefile.inc +include ${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/Makefile.inc + +C_SOURCES += ${SBC_ENCODER} +C_SOURCES += ${SBC_DECODER} ####################################### # build the application @@ -162,14 +362,36 @@ vpath %.c $(sort $(dir $(C_SOURCES))) OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o))) vpath %.s $(sort $(dir $(ASM_SOURCES))) +all: \ + $(OBJECTS) \ + $(addprefix $(BUILD_DIR)/,$(GATT_FILES:.gatt=.h)) \ + $(addprefix $(BUILD_DIR)/,$(EXAMPLES:=.elf)) \ + $(addprefix $(BUILD_DIR)/,$(EXAMPLES:=.hex)) \ + $(addprefix $(BUILD_DIR)/,$(EXAMPLES:=.bin)) + +include ${BTSTACK_ROOT}/chipset/cc256x/Makefile.inc + +$(BUILD_DIR)/%.h: %.gatt + python ${BTSTACK_ROOT}/tool/compile_gatt.py $< $@ + +# $(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) +# $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@ + +# $(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR) +# $(AS) -c $(CFLAGS) $< -o $@ + +# $(BUILD_DIR)/%.elf: $(OBJECTS) Makefile %.o +# $(CC) $(filter-out Makefile,$^) $(LDFLAGS) -o $@ +# $(SZ) $@ + $(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@ $(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR) $(AS) -c $(CFLAGS) $< -o $@ -$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile - $(CC) $(OBJECTS) $(LDFLAGS) -o $@ +$(BUILD_DIR)/%.elf: $(OBJECTS) %.o + $(CC) $(filter-out Makefile,$^) $(LDFLAGS) -o $@ $(SZ) $@ $(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR) @@ -192,4 +414,4 @@ clean: ####################################### -include $(wildcard $(BUILD_DIR)/*.d) -# *** EOF *** \ No newline at end of file +# *** EOF *** diff --git a/port/stm32-f4discovery-cc256x-2/Src/main.c b/port/stm32-f4discovery-cc256x-2/Src/main.c index dae232e60..02c88bd94 100644 --- a/port/stm32-f4discovery-cc256x-2/Src/main.c +++ b/port/stm32-f4discovery-cc256x-2/Src/main.c @@ -26,7 +26,7 @@ /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ - +#include "port.h" /* USER CODE END Includes */ /* Private typedef -----------------------------------------------------------*/ @@ -93,7 +93,8 @@ int main(void) MX_USART2_UART_Init(); MX_USART3_UART_Init(); /* USER CODE BEGIN 2 */ - + // jump to BTstack port + port_main(); /* USER CODE END 2 */ /* Infinite loop */ diff --git a/port/stm32-f4discovery-cc256x-2/port/port.c b/port/stm32-f4discovery-cc256x-2/port/port.c index 39738ee90..13d9aaae6 100644 --- a/port/stm32-f4discovery-cc256x-2/port/port.c +++ b/port/stm32-f4discovery-cc256x-2/port/port.c @@ -2,6 +2,7 @@ // include STM32 first to avoid warning about redefinition of UNUSED #include "stm32f4xx_hal.h" +#include "main.h" #include "port.h" #include "btstack.h"