From f9c542aa52f7f2e5e532343384441234a019e53d Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 26 May 2021 18:16:56 +0700 Subject: [PATCH] fix dfu example build --- examples/device/dfu/.skip.MCU_SAMD11 | 0 examples/device/dfu/CMakeLists.txt | 10 +++------- examples/device/dfu/src/main.c | 15 +++++++-------- examples/device/dfu/src/tusb_config.h | 2 +- examples/device/dfu/src/usb_descriptors.c | 6 +++--- examples/rules.mk | 3 ++- hw/bsp/rp2040/family.cmake | 1 + .../samd11/boards/luna_d11/samd11d14am_flash.ld | 1 + hw/bsp/samd11/boards/samd11_xplained/board.mk | 1 - .../boards/samd11_xplained/samd11d14am_flash.ld | 1 + hw/bsp/samd11/family.mk | 3 ++- .../boards/saml22_feather/saml22_feather.ld | 1 + .../boards/sensorwatch_m0/sensorwatch_m0.ld | 1 + src/class/dfu/dfu_device.c | 2 ++ 14 files changed, 25 insertions(+), 22 deletions(-) create mode 100644 examples/device/dfu/.skip.MCU_SAMD11 diff --git a/examples/device/dfu/.skip.MCU_SAMD11 b/examples/device/dfu/.skip.MCU_SAMD11 new file mode 100644 index 00000000..e69de29b diff --git a/examples/device/dfu/CMakeLists.txt b/examples/device/dfu/CMakeLists.txt index f4bf75c2..4160c0c8 100644 --- a/examples/device/dfu/CMakeLists.txt +++ b/examples/device/dfu/CMakeLists.txt @@ -9,10 +9,9 @@ get_filename_component(TOP "${TOP}" REALPATH) # Check for -DFAMILY= if(FAMILY STREQUAL "rp2040") cmake_minimum_required(VERSION 3.12) - set(PICO_SDK_PATH ${TOP}/hw/mcu/raspberrypi/pico-sdk) - include(${PICO_SDK_PATH}/pico_sdk_init.cmake) + + include(${TOP}/hw/bsp/${FAMILY}/pico_sdk_import.cmake) project(${PROJECT}) - pico_sdk_init() add_executable(${PROJECT}) include(${TOP}/hw/bsp/${FAMILY}/family.cmake) @@ -33,9 +32,6 @@ if(FAMILY STREQUAL "rp2040") CFG_TUSB_OS=OPT_OS_PICO ) - target_link_libraries(${PROJECT} pico_stdlib pico_fix_rp2040_usb_device_enumeration) - pico_add_extra_outputs(${PROJECT}) - else() - message(FATAL_ERROR "Invalid FAMILY specified") + message(FATAL_ERROR "Invalid FAMILY specified: ${FAMILY}") endif() diff --git a/examples/device/dfu/src/main.c b/examples/device/dfu/src/main.c index 3849de44..1c09066a 100644 --- a/examples/device/dfu/src/main.c +++ b/examples/device/dfu/src/main.c @@ -126,21 +126,20 @@ void tud_dfu_runtime_reboot_to_dfu_cb(void) //--------------------------------------------------------------------+ bool tud_dfu_firmware_valid_check_cb(void) { - TU_LOG2(" Firmware check\r\n"); + printf(" Firmware check\r\n"); return true; } void tud_dfu_req_dnload_data_cb(uint16_t wBlockNum, uint8_t* data, uint16_t length) { - TU_LOG2(" Received BlockNum %u of length %u\r\n", wBlockNum, length); + (void) data; + printf(" Received BlockNum %u of length %u\r\n", wBlockNum, length); #if DFU_VERBOSE for(uint16_t i=0; i ram /* stack section */ diff --git a/hw/bsp/samd11/boards/samd11_xplained/board.mk b/hw/bsp/samd11/boards/samd11_xplained/board.mk index 79ad8706..e351cf0b 100644 --- a/hw/bsp/samd11/boards/samd11_xplained/board.mk +++ b/hw/bsp/samd11/boards/samd11_xplained/board.mk @@ -6,7 +6,6 @@ LD_FILE = $(BOARD_PATH)/samd11d14am_flash.ld # For flash-jlink target JLINK_DEVICE = ATSAMD11D14 - # flash using edbg flash: $(BUILD)/$(PROJECT).bin edbg -b -t samd11 -e -pv -f $< diff --git a/hw/bsp/samd11/boards/samd11_xplained/samd11d14am_flash.ld b/hw/bsp/samd11/boards/samd11_xplained/samd11d14am_flash.ld index 2153f5f5..8b3124c0 100644 --- a/hw/bsp/samd11/boards/samd11_xplained/samd11d14am_flash.ld +++ b/hw/bsp/samd11/boards/samd11_xplained/samd11d14am_flash.ld @@ -126,6 +126,7 @@ SECTIONS . = ALIGN(4); _ebss = . ; _ezero = .; + end = .; } > ram /* stack section */ diff --git a/hw/bsp/samd11/family.mk b/hw/bsp/samd11/family.mk index 6fbdc35a..70120ec9 100644 --- a/hw/bsp/samd11/family.mk +++ b/hw/bsp/samd11/family.mk @@ -3,8 +3,9 @@ DEPS_SUBMODULES += hw/mcu/microchip include $(TOP)/$(BOARD_PATH)/board.mk CFLAGS += \ + -flto \ -mthumb \ - -mabi=aapcs-linux \ + -mabi=aapcs \ -mcpu=cortex-m0plus \ -nostdlib -nostartfiles \ -DCONF_DFLL_OVERWRITE_CALIBRATION=0 \ diff --git a/hw/bsp/saml22/boards/saml22_feather/saml22_feather.ld b/hw/bsp/saml22/boards/saml22_feather/saml22_feather.ld index 2e0e1b25..d1aaa44f 100644 --- a/hw/bsp/saml22/boards/saml22_feather/saml22_feather.ld +++ b/hw/bsp/saml22/boards/saml22_feather/saml22_feather.ld @@ -128,6 +128,7 @@ SECTIONS . = ALIGN(4); _ebss = . ; _ezero = .; + end = .; } > ram /* stack section */ diff --git a/hw/bsp/saml22/boards/sensorwatch_m0/sensorwatch_m0.ld b/hw/bsp/saml22/boards/sensorwatch_m0/sensorwatch_m0.ld index 2e0e1b25..d1aaa44f 100644 --- a/hw/bsp/saml22/boards/sensorwatch_m0/sensorwatch_m0.ld +++ b/hw/bsp/saml22/boards/sensorwatch_m0/sensorwatch_m0.ld @@ -128,6 +128,7 @@ SECTIONS . = ALIGN(4); _ebss = . ; _ezero = .; + end = .; } > ram /* stack section */ diff --git a/src/class/dfu/dfu_device.c b/src/class/dfu/dfu_device.c index da9f189a..8496cb02 100644 --- a/src/class/dfu/dfu_device.c +++ b/src/class/dfu/dfu_device.c @@ -150,6 +150,8 @@ void dfu_moded_init(void) void dfu_moded_reset(uint8_t rhport) { + (void) rhport; + _dfu_state_ctx.state = DFU_IDLE; _dfu_state_ctx.status = DFU_STATUS_OK; _dfu_state_ctx.blk_transfer_in_proc = false;