fix alignment

This commit is contained in:
funshine 2015-01-27 21:02:54 +08:00
parent 425e664114
commit 6a0599d22c
2 changed files with 2 additions and 2 deletions

View File

@ -45,7 +45,7 @@ The small 4KB sectors allow for greater flexibility in applications th
void spiffs_mount() { void spiffs_mount() {
spiffs_config cfg; spiffs_config cfg;
cfg.phys_addr = ( u32_t )platform_flash_get_first_free_block_address( NULL ); cfg.phys_addr = ( u32_t )platform_flash_get_first_free_block_address( NULL );
cfg.phys_addr += 0x4000; cfg.phys_addr += 0x3000;
cfg.phys_addr &= 0xFFFFC000; // align to 4 sector. cfg.phys_addr &= 0xFFFFC000; // align to 4 sector.
cfg.phys_size = INTERNAL_FLASH_SIZE - ( ( u32_t )cfg.phys_addr - INTERNAL_FLASH_START_ADDRESS ); cfg.phys_size = INTERNAL_FLASH_SIZE - ( ( u32_t )cfg.phys_addr - INTERNAL_FLASH_START_ADDRESS );
cfg.phys_erase_block = INTERNAL_FLASH_SECTOR_SIZE; // according to datasheet cfg.phys_erase_block = INTERNAL_FLASH_SECTOR_SIZE; // according to datasheet
@ -76,7 +76,7 @@ int myspiffs_format( void )
SPIFFS_unmount(&fs); SPIFFS_unmount(&fs);
u32_t sect_first, sect_last; u32_t sect_first, sect_last;
sect_first = ( u32_t )platform_flash_get_first_free_block_address( NULL ); sect_first = ( u32_t )platform_flash_get_first_free_block_address( NULL );
sect_first += 0x4000; sect_first += 0x3000;
sect_first &= 0xFFFFC000; // align to 4 sector. sect_first &= 0xFFFFC000; // align to 4 sector.
sect_first = platform_flash_get_sector_of_address(sect_first); sect_first = platform_flash_get_sector_of_address(sect_first);
sect_last = INTERNAL_FLASH_SIZE + INTERNAL_FLASH_START_ADDRESS - 4; sect_last = INTERNAL_FLASH_SIZE + INTERNAL_FLASH_START_ADDRESS - 4;

Binary file not shown.