Compare commits
6 Commits
6021c9e1e2
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 04a1714237 | |||
| e616e22dd7 | |||
| bea543269e | |||
| a2256acd94 | |||
| 641a6a88af | |||
| d722738de9 |
@@ -28,12 +28,10 @@ DSTATUS disk_status (
|
|||||||
BYTE pdrv /* Physical drive nmuber to identify the drive */
|
BYTE pdrv /* Physical drive nmuber to identify the drive */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
DSTATUS stat;
|
|
||||||
int result;
|
|
||||||
|
|
||||||
switch (pdrv) {
|
switch (pdrv) {
|
||||||
case DEV_SD:
|
case DEV_SD:
|
||||||
return sdio_status();
|
return sdio_status();
|
||||||
}
|
}
|
||||||
return STA_NOINIT;
|
return STA_NOINIT;
|
||||||
}
|
}
|
||||||
@@ -48,12 +46,9 @@ DSTATUS disk_initialize (
|
|||||||
BYTE pdrv /* Physical drive nmuber to identify the drive */
|
BYTE pdrv /* Physical drive nmuber to identify the drive */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
DSTATUS stat;
|
|
||||||
int result;
|
|
||||||
|
|
||||||
switch (pdrv) {
|
switch (pdrv) {
|
||||||
case DEV_SD:
|
case DEV_SD:
|
||||||
return sdio_initialize();
|
return sdio_initialize();
|
||||||
}
|
}
|
||||||
return STA_NOINIT;
|
return STA_NOINIT;
|
||||||
}
|
}
|
||||||
@@ -71,12 +66,9 @@ DRESULT disk_read (
|
|||||||
UINT count /* Number of sectors to read */
|
UINT count /* Number of sectors to read */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
DRESULT res;
|
|
||||||
int result;
|
|
||||||
|
|
||||||
switch (pdrv) {
|
switch (pdrv) {
|
||||||
case DEV_SD:
|
case DEV_SD:
|
||||||
return sdio_disk_read(buff, sector, count);
|
return sdio_disk_read(buff, sector, count);
|
||||||
}
|
}
|
||||||
return RES_PARERR;
|
return RES_PARERR;
|
||||||
}
|
}
|
||||||
@@ -96,12 +88,9 @@ DRESULT disk_write (
|
|||||||
UINT count /* Number of sectors to write */
|
UINT count /* Number of sectors to write */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
DRESULT res;
|
|
||||||
int result;
|
|
||||||
|
|
||||||
switch (pdrv) {
|
switch (pdrv) {
|
||||||
case DEV_SD:
|
case DEV_SD:
|
||||||
return SDIO_disk_write(buff, sector, count);
|
return sdio_disk_write(buff, sector, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
return RES_PARERR;
|
return RES_PARERR;
|
||||||
@@ -120,12 +109,9 @@ DRESULT disk_ioctl (
|
|||||||
void *buff /* Buffer to send/receive control data */
|
void *buff /* Buffer to send/receive control data */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
DRESULT res;
|
|
||||||
int result;
|
|
||||||
|
|
||||||
switch (pdrv) {
|
switch (pdrv) {
|
||||||
case DEV_SD:
|
case DEV_SD:
|
||||||
return sdio_disk_ioctl(cmd, buff);
|
return sdio_disk_ioctl(cmd, buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
return RES_PARERR;
|
return RES_PARERR;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -14,13 +14,16 @@
|
|||||||
//Initial Transfer CLK (ca. 400kHz)
|
//Initial Transfer CLK (ca. 400kHz)
|
||||||
#define INITCLK 130 //120
|
#define INITCLK 130 //120
|
||||||
//Working CLK (Maximum)
|
//Working CLK (Maximum)
|
||||||
#define WORKCLK 50 //0
|
#define WORKCLK 2 //0
|
||||||
//Data Timeout in CLK Cycles
|
//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
|
//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 */
|
/* Port Definitions */
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
/ Function Configurations
|
/ 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)
|
/* This option switches read-only configuration. (0:Read/Write or 1:Read-only)
|
||||||
/ Read-only configuration removes writing API functions, f_write(), f_sync(),
|
/ Read-only configuration removes writing API functions, f_write(), f_sync(),
|
||||||
/ f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(), f_getfree()
|
/ f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(), f_getfree()
|
||||||
|
|||||||
32
main.c
32
main.c
@@ -22,10 +22,16 @@ volatile uint32_t sdio_wait;
|
|||||||
|
|
||||||
int initreq = 0xFF;
|
int initreq = 0xFF;
|
||||||
|
|
||||||
int main() {
|
//const char *write_string = "This is a write test. Okay... Writing seems to work. Let's close the file\n";
|
||||||
char buff[1024];
|
|
||||||
|
char buff[8192*6];
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int i;
|
||||||
char *name;
|
char *name;
|
||||||
FILINFO fno;
|
FILINFO fno;
|
||||||
|
|
||||||
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN;
|
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN;
|
||||||
__DSB();
|
__DSB();
|
||||||
GPIOA->MODER |= OUTPUT(6) | OUTPUT(7);
|
GPIOA->MODER |= OUTPUT(6) | OUTPUT(7);
|
||||||
@@ -39,20 +45,20 @@ int main() {
|
|||||||
initreq = f_mount(&SDfs, "0:/", 1);
|
initreq = f_mount(&SDfs, "0:/", 1);
|
||||||
while(initreq);
|
while(initreq);
|
||||||
|
|
||||||
initreq = f_opendir(&root, "/");
|
for (i = 0; i < 8192*6; i++)
|
||||||
if (initreq == FR_OK) {
|
buff[i] = 'A';
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
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);
|
//fflush(stdout);
|
||||||
|
|
||||||
while(1);
|
while(1);
|
||||||
|
|||||||
8
program-device.gdb
Normal file
8
program-device.gdb
Normal 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
18
program-device.sh
Executable 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
|
||||||
Reference in New Issue
Block a user