Skip to content

Commit 0b32b41

Browse files
committed
Integrate FatFs and SDIO write support
1 parent 2c3ec4d commit 0b32b41

19 files changed

Lines changed: 24997 additions & 53 deletions

File tree

ch32v305/CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,18 @@ file(GLOB_RECURSE SRC_FILES_RECURSE CONFIGURE_DEPENDS
5050
lib/tinyusb/src/*.c
5151
)
5252

53+
set(FATFS_SOURCES
54+
lib/fatfs/source/ff.c
55+
lib/fatfs/source/ffunicode.c
56+
)
57+
5358
add_executable(${EXECUTABLE}
5459
lib/Startup/startup_ch32v30x_D8C.S
5560
lib/Core/core_riscv.c
5661

5762
${SRC_FILES}
5863
${SRC_FILES_RECURSE}
64+
${FATFS_SOURCES}
5965

6066
)
6167

@@ -64,6 +70,7 @@ target_include_directories(${EXECUTABLE} PRIVATE
6470
lib/Core/
6571
lib/Debug/
6672
lib/Peripheral/inc
73+
lib/fatfs/source
6774
lib/tinyusb/src
6875
${NMSIS_ROOT}/Core/Include
6976
${NMSIS_ROOT}/DSP/Include
@@ -93,7 +100,7 @@ target_compile_options(${EXECUTABLE} PRIVATE
93100
-Wunused -Wuninitialized
94101

95102
-MMD -MP
96-
-flto
103+
-flto=2
97104
-Wall
98105
-g3
99106
-Ofast
@@ -130,7 +137,7 @@ target_link_options(${EXECUTABLE} PRIVATE
130137
-lstdc++
131138
-lsupc++
132139
-ffreestanding
133-
-flto
140+
-flto=2
134141
-Wl,-Map=${PROJECT_NAME}.map,--cref
135142
-Wl,--gc-sections
136143
-Wl,--print-memory-usage

ch32v305/lib/fatfs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/documents/

ch32v305/lib/fatfs/LICENSE.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FatFs License
2+
3+
FatFs has being developped as a personal project of the author, ChaN. It is free from the code anyone else wrote at current release. Following code block shows a copy of the FatFs license document that heading the source files.
4+
5+
/*----------------------------------------------------------------------------/
6+
/ FatFs - Generic FAT Filesystem Module Rx.xx /
7+
/-----------------------------------------------------------------------------/
8+
/
9+
/ Copyright (C) 20xx, ChaN, all right reserved.
10+
/
11+
/ FatFs module is an open source software. Redistribution and use of FatFs in
12+
/ source and binary forms, with or without modification, are permitted provided
13+
/ that the following condition is met:
14+
/
15+
/ 1. Redistributions of source code must retain the above copyright notice,
16+
/ this condition and the following disclaimer.
17+
/
18+
/ This software is provided by the copyright holder and contributors "AS IS"
19+
/ and any warranties related to this software are DISCLAIMED.
20+
/ The copyright owner or contributors be NOT LIABLE for any damages caused
21+
/ by use of this software.
22+
/----------------------------------------------------------------------------*/
23+
24+
Therefore FatFs license is one of the BSD-style licenses, but there is a significant feature. FatFs is mainly intended for embedded systems. In order to extend the usability for commercial products, the redistributions of FatFs in binary form, such as embedded code, binary library and any forms without source code, do not need to include about FatFs in the documentations. This is equivalent to the 1-clause BSD license. Of course FatFs is compatible with the most of open source software licenses include GNU GPL. When you redistribute the FatFs source code with changes or create a fork, the license can also be changed to GNU GPL, BSD-style license or any open source software license that not conflict with FatFs license.

0 commit comments

Comments
 (0)