Support for booting from eMMC
Fusee will Look for FAT32 partition on BOOT1 (1MB offset), BOOT1, GPP, SD, in this order If a .no_boot_storage file is found in the root directory, the partition is skipped
This commit is contained in:
11
fusee/program/source/fatfs/diskio.c
vendored
11
fusee/program/source/fatfs/diskio.c
vendored
@@ -15,6 +15,8 @@
|
||||
|
||||
#include "diskio_cpp.h"
|
||||
|
||||
#define BOOT1_OFFSET_SCT_1MB 0x800
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Get Drive Status */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
@@ -57,6 +59,11 @@ DRESULT disk_read (
|
||||
return diskio_read_sd_card(buff, count * 512, sector, count) ? RES_OK : RES_ERROR;
|
||||
case DRIVE_SYS:
|
||||
return diskio_read_system(buff, count * 512, sector, count) ? RES_OK : RES_ERROR;
|
||||
case DRIVE_BOOT1:
|
||||
return diskio_read_boot1(buff, count * 512, sector, count) ? RES_OK : RES_ERROR;
|
||||
case DRIVE_BOOT1_OFF:
|
||||
return diskio_read_boot1(buff, count * 512, sector + BOOT1_OFFSET_SCT_1MB, count) ? RES_OK : RES_ERROR;
|
||||
|
||||
default:
|
||||
return RES_PARERR;
|
||||
}
|
||||
@@ -82,6 +89,10 @@ DRESULT disk_write (
|
||||
return diskio_write_sd_card(sector, count, buff, count * 512) ? RES_OK : RES_ERROR;
|
||||
case DRIVE_SYS:
|
||||
return diskio_write_system(sector, count, buff, count * 512) ? RES_OK : RES_ERROR;
|
||||
case DRIVE_BOOT1:
|
||||
return diskio_write_boot1(sector, count, buff, count * 512) ? RES_OK : RES_ERROR;
|
||||
case DRIVE_BOOT1_OFF:
|
||||
return diskio_write_boot1(sector + DRIVE_BOOT1_OFF, count, buff, count * 512) ? RES_OK : RES_ERROR;
|
||||
default:
|
||||
return RES_PARERR;
|
||||
}
|
||||
|
||||
2
fusee/program/source/fatfs/diskio.h
vendored
2
fusee/program/source/fatfs/diskio.h
vendored
@@ -25,6 +25,8 @@ typedef enum {
|
||||
typedef enum {
|
||||
DRIVE_SD,
|
||||
DRIVE_SYS,
|
||||
DRIVE_BOOT1,
|
||||
DRIVE_BOOT1_OFF,
|
||||
} DDRIVE;
|
||||
|
||||
|
||||
|
||||
3
fusee/program/source/fatfs/diskio_cpp.h
vendored
3
fusee/program/source/fatfs/diskio_cpp.h
vendored
@@ -25,6 +25,9 @@ bool diskio_write_sd_card(size_t sector_index, size_t sector_count, const void *
|
||||
bool diskio_read_system(void *dst, size_t size, size_t sector_index, size_t sector_count);
|
||||
bool diskio_write_system(size_t sector_index, size_t sector_count, const void *src, size_t size);
|
||||
|
||||
bool diskio_read_boot1(void *dst, size_t size, size_t sector_index, size_t sector_count);
|
||||
bool diskio_write_boot1(size_t sector_index, size_t sector_count, const void *src, size_t size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
6
fusee/program/source/fatfs/ffconf.h
vendored
6
fusee/program/source/fatfs/ffconf.h
vendored
@@ -150,7 +150,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#define FF_FS_RPATH 0
|
||||
#define FF_FS_RPATH 1
|
||||
/* This option configures support for relative path.
|
||||
/
|
||||
/ 0: Disable relative path and remove related functions.
|
||||
@@ -163,12 +163,12 @@
|
||||
/ Drive/Volume Configurations
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#define FF_VOLUMES 2
|
||||
#define FF_VOLUMES 4
|
||||
/* Number of volumes (logical drives) to be used. (1-10) */
|
||||
|
||||
|
||||
#define FF_STR_VOLUME_ID 1
|
||||
#define FF_VOLUME_STRS "sdmc","sys"
|
||||
#define FF_VOLUME_STRS "sdmc","sys","boot1","boot1_off"
|
||||
/* FF_STR_VOLUME_ID switches support for volume ID in arbitrary strings.
|
||||
/ When FF_STR_VOLUME_ID is set to 1 or 2, arbitrary strings can be used as drive
|
||||
/ number in the path name. FF_VOLUME_STRS defines the volume ID strings for each
|
||||
|
||||
9
fusee/program/source/fatfs/fusee_diskio.cpp
vendored
9
fusee/program/source/fatfs/fusee_diskio.cpp
vendored
@@ -33,4 +33,13 @@ bool diskio_read_system(void *dst, size_t size, size_t sector_index, size_t sect
|
||||
bool diskio_write_system(size_t sector_index, size_t sector_count, const void *src, size_t size) {
|
||||
/* Don't allow writes to eMMC GPP partition */
|
||||
return false;
|
||||
}
|
||||
|
||||
bool diskio_read_boot1(void *dst, size_t size, size_t sector_index, size_t sector_count) {
|
||||
return R_SUCCEEDED(::ams::nxboot::ReadMmc(dst, size, ::ams::sdmmc::MmcPartition::MmcPartition_BootPartition2, sector_index, sector_count));
|
||||
}
|
||||
|
||||
bool diskio_write_boot1(size_t sector_index, size_t sector_count, const void *src, size_t size) {
|
||||
/* Don't allow writes to eMMC BOOT1 */
|
||||
return false;
|
||||
}
|
||||
Reference in New Issue
Block a user