summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2024-07-22 16:01:39 +0700
committerhathach <[email protected]>2024-07-22 21:07:28 +0700
commit4de46fcf975d57983192874feea9d94427f5de50 (patch)
tree0e76370111704744d129b10d6d36bfac694bc4a1
parente09cf361048ec4a77ce6ec6ac35f1b8b2d62d76c (diff)
fix a bug in fsdev introduced by #1942
-rw-r--r--hw/bsp/ch32v20x/boards/ch32v203c_r0_1v0/board.cmake1
-rw-r--r--hw/bsp/ch32v20x/boards/ch32v203g_r0_1v0/board.cmake1
-rw-r--r--hw/bsp/ch32v20x/boards/nanoch32v203/board.cmake1
-rw-r--r--hw/bsp/ch32v20x/family.cmake6
-rw-r--r--src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c2
5 files changed, 7 insertions, 4 deletions
diff --git a/hw/bsp/ch32v20x/boards/ch32v203c_r0_1v0/board.cmake b/hw/bsp/ch32v20x/boards/ch32v203c_r0_1v0/board.cmake
index adb0ea741..4aae6bdc2 100644
--- a/hw/bsp/ch32v20x/boards/ch32v203c_r0_1v0/board.cmake
+++ b/hw/bsp/ch32v20x/boards/ch32v203c_r0_1v0/board.cmake
@@ -10,7 +10,6 @@ set(LD_RAM_SIZE 20K)
function(update_board TARGET)
target_compile_definitions(${TARGET} PUBLIC
SYSCLK_FREQ_144MHz_HSE=144000000
- CH32_FLASH_ENHANCE_READ_MODE=1
CFG_EXAMPLE_MSC_DUAL_READONLY
)
endfunction()
diff --git a/hw/bsp/ch32v20x/boards/ch32v203g_r0_1v0/board.cmake b/hw/bsp/ch32v20x/boards/ch32v203g_r0_1v0/board.cmake
index 6fe3e05b2..ecb8b378f 100644
--- a/hw/bsp/ch32v20x/boards/ch32v203g_r0_1v0/board.cmake
+++ b/hw/bsp/ch32v20x/boards/ch32v203g_r0_1v0/board.cmake
@@ -8,7 +8,6 @@ set(LD_RAM_SIZE 10K)
function(update_board TARGET)
target_compile_definitions(${TARGET} PUBLIC
SYSCLK_FREQ_144MHz_HSI=144000000
- CH32_FLASH_ENHANCE_READ_MODE=1
CFG_EXAMPLE_MSC_DUAL_READONLY
)
endfunction()
diff --git a/hw/bsp/ch32v20x/boards/nanoch32v203/board.cmake b/hw/bsp/ch32v20x/boards/nanoch32v203/board.cmake
index ed7365797..a0bf12b5c 100644
--- a/hw/bsp/ch32v20x/boards/nanoch32v203/board.cmake
+++ b/hw/bsp/ch32v20x/boards/nanoch32v203/board.cmake
@@ -8,7 +8,6 @@ set(LD_RAM_SIZE 20K)
function(update_board TARGET)
target_compile_definitions(${TARGET} PUBLIC
SYSCLK_FREQ_144MHz_HSE=144000000
- CH32_FLASH_ENHANCE_READ_MODE=1
CFG_EXAMPLE_MSC_DUAL_READONLY
)
endfunction()
diff --git a/hw/bsp/ch32v20x/family.cmake b/hw/bsp/ch32v20x/family.cmake
index bf929b862..380ef190d 100644
--- a/hw/bsp/ch32v20x/family.cmake
+++ b/hw/bsp/ch32v20x/family.cmake
@@ -72,6 +72,12 @@ function(add_board_target BOARD_TARGET)
update_board(${BOARD_TARGET})
+ if (LD_FLASH_SIZE STREQUAL 224K)
+ target_compile_definitions(${BOARD_TARGET} PUBLIC
+ CH32_FLASH_ENHANCE_READ_MODE=1
+ )
+ endif()
+
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
target_compile_options(${BOARD_TARGET} PUBLIC
-mcmodel=medany
diff --git a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
index 8bfb899ca..39f33bc34 100644
--- a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
+++ b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
@@ -1004,7 +1004,7 @@ static bool dcd_write_packet_memory(uint16_t dst, const void *__restrict src, ui
srcVal++;
}
- if (wNBytes) {
+ if (wNBytes & 0x01) {
temp1 = (uint16_t) *srcVal;
*pdwVal = temp1;
}