diff options
| author | hathach <[email protected]> | 2021-05-26 18:16:56 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2021-05-26 18:16:56 +0700 |
| commit | f9c542aa52f7f2e5e532343384441234a019e53d (patch) | |
| tree | 768260844929b861be3bee1fa2fa4996967d976c /examples | |
| parent | dbef50f8ffb6892297456aeb409f3d52d3731f0a (diff) | |
fix dfu example build
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/device/dfu/.skip.MCU_SAMD11 | 0 | ||||
| -rw-r--r-- | examples/device/dfu/CMakeLists.txt | 10 | ||||
| -rw-r--r-- | examples/device/dfu/src/main.c | 15 | ||||
| -rw-r--r-- | examples/device/dfu/src/tusb_config.h | 2 | ||||
| -rw-r--r-- | examples/device/dfu/src/usb_descriptors.c | 6 | ||||
| -rw-r--r-- | examples/rules.mk | 3 |
6 files changed, 16 insertions, 20 deletions
diff --git a/examples/device/dfu/.skip.MCU_SAMD11 b/examples/device/dfu/.skip.MCU_SAMD11 new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/examples/device/dfu/.skip.MCU_SAMD11 diff --git a/examples/device/dfu/CMakeLists.txt b/examples/device/dfu/CMakeLists.txt index f4bf75c26..4160c0c88 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 3849de44d..1c09066a8 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<length; i++) { - TU_LOG2(" [%u][%u]: %x\r\n", wBlockNum, i, (uint8_t)data[i]); + printf(" [%u][%u]: %x\r\n", wBlockNum, i, (uint8_t)data[i]); } -#else - (void) data; #endif tud_dfu_dnload_complete(); @@ -148,17 +147,17 @@ void tud_dfu_req_dnload_data_cb(uint16_t wBlockNum, uint8_t* data, uint16_t leng bool tud_dfu_device_data_done_check_cb(void) { - TU_LOG2(" Host said no more data... Returning true\r\n"); + printf(" Host said no more data... Returning true\r\n"); return true; } void tud_dfu_abort_cb(void) { - TU_LOG2(" Host aborted transfer\r\n"); + printf(" Host aborted transfer\r\n"); } #define UPLOAD_SIZE (29) -const uint8_t upload_test[UPLOAD_SIZE] = "Hello world from TinyUSB DFU!" +const uint8_t upload_test[UPLOAD_SIZE] = "Hello world from TinyUSB DFU!"; uint16_t tud_dfu_req_upload_data_cb(uint16_t block_num, uint8_t* data, uint16_t length) { diff --git a/examples/device/dfu/src/tusb_config.h b/examples/device/dfu/src/tusb_config.h index 0bb59a06c..90e90b2e4 100644 --- a/examples/device/dfu/src/tusb_config.h +++ b/examples/device/dfu/src/tusb_config.h @@ -80,7 +80,7 @@ //------------- CLASS -------------// -#define CFG_TUD_DFU_RUNTIME 1 +#define CFG_TUD_DFU_RUNTIME 0 #define CFG_TUD_DFU_MODE 1 #ifdef __cplusplus diff --git a/examples/device/dfu/src/usb_descriptors.c b/examples/device/dfu/src/usb_descriptors.c index 77662542d..8ad64354b 100644 --- a/examples/device/dfu/src/usb_descriptors.c +++ b/examples/device/dfu/src/usb_descriptors.c @@ -83,7 +83,7 @@ uint8_t const * tud_descriptor_device_cb(void) enum { - ITF1_NUM_DFU_MODE, + ITF_NUM_DFU_MODE, ITF_NUM_TOTAL }; @@ -94,10 +94,10 @@ enum uint8_t const desc_configuration[] = { // Config number, interface count, string index, total length, attribute, power in mA - TUD_CONFIG_DESCRIPTOR(1, ITF1_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100), + TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100), // Interface number, string index, attributes, detach timeout, transfer size */ - TUD_DFU_MODE_DESCRIPTOR(ITF1_NUM_DFU_MODE, 0, FUNC_ATTRS, 1000, CFG_TUD_DFU_TRANSFER_BUFFER_SIZE), + TUD_DFU_MODE_DESCRIPTOR(ITF_NUM_DFU_MODE, 0, FUNC_ATTRS, 1000, CFG_TUD_DFU_TRANSFER_BUFFER_SIZE), }; // Invoked when received GET CONFIGURATION DESCRIPTOR diff --git a/examples/rules.mk b/examples/rules.mk index 2d86d5c79..4fce468fd 100644 --- a/examples/rules.mk +++ b/examples/rules.mk @@ -28,6 +28,7 @@ SRC_C += \ src/device/usbd_control.c \ src/class/audio/audio_device.c \ src/class/cdc/cdc_device.c \ + src/class/dfu/dfu_device.c \ src/class/dfu/dfu_rt_device.c \ src/class/hid/hid_device.c \ src/class/midi/midi_device.c \ @@ -41,7 +42,7 @@ INC += $(TOP)/src CFLAGS += $(addprefix -I,$(INC)) -LDFLAGS += $(CFLAGS) -fshort-enums -Wl,-T,$(TOP)/$(LD_FILE) -Wl,[email protected] -Wl,-cref -Wl,-gc-sections +LDFLAGS += $(CFLAGS) -Wl,-T,$(TOP)/$(LD_FILE) -Wl,[email protected] -Wl,-cref -Wl,-gc-sections ifneq ($(SKIP_NANOLIB), 1) LDFLAGS += -specs=nosys.specs -specs=nano.specs endif |
