summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorhathach <[email protected]>2022-11-21 11:12:10 +0700
committerhathach <[email protected]>2022-11-21 11:12:10 +0700
commit47bc269b50eb0fab9ac2f708cecdce2e2df601d9 (patch)
treeadb85576cd8bb7b83518fd7263cce5ab56cf7ccd /examples
parent2312bfe3c4be116403974f922d08e5f5cf8a166c (diff)
fix build with rp2040 and rx65
Diffstat (limited to 'examples')
-rw-r--r--examples/host/msc_file_explorer/CMakeLists.txt7
-rw-r--r--examples/host/msc_file_explorer/src/msc_app.c16
-rw-r--r--examples/make.mk3
3 files changed, 16 insertions, 10 deletions
diff --git a/examples/host/msc_file_explorer/CMakeLists.txt b/examples/host/msc_file_explorer/CMakeLists.txt
index fc4765cdc..5d443ea9b 100644
--- a/examples/host/msc_file_explorer/CMakeLists.txt
+++ b/examples/host/msc_file_explorer/CMakeLists.txt
@@ -16,11 +16,16 @@ add_executable(${PROJECT})
target_sources(${PROJECT} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
${CMAKE_CURRENT_SOURCE_DIR}/src/msc_app.c
+ ${TOP}/lib/fatfs/source/ff.c
+ ${TOP}/lib/fatfs/source/ffsystem.c
+ ${TOP}/lib/fatfs/source/ffunicode.c
)
# Example include
target_include_directories(${PROJECT} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src
+ ${TOP}/lib/fatfs/source
+ ${TOP}/lib/embedded-cli
)
# Configure compilation flags and libraries for the example... see the corresponding function
@@ -30,7 +35,7 @@ family_configure_host_example(${PROJECT})
# For rp2040, un-comment to enable pico-pio-usb
family_add_pico_pio_usb(${PROJECT})
-# due to warnings from Pico-PIO-USB
+# due to warnings from Pico-PIO-USB and fatfs
target_compile_options(${PROJECT} PUBLIC
-Wno-error=shadow
-Wno-error=cast-align
diff --git a/examples/host/msc_file_explorer/src/msc_app.c b/examples/host/msc_file_explorer/src/msc_app.c
index 5b9b72d43..a1822b422 100644
--- a/examples/host/msc_file_explorer/src/msc_app.c
+++ b/examples/host/msc_file_explorer/src/msc_app.c
@@ -205,7 +205,7 @@ DRESULT disk_read (
uint8_t const lun = 0;
_disk_busy[pdrv] = true;
- tuh_msc_read10(dev_addr, lun, buff, sector, count, disk_io_complete);
+ tuh_msc_read10(dev_addr, lun, buff, sector, (uint16_t) count, disk_io_complete);
wait_for_disk_io(pdrv);
return RES_OK;
@@ -224,7 +224,7 @@ DRESULT disk_write (
uint8_t const lun = 0;
_disk_busy[pdrv] = true;
- tuh_msc_write10(dev_addr, lun, buff, sector, count, disk_io_complete);
+ tuh_msc_write10(dev_addr, lun, buff, sector, (uint16_t) count, disk_io_complete);
wait_for_disk_io(pdrv);
return RES_OK;
@@ -247,11 +247,11 @@ DRESULT disk_ioctl (
return RES_OK;
case GET_SECTOR_COUNT:
- *((DWORD*) buff) = tuh_msc_get_block_count(dev_addr, lun);
+ *((DWORD*) buff) = (WORD) tuh_msc_get_block_count(dev_addr, lun);
return RES_OK;
case GET_SECTOR_SIZE:
- *((WORD*) buff) = tuh_msc_get_block_size(dev_addr, lun);
+ *((WORD*) buff) = (WORD) tuh_msc_get_block_size(dev_addr, lun);
return RES_OK;
case GET_BLOCK_SIZE:
@@ -380,10 +380,10 @@ void cli_cmd_cat(EmbeddedCli *cli, char *args, void *context)
}else
{
uint8_t buf[512];
- size_t count = 0;
+ UINT count = 0;
while ( (FR_OK == f_read(&fi, buf, sizeof(buf), &count)) && (count > 0) )
{
- for(size_t c = 0; c < count; c++)
+ for(UINT c = 0; c < count; c++)
{
const char ch = buf[c];
if (isprint(ch) || iscntrl(ch))
@@ -455,10 +455,10 @@ void cli_cmd_cp(EmbeddedCli *cli, char *args, void *context)
}else
{
uint8_t buf[512];
- size_t rd_count = 0;
+ UINT rd_count = 0;
while ( (FR_OK == f_read(&f_src, buf, sizeof(buf), &rd_count)) && (rd_count > 0) )
{
- size_t wr_count = 0;
+ UINT wr_count = 0;
if ( FR_OK != f_write(&f_dst, buf, rd_count, &wr_count) )
{
diff --git a/examples/make.mk b/examples/make.mk
index 47520d660..73a39a8fe 100644
--- a/examples/make.mk
+++ b/examples/make.mk
@@ -113,7 +113,8 @@ CFLAGS += \
# Debugging/Optimization
ifeq ($(DEBUG), 1)
- CFLAGS += -Og
+ CFLAGS += -O0
+ NO_LTO = 1
else
CFLAGS += $(CFLAGS_OPTIMIZED)
endif