summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2019-09-11 11:55:16 +0700
committerhathach <[email protected]>2019-09-11 11:55:16 +0700
commit3f02c359832ec19400265a5ee335e30fde10d24d (patch)
tree1209598daadf944eddd6adffc7dcdde27e533ed1
parent34b76898da16ea33897d6cb5b908611d81ab5855 (diff)
fix #130
-rw-r--r--examples/device/cdc_msc_hid/src/msc_disk.c11
-rw-r--r--examples/device/cdc_msc_hid_freertos/src/msc_disk.c11
-rw-r--r--examples/device/msc_dual_lun/src/msc_disk_dual.c13
-rw-r--r--hw/bsp/lpcxpresso11u37/board.mk1
-rw-r--r--hw/bsp/lpcxpresso1347/board.mk1
-rw-r--r--hw/bsp/stm32f070rbnucleo/board.mk1
-rw-r--r--hw/bsp/stm32f072disco/board.mk1
7 files changed, 17 insertions, 22 deletions
diff --git a/examples/device/cdc_msc_hid/src/msc_disk.c b/examples/device/cdc_msc_hid/src/msc_disk.c
index bc61f5d67..5aa7befc9 100644
--- a/examples/device/cdc_msc_hid/src/msc_disk.c
+++ b/examples/device/cdc_msc_hid/src/msc_disk.c
@@ -29,11 +29,8 @@
#if CFG_TUD_MSC
// Some MCU doesn't have enough 8KB SRAM to store the whole disk
-// We will use Flash as read-only disk
-// - LPC1347, LPC11uxx
-#if (CFG_TUSB_MCU == OPT_MCU_LPC13XX) || (CFG_TUSB_MCU == OPT_MCU_LPC11UXX)
-#define DISK_READONLY
-#endif
+// We will use Flash as read-only disk with board that has
+// CFG_EXAMPLE_MSC_READONLY defined
#define README_CONTENTS \
"This is tinyusb's MassStorage Class demo.\r\n\r\n\
@@ -46,7 +43,7 @@ enum
DISK_BLOCK_SIZE = 512
};
-#ifdef DISK_READONLY
+#ifdef CFG_EXAMPLE_MSC_READONLY
const
#endif
uint8_t msc_disk[DISK_BLOCK_NUM][DISK_BLOCK_SIZE] =
@@ -193,7 +190,7 @@ int32_t tud_msc_write10_cb(uint8_t lun, uint32_t lba, uint32_t offset, uint8_t*
{
(void) lun;
-#ifndef DISK_READONLY
+#ifndef CFG_EXAMPLE_MSC_READONLY
uint8_t* addr = msc_disk[lba] + offset;
memcpy(addr, buffer, bufsize);
#else
diff --git a/examples/device/cdc_msc_hid_freertos/src/msc_disk.c b/examples/device/cdc_msc_hid_freertos/src/msc_disk.c
index 184602cdd..b4986fbb7 100644
--- a/examples/device/cdc_msc_hid_freertos/src/msc_disk.c
+++ b/examples/device/cdc_msc_hid_freertos/src/msc_disk.c
@@ -29,11 +29,8 @@
#if CFG_TUD_MSC
// Some MCU doesn't have enough 8KB SRAM to store the whole disk
-// We will use Flash as read-only disk
-// - LPC1347, LPC11uxx
-#if (CFG_TUSB_MCU == OPT_MCU_LPC13XX) || (CFG_TUSB_MCU == OPT_MCU_LPC11UXX)
-#define DISK_READONLY
-#endif
+// We will use Flash as read-only disk with board that has
+// CFG_EXAMPLE_MSC_READONLY defined
#define README_CONTENTS \
"This is tinyusb's MassStorage Class demo.\r\n\r\n\
@@ -46,7 +43,7 @@ enum
DISK_BLOCK_SIZE = 512
};
-#ifdef DISK_READONLY
+#ifdef CFG_EXAMPLE_MSC_READONLY
const
#endif
uint8_t msc_disk[DISK_BLOCK_NUM][DISK_BLOCK_SIZE] =
@@ -193,7 +190,7 @@ int32_t tud_msc_write10_cb(uint8_t lun, uint32_t lba, uint32_t offset, uint8_t*
{
(void) lun;
-#ifndef DISK_READONLY
+#ifndef CFG_EXAMPLE_MSC_READONLY
uint8_t* addr = msc_disk[lba] + offset;
memcpy(addr, buffer, bufsize);
#else
diff --git a/examples/device/msc_dual_lun/src/msc_disk_dual.c b/examples/device/msc_dual_lun/src/msc_disk_dual.c
index faa90ee7b..2ab050da8 100644
--- a/examples/device/msc_dual_lun/src/msc_disk_dual.c
+++ b/examples/device/msc_dual_lun/src/msc_disk_dual.c
@@ -29,11 +29,8 @@
#if CFG_TUD_MSC
// Some MCU doesn't have enough 8KB SRAM to store the whole disk
-// We will use Flash as read-only disk
-// - LPC1347, LPC11uxx
-#if (CFG_TUSB_MCU == OPT_MCU_LPC13XX) || (CFG_TUSB_MCU == OPT_MCU_LPC11UXX) || defined(STM32F070xB)
-#define DISK_READONLY
-#endif
+// We will use Flash as read-only disk with board that has
+// CFG_EXAMPLE_MSC_READONLY defined
enum
{
@@ -51,7 +48,7 @@ If you find any bugs or get any questions, feel free to file an\r\n\
issue at github.com/hathach/tinyusb"
-#ifdef DISK_READONLY
+#ifdef CFG_EXAMPLE_MSC_READONLY
const
#endif
uint8_t msc_disk0[DISK_BLOCK_NUM][DISK_BLOCK_SIZE] =
@@ -132,7 +129,7 @@ uint8_t msc_disk0[DISK_BLOCK_NUM][DISK_BLOCK_SIZE] =
If you find any bugs or get any questions, feel free to file an\r\n\
issue at github.com/hathach/tinyusb"
-#ifdef DISK_READONLY
+#ifdef CFG_EXAMPLE_MSC_READONLY
const
#endif
uint8_t msc_disk1[DISK_BLOCK_NUM][DISK_BLOCK_SIZE] =
@@ -281,7 +278,7 @@ int32_t tud_msc_read10_cb(uint8_t lun, uint32_t lba, uint32_t offset, void* buff
// Process data in buffer to disk's storage and return number of written bytes
int32_t tud_msc_write10_cb(uint8_t lun, uint32_t lba, uint32_t offset, uint8_t* buffer, uint32_t bufsize)
{
-#ifndef DISK_READONLY
+#ifndef CFG_EXAMPLE_MSC_READONLY
uint8_t* addr = (lun ? msc_disk1[lba] : msc_disk0[lba]) + offset;
memcpy(addr, buffer, bufsize);
#else
diff --git a/hw/bsp/lpcxpresso11u37/board.mk b/hw/bsp/lpcxpresso11u37/board.mk
index 2a7a9f74a..228765550 100644
--- a/hw/bsp/lpcxpresso11u37/board.mk
+++ b/hw/bsp/lpcxpresso11u37/board.mk
@@ -5,6 +5,7 @@ CFLAGS += \
-nostdlib \
-DCORE_M0 \
-D__USE_LPCOPEN \
+ -DCFG_EXAMPLE_MSC_READONLY \
-DCFG_TUSB_MCU=OPT_MCU_LPC11UXX \
-DCFG_TUSB_MEM_SECTION='__attribute__((section(".data.$$RAM2")))' \
-DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))'
diff --git a/hw/bsp/lpcxpresso1347/board.mk b/hw/bsp/lpcxpresso1347/board.mk
index edae27c61..4e0c70392 100644
--- a/hw/bsp/lpcxpresso1347/board.mk
+++ b/hw/bsp/lpcxpresso1347/board.mk
@@ -5,6 +5,7 @@ CFLAGS += \
-nostdlib \
-DCORE_M3 \
-D__USE_LPCOPEN \
+ -DCFG_EXAMPLE_MSC_READONLY \
-DCFG_TUSB_MCU=OPT_MCU_LPC13XX \
-DCFG_TUSB_MEM_SECTION='__attribute__((section(".data.$$RAM3")))' \
-DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))'
diff --git a/hw/bsp/stm32f070rbnucleo/board.mk b/hw/bsp/stm32f070rbnucleo/board.mk
index e4036982e..b53aac5bb 100644
--- a/hw/bsp/stm32f070rbnucleo/board.mk
+++ b/hw/bsp/stm32f070rbnucleo/board.mk
@@ -6,6 +6,7 @@ CFLAGS += \
-mcpu=cortex-m0 \
-mfloat-abi=soft \
-nostdlib -nostartfiles \
+ -DCFG_EXAMPLE_MSC_READONLY \
-DCFG_TUSB_MCU=OPT_MCU_STM32F0
ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F0xx_HAL_Driver
diff --git a/hw/bsp/stm32f072disco/board.mk b/hw/bsp/stm32f072disco/board.mk
index e16212fe3..0a58a5654 100644
--- a/hw/bsp/stm32f072disco/board.mk
+++ b/hw/bsp/stm32f072disco/board.mk
@@ -6,6 +6,7 @@ CFLAGS += \
-mcpu=cortex-m0 \
-mfloat-abi=soft \
-nostdlib -nostartfiles \
+ -DCFG_EXAMPLE_MSC_READONLY \
-DCFG_TUSB_MCU=OPT_MCU_STM32F0
ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F0xx_HAL_Driver