fix build with rp2040 and rx65

This commit is contained in:
hathach 2022-11-21 11:12:10 +07:00
parent 2312bfe3c4
commit 47bc269b50
No known key found for this signature in database
GPG Key ID: F5D50C6D51D17CBA
3 changed files with 16 additions and 10 deletions

View File

@ -16,11 +16,16 @@ add_executable(${PROJECT})
target_sources(${PROJECT} PUBLIC target_sources(${PROJECT} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
${CMAKE_CURRENT_SOURCE_DIR}/src/msc_app.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 # Example include
target_include_directories(${PROJECT} PUBLIC target_include_directories(${PROJECT} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src ${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 # 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 # For rp2040, un-comment to enable pico-pio-usb
family_add_pico_pio_usb(${PROJECT}) 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 target_compile_options(${PROJECT} PUBLIC
-Wno-error=shadow -Wno-error=shadow
-Wno-error=cast-align -Wno-error=cast-align

View File

@ -205,7 +205,7 @@ DRESULT disk_read (
uint8_t const lun = 0; uint8_t const lun = 0;
_disk_busy[pdrv] = true; _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); wait_for_disk_io(pdrv);
return RES_OK; return RES_OK;
@ -224,7 +224,7 @@ DRESULT disk_write (
uint8_t const lun = 0; uint8_t const lun = 0;
_disk_busy[pdrv] = true; _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); wait_for_disk_io(pdrv);
return RES_OK; return RES_OK;
@ -247,11 +247,11 @@ DRESULT disk_ioctl (
return RES_OK; return RES_OK;
case GET_SECTOR_COUNT: 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; return RES_OK;
case GET_SECTOR_SIZE: 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; return RES_OK;
case GET_BLOCK_SIZE: case GET_BLOCK_SIZE:
@ -380,10 +380,10 @@ void cli_cmd_cat(EmbeddedCli *cli, char *args, void *context)
}else }else
{ {
uint8_t buf[512]; uint8_t buf[512];
size_t count = 0; UINT count = 0;
while ( (FR_OK == f_read(&fi, buf, sizeof(buf), &count)) && (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]; const char ch = buf[c];
if (isprint(ch) || iscntrl(ch)) if (isprint(ch) || iscntrl(ch))
@ -455,10 +455,10 @@ void cli_cmd_cp(EmbeddedCli *cli, char *args, void *context)
}else }else
{ {
uint8_t buf[512]; 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) ) 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) ) if ( FR_OK != f_write(&f_dst, buf, rd_count, &wr_count) )
{ {

View File

@ -113,7 +113,8 @@ CFLAGS += \
# Debugging/Optimization # Debugging/Optimization
ifeq ($(DEBUG), 1) ifeq ($(DEBUG), 1)
CFLAGS += -Og CFLAGS += -O0
NO_LTO = 1
else else
CFLAGS += $(CFLAGS_OPTIMIZED) CFLAGS += $(CFLAGS_OPTIMIZED)
endif endif