This code should be the basic code for LittleFS integration into a FLASH memory module, and should include all the basic functions for the FLASH memory module.
Changes Made from pervious branch
All files
Used DEBUG_ instead of debug_
littlefs_driver.h
Added function name uint8_t LFS_get_chip_number(lfs_block_t block_num);
littlefs_helper.h
Commented out #include <stdint.h> as it wasn't required since the data type was available through #include "littlefs/flash_driver.h"
Renamed LFS_read_file_data to LFS_read_file to keep with naming convention
Added function name int8_t LFS_list_directory(char *root_directory);+ 2 more
flash_driver.h
Commented out #include <stdint.h> as it wasn't required since the data type was available through #include "main.h"
Added #define FLASH_CHIP_BLOCK_SIZE_BYTES 262144 and #define FLASH_CHIP_PAGE_SIZE_BYTES 512
littlefs_driver.c
Commented out #include "main.h" as it wasn't required
Implemented uint8_t LFS_get_chip_number(lfs_block_t block_num); using for-loop, although it would be better readable using if-statements. Willing to change it if needed.
Minor changes to comments
littlefs_helper.c
Commented out #include <stdint.h> as it wasn't required, not exactly sure how it's able to access data types
Changed the size of read and program buffers to FLASH_CHIP_PAGE_SIZE_BYTES
Used the flash_driver.h defines to configure LittleFS
Commented out #include "main.h" as it wasn't required
// TODO: check if this is how we want to access the FRAM chips ~ Not sure if we want to do this as it wouldn't work well if we wanted to access FLASH and FRAM together or closely together
Uncommented Line 310 FLASH_deactivate_chip_select(); as I am not quite sure why it was commented with the comment // NOTE: The following line is now commented out. It was previously here though, weird. I could be missing something, so I am willing to change this back
Minor changes to comments
debug_uart.h, debug_uart.c
Added DEBUG_uart_print_array_hex
Up Next
There are // FIXME: and // TODO: still around the code I will try and cover, but alongside I aim to create unit tests able to cover the basic FLASH driver code to check if user has the ability to write/read/erase without LittleFS
This code should be the basic code for LittleFS integration into a FLASH memory module, and should include all the basic functions for the FLASH memory module.
Changes Made from pervious branch
All files
DEBUG_
instead ofdebug_
littlefs_driver.h
uint8_t LFS_get_chip_number(lfs_block_t block_num);
littlefs_helper.h
#include <stdint.h>
as it wasn't required since the data type was available through#include "littlefs/flash_driver.h"
LFS_read_file_data
toLFS_read_file
to keep with naming conventionint8_t LFS_list_directory(char *root_directory);
+ 2 moreflash_driver.h
#include <stdint.h>
as it wasn't required since the data type was available through#include "main.h"
#define FLASH_CHIP_BLOCK_SIZE_BYTES 262144
and#define FLASH_CHIP_PAGE_SIZE_BYTES 512
littlefs_driver.c
#include "main.h"
as it wasn't requireduint8_t LFS_get_chip_number(lfs_block_t block_num);
using for-loop, although it would be better readable using if-statements. Willing to change it if needed.littlefs_helper.c
#include <stdint.h>
as it wasn't required, not exactly sure how it's able to access data typesFLASH_CHIP_PAGE_SIZE_BYTES
flash_driver.h
defines to configure LittleFSLFS_list_directory
,LFS_delete_file
,LFS_make_directory
flash_driver.c
#include "main.h"
as it wasn't required// TODO: check if this is how we want to access the FRAM chips
~ Not sure if we want to do this as it wouldn't work well if we wanted to access FLASH and FRAM together or closely togetherFLASH_deactivate_chip_select();
as I am not quite sure why it was commented with the comment// NOTE: The following line is now commented out. It was previously here though, weird.
I could be missing something, so I am willing to change this backdebug_uart.h
,debug_uart.c
DEBUG_uart_print_array_hex
Up Next
There are
// FIXME:
and// TODO:
still around the code I will try and cover, but alongside I aim to create unit tests able to cover the basic FLASH driver code to check if user has the ability to write/read/erase without LittleFS