Edit linker script and fix read function in SDIO
This commit is contained in:
		@@ -246,15 +246,19 @@ DRESULT SDIO_disk_read(BYTE *buff, DWORD sector, UINT count){
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		SDIO->DLEN = (1 << BLOCKSIZE);
 | 
							SDIO->DLEN = (1 << BLOCKSIZE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/* Init Transfer */
 | 
					
 | 
				
			||||||
		if (SDIO_send_read_block_CMD17(addr)) {
 | 
					 | 
				
			||||||
			return RES_ERROR;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		SDIO->ICR = SDIO_ICR_CCRCFAILC | SDIO_ICR_DCRCFAILC | SDIO_ICR_CTIMEOUTC | SDIO_ICR_DTIMEOUTC |
 | 
							SDIO->ICR = SDIO_ICR_CCRCFAILC | SDIO_ICR_DCRCFAILC | SDIO_ICR_CTIMEOUTC | SDIO_ICR_DTIMEOUTC |
 | 
				
			||||||
						SDIO_ICR_TXUNDERRC | SDIO_ICR_RXOVERRC | SDIO_ICR_CMDRENDC | SDIO_ICR_CMDSENTC | SDIO_ICR_DATAENDC |
 | 
											SDIO_ICR_TXUNDERRC | SDIO_ICR_RXOVERRC | SDIO_ICR_CMDRENDC | SDIO_ICR_CMDSENTC | SDIO_ICR_DATAENDC |
 | 
				
			||||||
						SDIO_ICR_STBITERRC | SDIO_ICR_DBCKENDC | SDIO_ICR_SDIOITC | SDIO_ICR_CEATAENDC;
 | 
											SDIO_ICR_STBITERRC | SDIO_ICR_DBCKENDC | SDIO_ICR_SDIOITC | SDIO_ICR_CEATAENDC;
 | 
				
			||||||
		SDIO->DCTRL = (BLOCKSIZE<<4) | SDIO_DCTRL_DTDIR | /*SDIO_DCTRL_DMAEN |*/ SDIO_DCTRL_DTEN;
 | 
							SDIO->DCTRL = (BLOCKSIZE<<4) | SDIO_DCTRL_DTDIR | /*SDIO_DCTRL_DMAEN |*/ SDIO_DCTRL_DTEN;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									/* Init Transfer */
 | 
				
			||||||
 | 
							if (SDIO_send_read_block_CMD17(addr)) {
 | 
				
			||||||
 | 
								SDIO->DCTRL = 0;
 | 
				
			||||||
 | 
								return RES_ERROR;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		debug=0;
 | 
							debug=0;
 | 
				
			||||||
		counter = 0;
 | 
							counter = 0;
 | 
				
			||||||
		while (counter < (1<<(BLOCKSIZE-2)) || !(SDIO->STA & (SDIO_STA_DBCKEND | SDIO_STA_DATAEND))) { // TODO: Handle errors
 | 
							while (counter < (1<<(BLOCKSIZE-2)) || !(SDIO->STA & (SDIO_STA_DBCKEND | SDIO_STA_DATAEND))) { // TODO: Handle errors
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -152,7 +152,7 @@ SECTIONS
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  /* Uninitialized data section */
 | 
					  /* Uninitialized data section */
 | 
				
			||||||
  . = ALIGN(4);
 | 
					  . = ALIGN(4);
 | 
				
			||||||
  .bss :
 | 
					  .bss (NOLOAD):
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    /* This is used by the startup in order to initialize the .bss secion */
 | 
					    /* This is used by the startup in order to initialize the .bss secion */
 | 
				
			||||||
    _sbss = .;         /* define a global symbol at bss start */
 | 
					    _sbss = .;         /* define a global symbol at bss start */
 | 
				
			||||||
@@ -167,7 +167,7 @@ SECTIONS
 | 
				
			|||||||
  } >RAM
 | 
					  } >RAM
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* User_heap_stack section, used to check that there is enough RAM left */
 | 
					  /* User_heap_stack section, used to check that there is enough RAM left */
 | 
				
			||||||
  ._user_heap_stack :
 | 
					  ._user_heap_stack (NOLOAD):
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    . = ALIGN(4);
 | 
					    . = ALIGN(4);
 | 
				
			||||||
    PROVIDE (heap_low = .); /* for _sbrk */
 | 
					    PROVIDE (heap_low = .); /* for _sbrk */
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user