Compare commits

...

8 Commits

8 changed files with 805 additions and 519 deletions

View File

@@ -28,12 +28,10 @@ DSTATUS disk_status (
BYTE pdrv /* Physical drive nmuber to identify the drive */
)
{
DSTATUS stat;
int result;
switch (pdrv) {
case DEV_SD:
return sdio_status();
return sdio_status();
}
return STA_NOINIT;
}
@@ -48,12 +46,9 @@ DSTATUS disk_initialize (
BYTE pdrv /* Physical drive nmuber to identify the drive */
)
{
DSTATUS stat;
int result;
switch (pdrv) {
case DEV_SD:
return sdio_initialize();
return sdio_initialize();
}
return STA_NOINIT;
}
@@ -71,12 +66,9 @@ DRESULT disk_read (
UINT count /* Number of sectors to read */
)
{
DRESULT res;
int result;
switch (pdrv) {
case DEV_SD:
return sdio_disk_read(buff, sector, count);
return sdio_disk_read(buff, sector, count);
}
return RES_PARERR;
}
@@ -96,12 +88,9 @@ DRESULT disk_write (
UINT count /* Number of sectors to write */
)
{
DRESULT res;
int result;
switch (pdrv) {
case DEV_SD:
return SDIO_disk_write(buff, sector, count);
return sdio_disk_write(buff, sector, count);
}
return RES_PARERR;
@@ -120,12 +109,9 @@ DRESULT disk_ioctl (
void *buff /* Buffer to send/receive control data */
)
{
DRESULT res;
int result;
switch (pdrv) {
case DEV_SD:
return sdio_disk_ioctl(cmd, buff);
return sdio_disk_ioctl(cmd, buff);
}
return RES_PARERR;

File diff suppressed because it is too large Load Diff

View File

@@ -14,13 +14,16 @@
//Initial Transfer CLK (ca. 400kHz)
#define INITCLK 130 //120
//Working CLK (Maximum)
#define WORKCLK 50 //0
#define WORKCLK 2 //0
//Data Timeout in CLK Cycles
#define DTIMEOUT 0x3000 //150
#define DTIMEOUT 0x8000 //150
//DMA Stream used for TX and RX DMA2 Stream 3 or 6 possible
// Currently not used due to possible misalignment of the data buffer.
//#define DMASTREAM DMA2_Stream6
#define USE_DMA 1
#define DMASTREAM DMA2_Stream6
#define DMASTREAM_NO 6
/* Port Definitions */

View File

@@ -8,7 +8,7 @@
/ Function Configurations
/---------------------------------------------------------------------------*/
#define FF_FS_READONLY 1
#define FF_FS_READONLY 0
/* This option switches read-only configuration. (0:Read/Write or 1:Read-only)
/ Read-only configuration removes writing API functions, f_write(), f_sync(),
/ f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(), f_getfree()

32
main.c
View File

@@ -22,10 +22,16 @@ volatile uint32_t sdio_wait;
int initreq = 0xFF;
int main() {
char buff[1024];
//const char *write_string = "This is a write test. Okay... Writing seems to work. Let's close the file\n";
char buff[8192*6];
int main()
{
int i;
char *name;
FILINFO fno;
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN;
__DSB();
GPIOA->MODER |= OUTPUT(6) | OUTPUT(7);
@@ -39,20 +45,20 @@ int main() {
initreq = f_mount(&SDfs, "0:/", 1);
while(initreq);
initreq = f_opendir(&root, "/");
if (initreq == FR_OK) {
if (!f_readdir(&root, &fno))
{
name = fno.fname;
initreq = f_open(&file, name, FA_READ);
if (initreq == FR_OK) {
f_gets(buff, sizeof(buff), &file);
printf("%s:\r\n%s\r\n",name, buff);
f_close(&file);
}
for (i = 0; i < 8192*6; i++)
buff[i] = 'A';
initreq = f_open(&file, "foo.txt", FA_OPEN_APPEND | FA_WRITE);
if (initreq == FR_OK) {
for (i = 0; i < 100; i++) {
initreq = f_write(&file, buff, 8192*6, NULL);
if (initreq) {
initreq++;
}
}
initreq = f_close(&file);
}
//fflush(stdout);
while(1);

8
program-device.gdb Normal file
View File

@@ -0,0 +1,8 @@
target extended-remote :2331
monitor speed 4000
monitor reset
load
monitor reset
kill
quit

18
program-device.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/bin/bash
JLinkGDBServer -if SWD -device STM32F407VE &
sleep 2
# Check if GDB server is still running
gdbpid=`pidof JLinkGDBServer`
if [[ $gdbpid == "" ]]; then
echo ""
echo "GDB Server not running! Check target connection."
exit
fi
arm-none-eabi-gdb -x program-device.gdb stm32f4sdio.elf
sleep 2
kill $gdbpid

View File

@@ -152,7 +152,7 @@ SECTIONS
/* Uninitialized data section */
. = ALIGN(4);
.bss :
.bss (NOLOAD):
{
/* This is used by the startup in order to initialize the .bss secion */
_sbss = .; /* define a global symbol at bss start */
@@ -167,7 +167,7 @@ SECTIONS
} >RAM
/* User_heap_stack section, used to check that there is enough RAM left */
._user_heap_stack :
._user_heap_stack (NOLOAD):
{
. = ALIGN(4);
PROVIDE (heap_low = .); /* for _sbrk */